[Jaunty] SRU: Fix video backlight regression on Acer laptop

Amit Kucheria amit.kucheria at canonical.com
Tue Sep 1 09:11:07 BST 2009


On 09 Aug 28, Stefan Bader wrote:
> SRU justification:
> 
> Impact: After I carelessly pulled in some updates to the ACPI video
> code, we were faced with some regressions. One was (at least) a
> certain Acer laptop model that suddenly had no backlight control.
> 
> Fix: As the ACPI BIOS is broken on a way that only the *wrong*
> graphics definition will be accepted by acpi-video as the right
> definition lacks an attribute to be considered, the fix is to have
> less strict requirements to that check, so the definition for the
> right graphics device gets accepted (a patch doing that
> unconditionally, has been submitted upstream and has been acked, but
> might not make it until 2.6.32). For the stable tree I created more
> code which makes sure the less strict tests only take effect on that
> laptop or when the user really wants to.
> 
> Testcase: Booting on another laptop will not activate the code
> (which prints a "Using less strict video detection..." message) but
> will do with "acpi_video_strict_detect=0". In both cases nothing bad
> happened. The affected laptop boots and selects the new check which
> gives back the backlight control.
> 
> -- 
> 
> When all other means of communication fail, try words!
> 
> 

> From 55642b95547f9ed149bcc009cb522ce46ea7c40d Mon Sep 17 00:00:00 2001
> From: Stefan Bader <stefan.bader at canonical.com>
> Date: Thu, 27 Aug 2009 19:47:32 +0200
> Subject: [PATCH] UBUNTU: SAUCE: Allow less restrictive acpi video detection
> 
> BugLink: https://bugs.launchpad.net/bugs/333386
> 
> Adding additional checks to make sure acpi video operates on existing
> hardware caused a regression with laptops that have broken ACPI
> definitions. These only define one of the two required methods to
> indicate a video device. A generic patch for this has been submitted
> upstream but for a stable release update this has to be made optional,
> so users notmally will not get affected.
> 
> This patch adds a boot option ("acpi_video_strict_detect") as well as
> a dmi match, to use the less restrictive check (the setting is 1 by
> default).
> 
> Signed-off-by: Stefan Bader <stefan.bader at canonical.com>
> ---
>  drivers/acpi/video.c        |    4 +++
>  drivers/acpi/video_detect.c |   61 ++++++++++++++++++++++++++++++++++++++++--
>  include/linux/acpi.h        |    1 +
>  3 files changed, 63 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index 2283ccb..757bf22 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -886,6 +886,10 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
>  		video->flags.multihead = 1;
>  		status = 0;
>  	}
> +	if (!acpi_video_strict_detection() && video->cap._DOD) {
> +		video->flags.multihead = 1;
> +		status = 0;
> +	}
>  
>  	/* Does this device support retrieving a video ROM? */
>  	if (video->cap._ROM) {
> diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
> index f022eb6..c7f14f2 100644
> --- a/drivers/acpi/video_detect.c
> +++ b/drivers/acpi/video_detect.c
> @@ -42,6 +42,7 @@ ACPI_MODULE_NAME("video");
>  
>  static long acpi_video_support;
>  static bool acpi_video_caps_checked;
> +static int  acpi_video_strict_detect;
>  
>  static acpi_status
>  acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
> @@ -73,14 +74,24 @@ long acpi_is_video_device(struct acpi_device *device)
>  {
>  	acpi_handle h_dummy;
>  	long video_caps = 0;
> +	int vss;
>  
>  	if (!device)
>  		return 0;
>  
>  	/* Does this device able to support video switching ? */
> -	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) &&
> -	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy)))
> -		video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
> +	vss = 0;
> +	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)))
> +		vss |= 1;
> +	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy)))
> +		vss |= 2;
> +	if (acpi_video_strict_detection()) {
> +		if (vss == 3)
> +			video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
> +	} else {
> +		if (vss)
> +			video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
> +	}
>  
>  	/* Does this device able to retrieve a video ROM ? */
>  	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy)))
> @@ -126,6 +137,17 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
>  	return AE_OK;
>  }
>  
> +static struct dmi_system_id acpi_video_strict_detection_table[] = {
> +	{
> +		.ident = "Acer Aspire 6920",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 6920"),
> +		},
> +	},
> +	{ },
> +};
> +
>  /*
>   * Returns the video capabilities of a specific ACPI graphics device
>   *
> @@ -160,6 +182,11 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
>  		 *		ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
>  		 *}
>  		 */
> +		if (dmi_check_system(acpi_video_strict_detection_table)) {
> +			printk(KERN_INFO PREFIX
> +				"Using less restrictive video detection\n");
> +			acpi_video_strict_detect = 0;
> +		}
>  	} else {
>  		status = acpi_bus_get_device(graphics_handle, &tmp_dev);
>  		if (ACPI_FAILURE(status)) {
> @@ -230,6 +257,17 @@ int acpi_video_display_switch_support(void)
>  EXPORT_SYMBOL(acpi_video_display_switch_support);
>  
>  /*
> + * Returns the setting for the strict detection mode. If set to 0, a device
> + * will be accepted as a video device if providing either _DOS or _DOD.
> + * Otherwise it has to provide both. This works around some broken BIOSes.
> + */
> +int acpi_video_strict_detection(void)
> +{
> +	return acpi_video_strict_detect;
> +}
> +EXPORT_SYMBOL(acpi_video_strict_detection);
> +
> +/*
>   * Use acpi_display_output=vendor/video or acpi_backlight=vendor/video
>   * To force that backlight or display output switching is processed by vendor
>   * specific acpi drivers or video.ko driver.
> @@ -265,3 +303,20 @@ int __init acpi_display_output(char *str)
>  	return 1;
>  }
>  __setup("acpi_display_output=", acpi_display_output);
> +
> +int __init _acpi_video_strict_detect(char *str)
> +{
> +	if (str == NULL || *str == '\0')
> +		return 1;
> +	else {
> +		if (*str == '0') {
> +			printk(KERN_INFO PREFIX
> +				"Using less restrictive video detection on "
> +				"user request\n");
> +			acpi_video_strict_detect = 0;
> +		}
> +	}
> +	return 1;
> +}
> +__setup("acpi_video_strict_detect=", _acpi_video_strict_detect);
> +
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index fba8051..0945f7f 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -209,6 +209,7 @@ extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle);
>  extern long acpi_is_video_device(struct acpi_device *device);
>  extern int acpi_video_backlight_support(void);
>  extern int acpi_video_display_switch_support(void);
> +extern int acpi_video_strict_detection(void);
>  
>  #else
>  
> -- 
> 1.5.4.3

ACK. Patch will affect only matches in the dmi table or explicit cmdline
option of acpi_video_strict_detect=0.



-- 
----------------------------------------------------------------------
Amit Kucheria, Kernel Engineer || amit.kucheria at canonical.com
----------------------------------------------------------------------



More information about the kernel-team mailing list