diff options
author | Corentin Chary <corentincj@iksaif.net> | 2010-01-25 16:53:21 -0500 |
---|---|---|
committer | Corentin Chary <corentincj@iksaif.net> | 2010-02-28 13:35:12 -0500 |
commit | a539df5e1548751e352990c518e88af50e6111b8 (patch) | |
tree | 8615ab544dfcce6b4744624addc45c219109ff74 /drivers/platform | |
parent | 7f607d71065b6b089f59b78b54144c3fb93ad629 (diff) |
asus-laptop: add backlight changes notifications
We don't want to send KEY_BRIGHTNESSDOWN or KEY_BRIGHTNESSUP
because it would be a lie to tell userspace that we want
to change the brightness while it's actually done by the
firmware.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 4f3c4674498b..516add3c340e 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -93,8 +93,10 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " | |||
93 | /* | 93 | /* |
94 | * Some events we use, same for all Asus | 94 | * Some events we use, same for all Asus |
95 | */ | 95 | */ |
96 | #define ATKD_BR_UP 0x10 | 96 | #define ATKD_BR_UP 0x10 // (event & ~ATKD_BR_UP) = brightness level |
97 | #define ATKD_BR_DOWN 0x20 | 97 | #define ATKD_BR_DOWN 0x20 // (event & ~ATKD_BR_DOWN) = britghness level |
98 | #define ATKD_BR_MIN ATKD_BR_UP | ||
99 | #define ATKD_BR_MAX (ATKD_BR_DOWN | 0xF) // 0x2f | ||
98 | #define ATKD_LCD_ON 0x33 | 100 | #define ATKD_LCD_ON 0x33 |
99 | #define ATKD_LCD_OFF 0x34 | 101 | #define ATKD_LCD_OFF 0x34 |
100 | 102 | ||
@@ -245,11 +247,13 @@ struct asus_laptop { | |||
245 | }; | 247 | }; |
246 | 248 | ||
247 | static const struct key_entry asus_keymap[] = { | 249 | static const struct key_entry asus_keymap[] = { |
250 | /* Lenovo SL Specific keycodes */ | ||
248 | {KE_KEY, 0x02, { KEY_SCREENLOCK } }, | 251 | {KE_KEY, 0x02, { KEY_SCREENLOCK } }, |
249 | {KE_KEY, 0x05, { KEY_WLAN } }, | 252 | {KE_KEY, 0x05, { KEY_WLAN } }, |
250 | {KE_KEY, 0x08, { KEY_F13 } }, | 253 | {KE_KEY, 0x08, { KEY_F13 } }, |
251 | {KE_KEY, 0x17, { KEY_ZOOM } }, | 254 | {KE_KEY, 0x17, { KEY_ZOOM } }, |
252 | {KE_KEY, 0x1f, { KEY_BATTERY } }, | 255 | {KE_KEY, 0x1f, { KEY_BATTERY } }, |
256 | /* End of Lenovo SL Specific keycodes */ | ||
253 | {KE_KEY, 0x30, { KEY_VOLUMEUP } }, | 257 | {KE_KEY, 0x30, { KEY_VOLUMEUP } }, |
254 | {KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, | 258 | {KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, |
255 | {KE_KEY, 0x32, { KEY_MUTE } }, | 259 | {KE_KEY, 0x32, { KEY_MUTE } }, |
@@ -626,6 +630,16 @@ static struct backlight_ops asusbl_ops = { | |||
626 | .update_status = update_bl_status, | 630 | .update_status = update_bl_status, |
627 | }; | 631 | }; |
628 | 632 | ||
633 | static int asus_backlight_notify(struct asus_laptop *asus) | ||
634 | { | ||
635 | struct backlight_device *bd = asus->backlight_device; | ||
636 | int old = bd->props.brightness; | ||
637 | |||
638 | backlight_force_update(bd, BACKLIGHT_UPDATE_HOTKEY); | ||
639 | |||
640 | return old; | ||
641 | } | ||
642 | |||
629 | static int asus_backlight_init(struct asus_laptop *asus) | 643 | static int asus_backlight_init(struct asus_laptop *asus) |
630 | { | 644 | { |
631 | struct backlight_device *bd; | 645 | struct backlight_device *bd; |
@@ -656,6 +670,7 @@ static void asus_backlight_exit(struct asus_laptop *asus) | |||
656 | { | 670 | { |
657 | if (asus->backlight_device) | 671 | if (asus->backlight_device) |
658 | backlight_device_unregister(asus->backlight_device); | 672 | backlight_device_unregister(asus->backlight_device); |
673 | asus->backlight_device = NULL; | ||
659 | } | 674 | } |
660 | 675 | ||
661 | /* | 676 | /* |
@@ -1121,6 +1136,16 @@ static void asus_acpi_notify(struct acpi_device *device, u32 event) | |||
1121 | dev_name(&asus->device->dev), event, | 1136 | dev_name(&asus->device->dev), event, |
1122 | count); | 1137 | count); |
1123 | 1138 | ||
1139 | /* Brightness events are special */ | ||
1140 | if (event >= ATKD_BR_MIN && event <= ATKD_BR_MAX) { | ||
1141 | |||
1142 | /* Ignore them completely if the acpi video driver is used */ | ||
1143 | if (asus->backlight_device != NULL) { | ||
1144 | /* Update the backlight device. */ | ||
1145 | asus_backlight_notify(asus); | ||
1146 | } | ||
1147 | return ; | ||
1148 | } | ||
1124 | asus_input_notify(asus, event); | 1149 | asus_input_notify(asus, event); |
1125 | } | 1150 | } |
1126 | 1151 | ||