diff options
Diffstat (limited to 'drivers/platform/x86/sony-laptop.c')
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index d3fd52036fd6..13ec195f0ca6 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -127,18 +127,17 @@ MODULE_PARM_DESC(minor, | |||
127 | "default is -1 (automatic)"); | 127 | "default is -1 (automatic)"); |
128 | #endif | 128 | #endif |
129 | 129 | ||
130 | static int kbd_backlight = 1; | 130 | static int kbd_backlight = -1; |
131 | module_param(kbd_backlight, int, 0444); | 131 | module_param(kbd_backlight, int, 0444); |
132 | MODULE_PARM_DESC(kbd_backlight, | 132 | MODULE_PARM_DESC(kbd_backlight, |
133 | "set this to 0 to disable keyboard backlight, " | 133 | "set this to 0 to disable keyboard backlight, " |
134 | "1 to enable it (default: 0)"); | 134 | "1 to enable it (default: no change from current value)"); |
135 | 135 | ||
136 | static int kbd_backlight_timeout; /* = 0 */ | 136 | static int kbd_backlight_timeout = -1; |
137 | module_param(kbd_backlight_timeout, int, 0444); | 137 | module_param(kbd_backlight_timeout, int, 0444); |
138 | MODULE_PARM_DESC(kbd_backlight_timeout, | 138 | MODULE_PARM_DESC(kbd_backlight_timeout, |
139 | "set this to 0 to set the default 10 seconds timeout, " | 139 | "meaningful values vary from 0 to 3 and their meaning depends " |
140 | "1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout " | 140 | "on the model (default: no change from current value)"); |
141 | "(default: 0)"); | ||
142 | 141 | ||
143 | #ifdef CONFIG_PM_SLEEP | 142 | #ifdef CONFIG_PM_SLEEP |
144 | static void sony_nc_kbd_backlight_resume(void); | 143 | static void sony_nc_kbd_backlight_resume(void); |
@@ -1844,6 +1843,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd, | |||
1844 | if (!kbdbl_ctl) | 1843 | if (!kbdbl_ctl) |
1845 | return -ENOMEM; | 1844 | return -ENOMEM; |
1846 | 1845 | ||
1846 | kbdbl_ctl->mode = kbd_backlight; | ||
1847 | kbdbl_ctl->timeout = kbd_backlight_timeout; | ||
1847 | kbdbl_ctl->handle = handle; | 1848 | kbdbl_ctl->handle = handle; |
1848 | if (handle == 0x0137) | 1849 | if (handle == 0x0137) |
1849 | kbdbl_ctl->base = 0x0C00; | 1850 | kbdbl_ctl->base = 0x0C00; |
@@ -1870,8 +1871,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd, | |||
1870 | if (ret) | 1871 | if (ret) |
1871 | goto outmode; | 1872 | goto outmode; |
1872 | 1873 | ||
1873 | __sony_nc_kbd_backlight_mode_set(kbd_backlight); | 1874 | __sony_nc_kbd_backlight_mode_set(kbdbl_ctl->mode); |
1874 | __sony_nc_kbd_backlight_timeout_set(kbd_backlight_timeout); | 1875 | __sony_nc_kbd_backlight_timeout_set(kbdbl_ctl->timeout); |
1875 | 1876 | ||
1876 | return 0; | 1877 | return 0; |
1877 | 1878 | ||
@@ -1886,17 +1887,8 @@ outkzalloc: | |||
1886 | static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd) | 1887 | static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd) |
1887 | { | 1888 | { |
1888 | if (kbdbl_ctl) { | 1889 | if (kbdbl_ctl) { |
1889 | int result; | ||
1890 | |||
1891 | device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr); | 1890 | device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr); |
1892 | device_remove_file(&pd->dev, &kbdbl_ctl->timeout_attr); | 1891 | device_remove_file(&pd->dev, &kbdbl_ctl->timeout_attr); |
1893 | |||
1894 | /* restore the default hw behaviour */ | ||
1895 | sony_call_snc_handle(kbdbl_ctl->handle, | ||
1896 | kbdbl_ctl->base | 0x10000, &result); | ||
1897 | sony_call_snc_handle(kbdbl_ctl->handle, | ||
1898 | kbdbl_ctl->base + 0x200, &result); | ||
1899 | |||
1900 | kfree(kbdbl_ctl); | 1892 | kfree(kbdbl_ctl); |
1901 | kbdbl_ctl = NULL; | 1893 | kbdbl_ctl = NULL; |
1902 | } | 1894 | } |