X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH 0/2 resend] sony-laptop fixes for 3.7
@ 2012-11-09 22:55 Mattia Dongili
  2012-11-09 22:56 ` [PATCH 1/2] sony-laptop: fully enable SNY controlled modems Mattia Dongili
  2012-11-09 22:56 ` [PATCH 2/2] sony-laptop: fix SNC buffer calls when SN06 returns Integers Mattia Dongili
  0 siblings, 2 replies; 3+ messages in thread
From: Mattia Dongili @ 2012-11-09 22:55 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mattia Dongili

Hi Matthew,

Can you pick up these to patches? the second one is a regression introduced in
3.5, cc-ing stable to that.

Mattia Dongili (2):
  sony-laptop: fully enable SNY controlled modems
  sony-laptop: fix SNC buffer calls when SN06 returns Integers

 drivers/platform/x86/sony-laptop.c |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

-- 
1.7.10.4

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

* [PATCH 1/2] sony-laptop: fully enable SNY controlled modems
  2012-11-09 22:55 [PATCH 0/2 resend] sony-laptop fixes for 3.7 Mattia Dongili
@ 2012-11-09 22:56 ` Mattia Dongili
  2012-11-09 22:56 ` [PATCH 2/2] sony-laptop: fix SNC buffer calls when SN06 returns Integers Mattia Dongili
  1 sibling, 0 replies; 3+ messages in thread
From: Mattia Dongili @ 2012-11-09 22:56 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mattia Dongili

The call to handlers 0x124 and 0x135 (rfkill control) seems to take a
bitmask to control various states of the device. For our rfkill we need
a fully on/off. SVZ1311Z9R/X's LTE modem needs more bits up.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47751
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
 drivers/platform/x86/sony-laptop.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index daaddec..b0e1180 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1533,7 +1533,7 @@ static int sony_nc_rfkill_set(void *data, bool blocked)
 	int argument = sony_rfkill_address[(long) data] + 0x100;
 
 	if (!blocked)
-		argument |= 0x030000;
+		argument |= 0x070000;
 
 	return sony_call_snc_handle(sony_rfkill_handle, argument, &result);
 }
-- 
1.7.10.4

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

* [PATCH 2/2] sony-laptop: fix SNC buffer calls when SN06 returns Integers
  2012-11-09 22:55 [PATCH 0/2 resend] sony-laptop fixes for 3.7 Mattia Dongili
  2012-11-09 22:56 ` [PATCH 1/2] sony-laptop: fully enable SNY controlled modems Mattia Dongili
@ 2012-11-09 22:56 ` Mattia Dongili
  1 sibling, 0 replies; 3+ messages in thread
From: Mattia Dongili @ 2012-11-09 22:56 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Mattia Dongili, stable, Fabrizio Narni,
	mus.svz

SN06 in some cases returns an Integer instead of a buffer. While the
code handling the return value was trying to cope with the difference,
the memcpy call was not making any difference between the two types of
acpi_object union. This regression was introduced in 3.5.
While there also rework the return value logic to improve readability.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=48671
Cc: <stable@vger.kernel.org>
Cc: Fabrizio Narni <shibotto@gmail.com>
Cc: <mus.svz@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
 drivers/platform/x86/sony-laptop.c |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index b0e1180..505b0a7 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -786,28 +786,34 @@ static int sony_nc_int_call(acpi_handle handle, char *name, int *value,
 static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
 		void *buffer, size_t buflen)
 {
+	int ret = 0;
 	size_t len = len;
 	union acpi_object *object = __call_snc_method(handle, name, value);
 
 	if (!object)
 		return -EINVAL;
 
-	if (object->type == ACPI_TYPE_BUFFER)
+	if (object->type == ACPI_TYPE_BUFFER) {
 		len = MIN(buflen, object->buffer.length);
+		memcpy(buffer, object->buffer.pointer, len);
 
-	else if (object->type == ACPI_TYPE_INTEGER)
+	} else if (object->type == ACPI_TYPE_INTEGER) {
 		len = MIN(buflen, sizeof(object->integer.value));
+		dprintk("%s call returned an Integer (0x%.8x%.8x len:%zu)\n",
+				name,
+				(unsigned int)(object->integer.value >> 32),
+				(unsigned int)object->integer.value & 0xffffffff,
+				len);
+		memcpy(buffer, &object->integer.value, len);
 
-	else {
+	} else {
 		pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n",
 				ACPI_TYPE_BUFFER, object->type);
-		kfree(object);
-		return -EINVAL;
+		ret = -EINVAL;
 	}
 
-	memcpy(buffer, object->buffer.pointer, len);
 	kfree(object);
-	return 0;
+	return ret;
 }
 
 struct sony_nc_handles {
-- 
1.7.10.4

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

end of thread, other threads:[~2012-11-09 22:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-09 22:55 [PATCH 0/2 resend] sony-laptop fixes for 3.7 Mattia Dongili
2012-11-09 22:56 ` [PATCH 1/2] sony-laptop: fully enable SNY controlled modems Mattia Dongili
2012-11-09 22:56 ` [PATCH 2/2] sony-laptop: fix SNC buffer calls when SN06 returns Integers Mattia Dongili

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