X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH 0/2] sony-laptop for Donald Duck's car plate linux
@ 2013-11-12 23:17 Mattia Dongili
  2013-11-12 23:17 ` [PATCH 1/2] sony-laptop: warn on multiple KBD backlight handles Mattia Dongili
  2013-11-12 23:17 ` [PATCH 2/2] sony-laptop: fixe typos in sony_laptop_input_keycode_map Mattia Dongili
  0 siblings, 2 replies; 4+ messages in thread
From: Mattia Dongili @ 2013-11-12 23:17 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86

Hi Matthew,
This small set is for 3.13 and includes a patch that I sent previously for
inclusion.

[PATCH 1/2] sony-laptop: warn on multiple KBD backlight handles
[PATCH 2/2] sony-laptop: fixe typos in sony_laptop_input_keycode_map

Thanks,
-- 
Mattia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] sony-laptop: warn on multiple KBD backlight handles
  2013-11-12 23:17 [PATCH 0/2] sony-laptop for Donald Duck's car plate linux Mattia Dongili
@ 2013-11-12 23:17 ` Mattia Dongili
  2013-11-20 23:55   ` Matthew Garrett
  2013-11-12 23:17 ` [PATCH 2/2] sony-laptop: fixe typos in sony_laptop_input_keycode_map Mattia Dongili
  1 sibling, 1 reply; 4+ messages in thread
From: Mattia Dongili @ 2013-11-12 23:17 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mattia Dongili, Marco Krüger

Some BIOS versions/Vaio models apparently ship with two nearly identical
functions to handle backlight related controls.
The only difference seems to be:
        If (LEqual (BUF1, 0x40))
        {
            Store (0x40, P80H)
            Store (BUF2, Local0)
-           And (Local0, One, Local0)
+           And (Local0, 0x03, Local0)
            Store (Local0, ^^H_EC.KLPC)
        }

Avoid erroring out on initialization and messing things up on cleanup
for now since we never call into these methods with anything different
than 1 or 0.
This issue was found on a Sony VPCSE1V9E/BIOS R2087H4.

Cc: Marco Krüger <krgsch@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
 drivers/platform/x86/sony-laptop.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 13ec195..6b63329 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -145,7 +145,8 @@ static void sony_nc_thermal_resume(void);
 #endif
 static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
 		unsigned int handle);
-static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd);
+static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd,
+		unsigned int handle);
 
 static int sony_nc_battery_care_setup(struct platform_device *pd,
 		unsigned int handle);
@@ -1444,7 +1445,7 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
 		case 0x014b:
 		case 0x014c:
 		case 0x0163:
-			sony_nc_kbd_backlight_cleanup(pd);
+			sony_nc_kbd_backlight_cleanup(pd, handle);
 			break;
 		default:
 			continue;
@@ -1825,6 +1826,12 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
 	int result;
 	int ret = 0;
 
+	if (kbdbl_ctl) {
+		pr_warn("handle 0x%.4x: keyboard backlight setup already done for 0x%.4x\n",
+				handle, kbdbl_ctl->handle);
+		return -EBUSY;
+	}
+
 	/* verify the kbd backlight presence, these handles are not used for
 	 * keyboard backlight only
 	 */
@@ -1884,9 +1891,10 @@ outkzalloc:
 	return ret;
 }
 
-static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd)
+static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd,
+		unsigned int handle)
 {
-	if (kbdbl_ctl) {
+	if (kbdbl_ctl && handle == kbdbl_ctl->handle) {
 		device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr);
 		device_remove_file(&pd->dev, &kbdbl_ctl->timeout_attr);
 		kfree(kbdbl_ctl);
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] sony-laptop: fixe typos in sony_laptop_input_keycode_map
  2013-11-12 23:17 [PATCH 0/2] sony-laptop for Donald Duck's car plate linux Mattia Dongili
  2013-11-12 23:17 ` [PATCH 1/2] sony-laptop: warn on multiple KBD backlight handles Mattia Dongili
@ 2013-11-12 23:17 ` Mattia Dongili
  1 sibling, 0 replies; 4+ messages in thread
From: Mattia Dongili @ 2013-11-12 23:17 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Stephen Gildea, Mattia Dongili

From: Stephen Gildea <stepheng+linux@gildea.com>

Signed-off-by: Stephen Gildea <stepheng+linux@gildea.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
 drivers/platform/x86/sony-laptop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 6b63329..8d80f2c 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -305,8 +305,8 @@ static int sony_laptop_input_keycode_map[] = {
 	KEY_FN_F10,	/* 14 SONYPI_EVENT_FNKEY_F10 */
 	KEY_FN_F11,	/* 15 SONYPI_EVENT_FNKEY_F11 */
 	KEY_FN_F12,	/* 16 SONYPI_EVENT_FNKEY_F12 */
-	KEY_FN_F1,	/* 17 SONYPI_EVENT_FNKEY_1 */
-	KEY_FN_F2,	/* 18 SONYPI_EVENT_FNKEY_2 */
+	KEY_FN_1,	/* 17 SONYPI_EVENT_FNKEY_1 */
+	KEY_FN_2,	/* 18 SONYPI_EVENT_FNKEY_2 */
 	KEY_FN_D,	/* 19 SONYPI_EVENT_FNKEY_D */
 	KEY_FN_E,	/* 20 SONYPI_EVENT_FNKEY_E */
 	KEY_FN_F,	/* 21 SONYPI_EVENT_FNKEY_F */
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] sony-laptop: warn on multiple KBD backlight handles
  2013-11-12 23:17 ` [PATCH 1/2] sony-laptop: warn on multiple KBD backlight handles Mattia Dongili
@ 2013-11-20 23:55   ` Matthew Garrett
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Garrett @ 2013-11-20 23:55 UTC (permalink / raw)
  To: Mattia Dongili; +Cc: platform-driver-x86, Marco Krüger

Applied the pair, sorry about the delay.
-- 
Matthew Garrett <matthew.garrett@nebula.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-20 23:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 23:17 [PATCH 0/2] sony-laptop for Donald Duck's car plate linux Mattia Dongili
2013-11-12 23:17 ` [PATCH 1/2] sony-laptop: warn on multiple KBD backlight handles Mattia Dongili
2013-11-20 23:55   ` Matthew Garrett
2013-11-12 23:17 ` [PATCH 2/2] sony-laptop: fixe typos in sony_laptop_input_keycode_map Mattia Dongili

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox