diff options
author | Mattia Dongili <malattia@linux.it> | 2013-10-29 19:07:36 -0400 |
---|---|---|
committer | Matthew Garrett <matthew.garrett@nebula.com> | 2013-11-20 18:50:49 -0500 |
commit | 1d885f4257165563342acc6bc473b67d9b36a742 (patch) | |
tree | b8f837819a0fafdad9fe3bdaea052ef5798f5008 | |
parent | 2bd4ac139259bb605fc0325a7dda33e2fbb67ae3 (diff) |
sony-laptop: warn on multiple KBD backlight handles
Some BIOS versions/Vaio models apparently ship with two nearly identical
functions to handle backlight related controls.
The only difference seems to be:
If (LEqual (BUF1, 0x40))
{
Store (0x40, P80H)
Store (BUF2, Local0)
- And (Local0, One, Local0)
+ And (Local0, 0x03, Local0)
Store (Local0, ^^H_EC.KLPC)
}
Avoid erroring out on initialization and messing things up on cleanup
for now since we never call into these methods with anything different
than 1 or 0.
This issue was found on a Sony VPCSE1V9E/BIOS R2087H4.
Cc: Marco Krüger <krgsch@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 47caab0ea7a1..03f02cc476e5 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -145,7 +145,8 @@ static void sony_nc_thermal_resume(void); | |||
145 | #endif | 145 | #endif |
146 | static int sony_nc_kbd_backlight_setup(struct platform_device *pd, | 146 | static int sony_nc_kbd_backlight_setup(struct platform_device *pd, |
147 | unsigned int handle); | 147 | unsigned int handle); |
148 | static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd); | 148 | static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd, |
149 | unsigned int handle); | ||
149 | 150 | ||
150 | static int sony_nc_battery_care_setup(struct platform_device *pd, | 151 | static int sony_nc_battery_care_setup(struct platform_device *pd, |
151 | unsigned int handle); | 152 | unsigned int handle); |
@@ -1444,7 +1445,7 @@ static void sony_nc_function_cleanup(struct platform_device *pd) | |||
1444 | case 0x014b: | 1445 | case 0x014b: |
1445 | case 0x014c: | 1446 | case 0x014c: |
1446 | case 0x0163: | 1447 | case 0x0163: |
1447 | sony_nc_kbd_backlight_cleanup(pd); | 1448 | sony_nc_kbd_backlight_cleanup(pd, handle); |
1448 | break; | 1449 | break; |
1449 | default: | 1450 | default: |
1450 | continue; | 1451 | continue; |
@@ -1822,6 +1823,12 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd, | |||
1822 | int result; | 1823 | int result; |
1823 | int ret = 0; | 1824 | int ret = 0; |
1824 | 1825 | ||
1826 | if (kbdbl_ctl) { | ||
1827 | pr_warn("handle 0x%.4x: keyboard backlight setup already done for 0x%.4x\n", | ||
1828 | handle, kbdbl_ctl->handle); | ||
1829 | return -EBUSY; | ||
1830 | } | ||
1831 | |||
1825 | /* verify the kbd backlight presence, these handles are not used for | 1832 | /* verify the kbd backlight presence, these handles are not used for |
1826 | * keyboard backlight only | 1833 | * keyboard backlight only |
1827 | */ | 1834 | */ |
@@ -1881,9 +1888,10 @@ outkzalloc: | |||
1881 | return ret; | 1888 | return ret; |
1882 | } | 1889 | } |
1883 | 1890 | ||
1884 | static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd) | 1891 | static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd, |
1892 | unsigned int handle) | ||
1885 | { | 1893 | { |
1886 | if (kbdbl_ctl) { | 1894 | if (kbdbl_ctl && handle == kbdbl_ctl->handle) { |
1887 | device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr); | 1895 | device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr); |
1888 | device_remove_file(&pd->dev, &kbdbl_ctl->timeout_attr); | 1896 | device_remove_file(&pd->dev, &kbdbl_ctl->timeout_attr); |
1889 | kfree(kbdbl_ctl); | 1897 | kfree(kbdbl_ctl); |