Commit 0380d471 authored by Javier Achirica's avatar Javier Achirica Committed by Matthew Garrett

sony-laptop: adjust keyboard backlight values for off/auto/on

Keyboard backlight can be always off, use some automatic trigger
(activity and light sensor), always on.
The behaviour of the driver changes whereby previously when passed 1 it
tried to turn on backlight immediately now it does nothing. This is
however a bug fix since (a) it makes little sense to turn on the
backlight when control is automatic and (b) this behaviour is
consistent with what the windows driver does.
Signed-off-by: default avatarJavier Achirica <jachirica@gmail.com>
Signed-off-by: default avatarMattia Dongili <malattia@linux.it>
Signed-off-by: default avatarMatthew Garrett <matthew.garrett@nebula.com>
parent 168de1ad
...@@ -129,7 +129,8 @@ static int kbd_backlight = -1; ...@@ -129,7 +129,8 @@ 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: no change from current value)"); "1 to enable it with automatic control and 2 to have it always "
"on (default: no change from current value)");
static int kbd_backlight_timeout = -1; static int kbd_backlight_timeout = -1;
module_param(kbd_backlight_timeout, int, 0444); module_param(kbd_backlight_timeout, int, 0444);
...@@ -1772,7 +1773,7 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value) ...@@ -1772,7 +1773,7 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value)
{ {
int result; int result;
if (value > 1) if (value > 2)
return -EINVAL; return -EINVAL;
if (sony_call_snc_handle(kbdbl_ctl->handle, if (sony_call_snc_handle(kbdbl_ctl->handle,
...@@ -1780,8 +1781,10 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value) ...@@ -1780,8 +1781,10 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value)
return -EIO; return -EIO;
/* Try to turn the light on/off immediately */ /* Try to turn the light on/off immediately */
if (value != 1)
sony_call_snc_handle(kbdbl_ctl->handle, sony_call_snc_handle(kbdbl_ctl->handle,
(value << 0x10) | (kbdbl_ctl->base + 0x100), &result); (value << 0x0f) | (kbdbl_ctl->base + 0x100),
&result);
kbdbl_ctl->mode = value; kbdbl_ctl->mode = value;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment