Patchwork [1/1] UBUNTU: SAUCE (no-up) Provide a param for allowing the BIOS to handle changing the brightness on AC/battery status changes.

login
register
mail settings
Submitter Brad Figg
Date March 29, 2012, 3:53 p.m.
Message ID <1333036391-8876-2-git-send-email-brad.figg@canonical.com>
Download mbox | patch
Permalink /patch/149426/
State New
Headers show

Comments

Brad Figg - March 29, 2012, 3:53 p.m.
BugLink: http://bugs.launchpad.net/bugs/949311

We currently carry a SAUCE patch which lets the OS handle the brightness
levels automatically when connecting/disconnecting AC. There are some
laptops (MSI Wind) for which this doesn't work. Provide a driver param
which allows this behaviour to be overriden.

Signed-off-by: Brad Figg <brad.figg@canonical.com>
---
 drivers/acpi/video.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
Colin King - March 29, 2012, 5:20 p.m.
On 29/03/12 16:53, Brad Figg wrote:
> BugLink: http://bugs.launchpad.net/bugs/949311
>
> We currently carry a SAUCE patch which lets the OS handle the brightness
> levels automatically when connecting/disconnecting AC. There are some
> laptops (MSI Wind) for which this doesn't work. Provide a driver param
> which allows this behaviour to be overriden.
>
> Signed-off-by: Brad Figg<brad.figg@canonical.com>
> ---
>   drivers/acpi/video.c |   10 +++++++++-
>   1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index eae12b6..42b226e0 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -73,6 +73,14 @@ static int brightness_switch_enabled = 1;
>   module_param(brightness_switch_enabled, bool, 0644);
>
>   /*
> + *  The Default is to let the OS handle brightness autoswitching due to
> + *  AC/battery status changes. On some laptops (MSI Wind) this doesn't
> + *  work so we need a workaround.
> + */
> +static int brightness_autoswitch_via_bios = 0;
> +module_param(brightness_autoswitch_via_bios, bool, 0644);
> +
> +/*
>    * By default, we don't allow duplicate ACPI video bus devices
>    * under the same VGA controller
>    */
> @@ -1421,7 +1429,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
>
>   static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
>   {
> -	return acpi_video_bus_DOS(video, 0, 1);
> +	return acpi_video_bus_DOS(video, 0, !brightness_autoswitch_via_bios);
>   }
>
>   static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)

It looks like a useful kludge around some broken firmware to get it 
working, so yep, it does the necessary evil deed.

Acked-by: Colin Ian King <colin.king@canonical.com>

Patch

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index eae12b6..42b226e0 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -73,6 +73,14 @@  static int brightness_switch_enabled = 1;
 module_param(brightness_switch_enabled, bool, 0644);
 
 /*
+ *  The Default is to let the OS handle brightness autoswitching due to
+ *  AC/battery status changes. On some laptops (MSI Wind) this doesn't
+ *  work so we need a workaround.
+ */
+static int brightness_autoswitch_via_bios = 0;
+module_param(brightness_autoswitch_via_bios, bool, 0644);
+
+/*
  * By default, we don't allow duplicate ACPI video bus devices
  * under the same VGA controller
  */
@@ -1421,7 +1429,7 @@  static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
 
 static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
 {
-	return acpi_video_bus_DOS(video, 0, 1);
+	return acpi_video_bus_DOS(video, 0, !brightness_autoswitch_via_bios);
 }
 
 static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)