2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 19:23:57 +08:00

sony-laptop: don't change keyboard backlight settings

Do not touch keyboard backlight unless explicitly passed a module
parameter.  In this way we won't make wrong assumptions about what are
good default values since they actually are different from model to
model.

The only side effect is that we won't know what is the current value
until set via the sysfs attributes.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Mattia Dongili 2013-08-18 19:33:19 +09:00 committed by Linus Torvalds
parent 69c88dc7d9
commit 294d31e822

View File

@ -127,18 +127,17 @@ MODULE_PARM_DESC(minor,
"default is -1 (automatic)"); "default is -1 (automatic)");
#endif #endif
static int kbd_backlight = 1; static int kbd_backlight = -1;
module_param(kbd_backlight, int, 0444); module_param(kbd_backlight, int, 0444);
MODULE_PARM_DESC(kbd_backlight, MODULE_PARM_DESC(kbd_backlight,
"set this to 0 to disable keyboard backlight, " "set this to 0 to disable keyboard backlight, "
"1 to enable it (default: 0)"); "1 to enable it (default: no change from current value)");
static int kbd_backlight_timeout; /* = 0 */ static int kbd_backlight_timeout = -1;
module_param(kbd_backlight_timeout, int, 0444); module_param(kbd_backlight_timeout, int, 0444);
MODULE_PARM_DESC(kbd_backlight_timeout, MODULE_PARM_DESC(kbd_backlight_timeout,
"set this to 0 to set the default 10 seconds timeout, " "meaningful values vary from 0 to 3 and their meaning depends "
"1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout " "on the model (default: no change from current value)");
"(default: 0)");
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static void sony_nc_kbd_backlight_resume(void); static void sony_nc_kbd_backlight_resume(void);
@ -1844,6 +1843,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
if (!kbdbl_ctl) if (!kbdbl_ctl)
return -ENOMEM; return -ENOMEM;
kbdbl_ctl->mode = kbd_backlight;
kbdbl_ctl->timeout = kbd_backlight_timeout;
kbdbl_ctl->handle = handle; kbdbl_ctl->handle = handle;
if (handle == 0x0137) if (handle == 0x0137)
kbdbl_ctl->base = 0x0C00; kbdbl_ctl->base = 0x0C00;
@ -1870,8 +1871,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
if (ret) if (ret)
goto outmode; goto outmode;
__sony_nc_kbd_backlight_mode_set(kbd_backlight); __sony_nc_kbd_backlight_mode_set(kbdbl_ctl->mode);
__sony_nc_kbd_backlight_timeout_set(kbd_backlight_timeout); __sony_nc_kbd_backlight_timeout_set(kbdbl_ctl->timeout);
return 0; return 0;
@ -1886,17 +1887,8 @@ outkzalloc:
static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd) static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd)
{ {
if (kbdbl_ctl) { if (kbdbl_ctl) {
int result;
device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr); device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr);
device_remove_file(&pd->dev, &kbdbl_ctl->timeout_attr); device_remove_file(&pd->dev, &kbdbl_ctl->timeout_attr);
/* restore the default hw behaviour */
sony_call_snc_handle(kbdbl_ctl->handle,
kbdbl_ctl->base | 0x10000, &result);
sony_call_snc_handle(kbdbl_ctl->handle,
kbdbl_ctl->base + 0x200, &result);
kfree(kbdbl_ctl); kfree(kbdbl_ctl);
kbdbl_ctl = NULL; kbdbl_ctl = NULL;
} }