All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattia Dongili <malattia@linux.it>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: platform-driver-x86@vger.kernel.org,
	Javier Achirica <jachirica@gmail.com>,
	Mattia Dongili <malattia@linux.it>
Subject: [PATCH 7/7] sony-laptop: adjust keyboard backlight values for off/auto/on
Date: Mon, 10 Feb 2014 08:07:34 +0900	[thread overview]
Message-ID: <1391987254-3103-8-git-send-email-malattia@linux.it> (raw)
In-Reply-To: <1391987254-3103-1-git-send-email-malattia@linux.it>

From: Javier Achirica <jachirica@gmail.com>

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: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
 drivers/platform/x86/sony-laptop.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index ba39a29..48e7e5b 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -129,7 +129,8 @@ static int kbd_backlight = -1;
 module_param(kbd_backlight, int, 0444);
 MODULE_PARM_DESC(kbd_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;
 module_param(kbd_backlight_timeout, int, 0444);
@@ -1772,7 +1773,7 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value)
 {
 	int result;
 
-	if (value > 1)
+	if (value > 2)
 		return -EINVAL;
 
 	if (sony_call_snc_handle(kbdbl_ctl->handle,
@@ -1780,8 +1781,10 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value)
 		return -EIO;
 
 	/* Try to turn the light on/off immediately */
-	sony_call_snc_handle(kbdbl_ctl->handle,
-			(value << 0x10) | (kbdbl_ctl->base + 0x100), &result);
+	if (value != 1)
+		sony_call_snc_handle(kbdbl_ctl->handle,
+				(value << 0x0f) | (kbdbl_ctl->base + 0x100),
+				&result);
 
 	kbdbl_ctl->mode = value;
 
-- 
1.9.rc1

      parent reply	other threads:[~2014-02-09 23:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-09 23:07 [PATCH 0/7] sony-laptop changes for 3.15 Mattia Dongili
2014-02-09 23:07 ` [PATCH 1/7] sony-laptop: add support as Fn+1 as a hot key Mattia Dongili
2014-02-09 23:07 ` [PATCH 2/7] sony-laptop: Add support for lid resume settings on Vaio Pro Mattia Dongili
2014-02-09 23:07 ` [PATCH 3/7] sony-laptop: add panel_id function Mattia Dongili
2014-02-09 23:07 ` [PATCH 4/7] sony-laptop: add usb charge function Mattia Dongili
2014-02-09 23:07 ` [PATCH 5/7] sony-laptop: add fan speed regulation function Mattia Dongili
2014-02-09 23:07 ` [PATCH 6/7] sony-laptop: add hibernate on low battery function Mattia Dongili
2014-02-09 23:07 ` Mattia Dongili [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391987254-3103-8-git-send-email-malattia@linux.it \
    --to=malattia@linux.it \
    --cc=jachirica@gmail.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.