Skip to contentSkip to conversation

sony-laptop fixes for 2.6.30-rc2

PATCH In review Mattia Dongili 3 participants 9 messages Apr 12, 2009 – Apr 18, 2009

Subsystems (3)
lore
Share & tools
lore

Mattia Dongili

author maintainer
#0 lore raw

cover sony-laptop fixes for 2.6.30-rc2

Hi Len,

a few fixes for the new code handling the SNC devices, a fix for a small bug in the resume path and a patch for ec.c that allows sony-laptop to restore the brightness level on resume.

Almer S. Tigelaar (4):
sony-laptop: Duplicate SNC 127 Event Fix
sony-laptop: SNC 127 Initialization Fix
sony-laptop: SNC input event 38 fix
ec.c: Fix ACPI EC resume non-query interrupt message

Mattia Dongili (2):
sony-laptop: fix bogus error message display on resume
sony-laptop: always try to unblock rfkill on load

 drivers/acpi/ec.c                  |    1 +
 drivers/platform/x86/sony-laptop.c |   27 ++++++++++++++++++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)
Signature · 2 lines
mattia
:wq
author maintainer
#1 lore raw

PATCH 1/6 sony-laptop: Duplicate SNC 127 Event Fix

From: Almer S. Tigelaar <[email protected]>

Fixes a duplicate mapping in the SNC sony_127_events structure.

---
 drivers/platform/x86/sony-laptop.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/platform/x86/sony-laptop.c +0 -1
index a90ec5c..a537467 100644
@@ -905,7 +905,6 @@ static struct sony_nc_event sony_127_events[] = {
 	{ 0x05, SONYPI_EVENT_ANYBUTTON_RELEASED },
 	{ 0x86, SONYPI_EVENT_PKEY_P5 },
 	{ 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
-	{ 0x06, SONYPI_EVENT_ANYBUTTON_RELEASED },
 	{ 0x87, SONYPI_EVENT_SETTINGKEY_PRESSED },
 	{ 0x07, SONYPI_EVENT_ANYBUTTON_RELEASED },
 	{ 0, 0 },
Signature · 1 line
1.6.2.2
author maintainer
#2 lore raw

PATCH 2/6 sony-laptop: SNC 127 Initialization Fix

From: Almer S. Tigelaar <[email protected]>

Fixes additional special key initialization for SNC 127 key events. Verified / tested on a Sony VAIO SR model.

---
 drivers/platform/x86/sony-laptop.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/platform/x86/sony-laptop.c +1 -0
index a537467..7b1da3f 100644
@@ -1003,6 +1003,7 @@ static int sony_nc_function_setup(struct acpi_device *device)
 	sony_call_snc_handle(0x0100, 0, &result);
 	sony_call_snc_handle(0x0101, 0, &result);
 	sony_call_snc_handle(0x0102, 0x100, &result);
+	sony_call_snc_handle(0x0127, 0, &result);
 
 	return 0;
 }
Signature · 1 line
1.6.2.2
author maintainer
#3 lore raw

PATCH 3/6 sony-laptop: SNC input event 38 fix

From: Almer S. Tigelaar <[email protected]>

Fixes the "unknown input event 38" messages. ANYBUTTON_RELEASED is now treated the same way as FN_KEY_RELEASED.

---
 drivers/platform/x86/sony-laptop.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/platform/x86/sony-laptop.c +2 -1
index 7b1da3f..ddbd86b 100644
@@ -317,7 +317,8 @@ static void sony_laptop_report_input_event(u8 event)
 	struct input_dev *key_dev = sony_laptop_input.key_dev;
 	struct sony_laptop_keypress kp = { NULL };
 
-	if (event == SONYPI_EVENT_FNKEY_RELEASED) {
+	if (event == SONYPI_EVENT_FNKEY_RELEASED ||
+			event == SONYPI_EVENT_ANYBUTTON_RELEASED) {
 		/* Nothing, not all VAIOs generate this event */
 		return;
 	}
Signature · 1 line
1.6.2.2
author maintainer
#4 lore raw

PATCH 4/6 ec.c: Fix ACPI EC resume non-query interrupt message

From: Almer S. Tigelaar <[email protected]>

When resuming from standby (on a laptop) I see the following message in my kernel.log:
"ACPI: EC: non-query interrupt received, switching to interrupt mode" This apparently prevented sony-laptop to properly restore the brightness level on resume.

The cause: In drivers/acpi/ec.c the acpi_ec_suspend function clears the GPE mode bit, but this is not restored in acpi_ec_resume (the function below it). The patch below fixes this by properly restoring the GPE_MODE bit. Tested and confirmed to work.

---
 drivers/acpi/ec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/acpi/ec.c +1 -0
index 04e9044..391f331 100644
@@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device)
 	struct acpi_ec *ec = acpi_driver_data(device);
 	/* Enable use of GPE back */
 	clear_bit(EC_FLAGS_NO_GPE, &ec->flags);
+	set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
 	acpi_enable_gpe(NULL, ec->gpe);
 	return 0;
 }
Signature · 1 line
1.6.2.2
author maintainer
#5 lore raw

PATCH 5/6 sony-laptop: fix bogus error message display on resume

sony_backlight_update_status returns 0 on success -1 on failure (i.e.: the return value from acpi_callsetfunc. The return value in the resume path was broken and thus always displaying a bogus warning about not being able to restore the brightness level.

---
 drivers/platform/x86/sony-laptop.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/sony-laptop.c +1 -1
index ddbd86b..419873a 100644
@@ -1041,7 +1041,7 @@ static int sony_nc_resume(struct acpi_device *device)
 
 	/* set the last requested brightness level */
 	if (sony_backlight_device &&
-			!sony_backlight_update_status(sony_backlight_device))
+			sony_backlight_update_status(sony_backlight_device) < 0)
 		printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n");
 
 	return 0;
Signature · 1 line
1.6.2.2
author maintainer
#6 lore raw

PATCH 6/6 sony-laptop: always try to unblock rfkill on load

This fixes an inconsistent behaviour when loading the driver with the switch on or off. In the former case you would also need to soft unblock the switch via the sysfs file entries to really disable rfkill, in the latter you wouldn't.

Cc Matthias Welwarsky <[email protected]>
Cc Matthew Garrett <[email protected]>
---
 drivers/platform/x86/sony-laptop.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
drivers/platform/x86/sony-laptop.c +16 -4
index 419873a..9c0ce73 100644
@@ -1103,8 +1103,11 @@ static int sony_nc_setup_wifi_rfkill(struct acpi_device *device)
 	err = rfkill_register(sony_wifi_rfkill);
 	if (err)
 		rfkill_free(sony_wifi_rfkill);
-	else
+	else {
 		sony_rfkill_devices[SONY_WIFI] = sony_wifi_rfkill;
+		sony_nc_rfkill_set(sony_wifi_rfkill->data,
+				RFKILL_STATE_UNBLOCKED);
+	}
 	return err;
 }
 
@@ -1125,8 +1128,11 @@ static int sony_nc_setup_bluetooth_rfkill(struct acpi_device *device)
 	err = rfkill_register(sony_bluetooth_rfkill);
 	if (err)
 		rfkill_free(sony_bluetooth_rfkill);
-	else
+	else {
 		sony_rfkill_devices[SONY_BLUETOOTH] = sony_bluetooth_rfkill;
+		sony_nc_rfkill_set(sony_bluetooth_rfkill->data,
+				RFKILL_STATE_UNBLOCKED);
+	}
 	return err;
 }
 
@@ -1146,8 +1152,11 @@ static int sony_nc_setup_wwan_rfkill(struct acpi_device *device)
 	err = rfkill_register(sony_wwan_rfkill);
 	if (err)
 		rfkill_free(sony_wwan_rfkill);
-	else
+	else {
 		sony_rfkill_devices[SONY_WWAN] = sony_wwan_rfkill;
+		sony_nc_rfkill_set(sony_wwan_rfkill->data,
+				RFKILL_STATE_UNBLOCKED);
+	}
 	return err;
 }
 
@@ -1167,8 +1176,11 @@ static int sony_nc_setup_wimax_rfkill(struct acpi_device *device)
 	err = rfkill_register(sony_wimax_rfkill);
 	if (err)
 		rfkill_free(sony_wimax_rfkill);
-	else
+	else {
 		sony_rfkill_devices[SONY_WIMAX] = sony_wimax_rfkill;
+		sony_nc_rfkill_set(sony_wimax_rfkill->data,
+				RFKILL_STATE_UNBLOCKED);
+	}
 	return err;
 }
 
Signature · 1 line
1.6.2.2
Acked-by on v1 6/6
#7 lore raw

Re: [PATCH 6/6] sony-laptop: always try to unblock rfkill on load

Quoted 8 lines · Mattia Dongili

This fixes an inconsistent behaviour when loading the driver with the switch on or off. In the former case you would also need to soft unblock the switch via the sysfs file entries to really disable rfkill, in the latter you wouldn't.

Cc Matthias Welwarsky <[email protected]>
Cc Matthew Garrett <[email protected]>
Signature · 1 line
Matthew Garrett | [email protected]
reviewer
#8 lore raw
In reply to Mattia Dongili
Quoted 12 lines · Mattia Dongili

Hi Len,

a few fixes for the new code handling the SNC devices, a fix for a small bug in the resume path and a patch for ec.c that allows sony-laptop to restore the brightness level on resume.

Almer S. Tigelaar (4):
sony-laptop: Duplicate SNC 127 Event Fix
sony-laptop: SNC 127 Initialization Fix
sony-laptop: SNC input event 38 fix
ec.c: Fix ACPI EC resume non-query interrupt message

Quoted 7 lines

Mattia Dongili (2):
sony-laptop: fix bogus error message display on resume
sony-laptop: always try to unblock rfkill on load

 drivers/acpi/ec.c                  |    1 +
 drivers/platform/x86/sony-laptop.c |   27 ++++++++++++++++++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)

applied to acpi-test

thanks,
Len Brown, Intel Open Source Technology Center