Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45cb50e6 authored by Zhang Rui's avatar Zhang Rui Committed by Len Brown
Browse files

ACPI video: dmi check for broken _BQC on Acer Aspire 5720

On Acer Aspire 5720, _BQC always returns a value 9 smaller than
the actual brightness level.  Add dmi quirk for this laptop.

http://bugzilla.kernel.org/show_bug.cgi?id=13121



Tested-by: default avatarMaxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 09106974
Loading
Loading
Loading
Loading
+30 −0
Original line number Original line Diff line number Diff line
@@ -538,6 +538,33 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
	return -EINVAL;
	return -EINVAL;
}
}


/*
 * For some buggy _BQC methods, we need to add a constant value to
 * the _BQC return value to get the actual current brightness level
 */

static int bqc_offset_aml_bug_workaround;
static int __init video_set_bqc_offset(const struct dmi_system_id *d)
{
	bqc_offset_aml_bug_workaround = 9;
	return 0;
}

static struct dmi_system_id video_dmi_table[] __initdata = {
	/*
	 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
	 */
	{
	 .callback = video_set_bqc_offset,
	 .ident = "Acer Aspire 5720",
	 .matches = {
		DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
		DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
		},
	},
	{}
};

static int
static int
acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
					unsigned long long *level)
					unsigned long long *level)
@@ -557,6 +584,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
				*level = device->brightness->levels[*level + 2];
				*level = device->brightness->levels[*level + 2];


			}
			}
			*level += bqc_offset_aml_bug_workaround;
			device->brightness->curr = *level;
			device->brightness->curr = *level;
			return 0;
			return 0;
		} else {
		} else {
@@ -2287,6 +2315,8 @@ EXPORT_SYMBOL(acpi_video_register);


static int __init acpi_video_init(void)
static int __init acpi_video_init(void)
{
{
	dmi_check_system(video_dmi_table);

	if (intel_opregion_present())
	if (intel_opregion_present())
		return 0;
		return 0;