Skip to content

Commit 294d31e

Browse files
malattiatorvalds
authored andcommitted
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>
1 parent 69c88dc commit 294d31e

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

‎drivers/platform/x86/sony-laptop.c‎

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,17 @@ MODULE_PARM_DESC(minor,
127127
"default is -1 (automatic)");
128128
#endif
129129

130-
static int kbd_backlight = 1;
130+
static int kbd_backlight = -1;
131131
module_param(kbd_backlight, int, 0444);
132132
MODULE_PARM_DESC(kbd_backlight,
133133
"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)");
135135

136-
static int kbd_backlight_timeout; /* = 0 */
136+
static int kbd_backlight_timeout = -1;
137137
module_param(kbd_backlight_timeout, int, 0444);
138138
MODULE_PARM_DESC(kbd_backlight_timeout,
139-
"set this to 0 to set the default 10 seconds timeout, "
140-
"1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout "
141-
"(default: 0)");
139+
"meaningful values vary from 0 to 3 and their meaning depends "
140+
"on the model (default: no change from current value)");
142141

143142
#ifdef CONFIG_PM_SLEEP
144143
static void sony_nc_kbd_backlight_resume(void);
@@ -1844,6 +1843,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
18441843
if (!kbdbl_ctl)
18451844
return -ENOMEM;
18461845

1846+
kbdbl_ctl->mode = kbd_backlight;
1847+
kbdbl_ctl->timeout = kbd_backlight_timeout;
18471848
kbdbl_ctl->handle = handle;
18481849
if (handle == 0x0137)
18491850
kbdbl_ctl->base = 0x0C00;
@@ -1870,8 +1871,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
18701871
if (ret)
18711872
goto outmode;
18721873

1873-
__sony_nc_kbd_backlight_mode_set(kbd_backlight);
1874-
__sony_nc_kbd_backlight_timeout_set(kbd_backlight_timeout);
1874+
__sony_nc_kbd_backlight_mode_set(kbdbl_ctl->mode);
1875+
__sony_nc_kbd_backlight_timeout_set(kbdbl_ctl->timeout);
18751876

18761877
return 0;
18771878

@@ -1886,17 +1887,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
18861887
static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd)
18871888
{
18881889
if (kbdbl_ctl) {
1889-
int result;
1890-
18911890
device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr);
18921891
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-
19001892
kfree(kbdbl_ctl);
19011893
kbdbl_ctl = NULL;
19021894
}

0 commit comments

Comments
 (0)