diff mbox

sony-laptop: support rfkill via ACPI interfaces

Message ID 200903211222.36642.matze@welwarsky.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Matthias Welwarsky March 21, 2009, 11:22 a.m. UTC
On Friday 20 March 2009 02:18:37 Norbert Preining wrote:
> Ok, here is the code.
>
> For those interested I Cc the  sony-vaio-z-series@lists.launchpad.net
> group where I first found that modules.
>
> You need:
> 	kernel 2.6.29-rc8	(maybe it works with all from .28 on)
> 	the patch Matthew sent
> 	the attached patch
>
> Together you get full rfkill support for bluetooth/wwan/wifi, plus afais
> stamina-speed mode setting.
>
> Maybe Matthias the creator of the sony-laptop for vaio-zseries modules
> can take a look at the patch and see if I missed something.

I checked the code and I think you didn't miss anything. Looks good.

> Matthias: sony_led_off and sony_dgpu_sta is never used, is that
> intentional? And also the #define SONY_WMMX_GUID I couldn't find being
> used anywhere.

You can safely get rid of this, its the GUID of the only valid (but broken) 
WMMX function in the DSDT code. It was a dead end.

> Maybe Matthew can take a look and fix the compile warnings in function
> ‘sony_ovga_dsm’ (there are some!).

Check the attached patch, it does away with the compile warnings. I've removed 
the warnings in functional code and put ifdefs (ugh!) around debug only code. 
You can just remove it if you don't like it, I'm only keeping it around for 
reference.

I've also backported Matthews patch to the standard Suse 11.1 kernel so that 
we can test it more easily.

Comments

Matthias Welwarsky March 21, 2009, 1:53 p.m. UTC | #1
On Saturday 21 March 2009 12:22:35 Matthias Welwarsky wrote:
> I've also backported Matthews patch to the standard Suse 11.1 kernel so
> that we can test it more easily.

Done, looks quite promising. The "wireless" switch on the Z21 works now, and 
apparently there is some script magic in opensuse that operates all rfkill 
switches, so it kills all wireless devices at once. Not bad.

The new init sequence for SN07 also enables all the special keys, even the 
speed/stamina switch now generates an ACPI event, as well as S1, S2 and Eject. 
But you cannot distinguish them, they all report the same event.

All in all - nice.
regards,
	matthias

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mattia Dongili March 21, 2009, 2:45 p.m. UTC | #2
On Sat, Mar 21, 2009 at 02:53:48PM +0100, Matthias Welwarsky wrote:
> On Saturday 21 March 2009 12:22:35 Matthias Welwarsky wrote:
> > I've also backported Matthews patch to the standard Suse 11.1 kernel so
> > that we can test it more easily.
> 
> Done, looks quite promising. The "wireless" switch on the Z21 works now, and 
> apparently there is some script magic in opensuse that operates all rfkill 
> switches, so it kills all wireless devices at once. Not bad.
> 
> The new init sequence for SN07 also enables all the special keys, even the 
> speed/stamina switch now generates an ACPI event, as well as S1, S2 and Eject. 
> But you cannot distinguish them, they all report the same event.

You mey need the additional SN07 call to get the actual key press, see
the code in sony_acpi_notify.
Norbert Preining March 21, 2009, 4:18 p.m. UTC | #3
Hi Matthias,

On Sa, 21 Mär 2009, Matthias Welwarsky wrote:
> > Maybe Matthew can take a look and fix the compile warnings in function
> > ‘sony_ovga_dsm’ (there are some!).
> 
> Check the attached patch, it does away with the compile warnings. I've removed 
> the warnings in functional code and put ifdefs (ugh!) around debug only code. 
> You can just remove it if you don't like it, I'm only keeping it around for 
> reference.

Against which version of sony-laptop does it apply? Against kernel,
against kernel+Matthew, against yours, against kernel+Matthew+mine? I
couldn't find out ..

Thanks for taking a look into that

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>        Vienna University of Technology
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
AFFPUDDLE (n.)
A puddle which is hidden under a pivoted paving stone. You only know
it's there when you step on the paving stone and the puddle shoots up
your leg.
			--- Douglas Adams, The Meaning of Liff
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Norbert Preining March 21, 2009, 4:51 p.m. UTC | #4
On Sa, 21 Mär 2009, Mattia Dongili wrote:
> > The new init sequence for SN07 also enables all the special keys, even the 
> > speed/stamina switch now generates an ACPI event, as well as S1, S2 and Eject. 
> > But you cannot distinguish them, they all report the same event.
> 
> You mey need the additional SN07 call to get the actual key press, see
> the code in sony_acpi_notify.

Hey that would be phantastic to have the keys working, please!

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>        Vienna University of Technology
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
DUNBOYNE (n.)
The moment of realisation that the train you have just patiently
watched pulling out of the station was the one you were meant to be
on.
			--- Douglas Adams, The Meaning of Liff
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- sony-laptop.c.orig	2009-03-21 12:11:31.000000000 +0100
+++ sony-laptop.c	2009-03-21 12:17:32.000000000 +0100
@@ -85,8 +85,6 @@ 
 #define SONY_PIC_HID		"SNY6001"
 #define SONY_PIC_DRIVER_NAME	"Sony Programmable IO Control Driver"
 
-#define SONY_WMMX_GUID "F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0"
-
 MODULE_AUTHOR("Stelian Pop, Mattia Dongili");
 MODULE_DESCRIPTION("Sony laptop extras driver (SPIC and SNC ACPI device)");
 MODULE_LICENSE("GPL");
@@ -485,8 +483,8 @@ 
 /*********** Platform Device ***********/
 static int sony_ovga_dsm(int func, int arg)
 {
-	static const char *path = "\\_SB.PCI0.OVGA._DSM";
-	static const char muid[] = {
+	static char *path = "\\_SB.PCI0.OVGA._DSM";
+	static char muid[] = {
 		/*00*/	0xA0, 0xA0, 0x95, 0x9D, 0x60, 0x00, 0x48, 0x4D,		/* MUID */
 		/*08*/	0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4,
 	};
@@ -494,7 +492,6 @@ 
 	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
 	struct acpi_object_list input;
 	union acpi_object params[4];
-	union acpi_object *obj;
 	int result;
 
 	input.count = 4;
@@ -515,25 +512,30 @@ 
 		return -1;
 	}
 
-	obj = (union acpi_object*)output.pointer;
-	printk("result type %d\n", obj->type);
-	if (obj->type == ACPI_TYPE_PACKAGE) {
-		int i;
-		printk("returned package sized %d\n", obj->package.count);
-		for (i = 0; i < obj->package.count; i++)
-			printk("%d %08x\n", i, obj->package.elements[i].integer.value);
-	} else
-	if (obj->type == ACPI_TYPE_INTEGER) {
-		printk("returned integer %08X\n", obj->integer.value);
-	} else
-	if (obj->type == ACPI_TYPE_BUFFER) {
-		int i;
-		printk("returned buffer sized %d\n", obj->buffer.length);
-		for (i = 0; i < obj->buffer.length; i++)
-			printk("%d %02x\n", i, obj->buffer.pointer[i]);
+#ifdef DEBUG
+	{
+		union acpi_object *obj;
+		obj = (union acpi_object*)output.pointer;
+		printk("result type %d\n", obj->type);
+		if (obj->type == ACPI_TYPE_PACKAGE) {
+			int i;
+			printk("returned package sized %d\n", obj->package.count);
+			for (i = 0; i < obj->package.count; i++)
+				printk("%d %08x\n", i, obj->package.elements[i].integer.value);
+		} else
+		if (obj->type == ACPI_TYPE_INTEGER) {
+			printk("returned integer %08X\n", obj->integer.value);
+		} else
+		if (obj->type == ACPI_TYPE_BUFFER) {
+			int i;
+			printk("returned buffer sized %d\n", obj->buffer.length);
+			for (i = 0; i < obj->buffer.length; i++)
+				printk("%d %02x\n", i, obj->buffer.pointer[i]);
+		}
 	}
-	kfree(output.pointer);
+#endif
 
+	kfree(output.pointer);
 	return 0;
 }
 
@@ -547,6 +549,7 @@ 
 	return sony_ovga_dsm(2, 0x12);
 }
 
+#ifdef DEBUG
 static int sony_led_off(void)
 {
 	return sony_ovga_dsm(2, 0x13);
@@ -556,6 +559,7 @@ 
 {
 	return sony_ovga_dsm(3, 0x00);
 }
+#endif
 
 static int sony_dgpu_off(void)
 {