asus-wmi: don't update power and brightness when using scalar
authorCorentin Chary <corentin.chary@gmail.com>
Tue, 20 Mar 2012 08:53:14 +0000 (09:53 +0100)
committerMatthew Garrett <mjg@redhat.com>
Mon, 26 Mar 2012 19:05:51 +0000 (15:05 -0400)
But we can still do it on other boards, as this might happen
if the backlight driver change when update_bl is called.

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
drivers/platform/x86/asus-wmi.c

index ff9cfd83b09f0d0800154d01450bdddf900c7353..7d1684bdbf63ab0f7c151b7da87d8d7883d462e2 100644 (file)
@@ -1152,15 +1152,21 @@ static int update_bl_status(struct backlight_device *bd)
                                            ctrl_param, NULL);
                if (asus->driver->quirks->store_backlight_power)
                        asus->driver->panel_power = bd->props.power;
-       } else {
-               if (asus->driver->quirks->scalar_panel_brightness)
-                       ctrl_param = get_scalar_command(bd);
-               else
-                       ctrl_param = bd->props.brightness;
 
-               err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
-                                           ctrl_param, NULL);
+               /* When using scalar brightness, updating the brightness
+                * will mess with the backlight power */
+               if (asus->driver->quirks->scalar_panel_brightness)
+                       return err;
        }
+
+       if (asus->driver->quirks->scalar_panel_brightness)
+               ctrl_param = get_scalar_command(bd);
+       else
+               ctrl_param = bd->props.brightness;
+
+       err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
+                                   ctrl_param, NULL);
+
        return err;
 }