linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware
@ 2009-01-18  1:53 Tony Vroon
  2009-01-18  7:29 ` Stephen Gildea
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tony Vroon @ 2009-01-18  1:53 UTC (permalink / raw)
  To: Jonathan Woithe; +Cc: Stephen Gildea, Peter Gruber, Julian Brown, linux-acpi

Up until now, we polled the rfkill status for every incoming FUJ02E3 ACPI event. 
It turns out that the firmware has a bitmask which indicates what rfkill-related 
state it can report.
The rfkill_supported bitmask is now used to avoid polling for rfkill at all in 
the notification handler if there is no support. Also, it is used in the platform 
device callbacks. As before we register all callbacks and report "unknown" if the 
firmware does not give us status updates for that particular bit.

This was fed through checkpatch.pl and tested on the S6420 platform.
Jonathan, your platform is of particular importance as you are the only tester 
on a platform with no S000 function in the DSDT. Please confirm you still get a 
unknown status in the platform files. With debugging on full, you should see the 
0x1000 0x4 0x0 0x0 call disappear from your trace entirely.

Signed-off-by: Tony Vroon <tony@linx.net>

--- linux-2.6/drivers/platform/x86/fujitsu-laptop.c.orig	2009-01-18 01:05:55.000000000 +0000
+++ linux-2.6/drivers/platform/x86/fujitsu-laptop.c	2009-01-18 01:21:27.000000000 +0000
@@ -166,6 +166,7 @@
 	struct platform_device *pf_device;
 	struct kfifo *fifo;
 	spinlock_t fifo_lock;
+	int rfkill_supported;
 	int rfkill_state;
 	int logolamp_registered;
 	int kblamps_registered;
@@ -526,7 +527,7 @@
 show_lid_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+	if (!(fujitsu_hotkey->rfkill_supported & 0x100))
 		return sprintf(buf, "unknown\n");
 	if (fujitsu_hotkey->rfkill_state & 0x100)
 		return sprintf(buf, "open\n");
@@ -538,7 +539,7 @@
 show_dock_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+	if (!(fujitsu_hotkey->rfkill_supported & 0x200))
 		return sprintf(buf, "unknown\n");
 	if (fujitsu_hotkey->rfkill_state & 0x200)
 		return sprintf(buf, "docked\n");
@@ -550,7 +551,7 @@
 show_radios_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+	if (!(fujitsu_hotkey->rfkill_supported & 0x20))
 		return sprintf(buf, "unknown\n");
 	if (fujitsu_hotkey->rfkill_state & 0x20)
 		return sprintf(buf, "on\n");
@@ -928,8 +929,17 @@
 		; /* No action, result is discarded */
 	vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
 
-	fujitsu_hotkey->rfkill_state =
-		call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
+	fujitsu_hotkey->rfkill_supported =
+		call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
+
+	/* Make sure our bitmask of supported functions is cleared if the
+	   RFKILL function block is not implemented, like on the S7020. */
+	if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
+		fujitsu_hotkey->rfkill_supported = 0;
+
+	if (fujitsu_hotkey->rfkill_supported)
+		fujitsu_hotkey->rfkill_state =
+			call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
 
 	/* Suspect this is a keymap of the application panel, print it */
 	printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n",
@@ -1005,8 +1015,9 @@
 
 	input = fujitsu_hotkey->input;
 
-	fujitsu_hotkey->rfkill_state =
-		call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
+	if (fujitsu_hotkey->rfkill_supported)
+		fujitsu_hotkey->rfkill_state =
+			call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
 
 	switch (event) {
 	case ACPI_FUJITSU_NOTIFY_CODE1:

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

* Re: [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware
  2009-01-18  1:53 [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware Tony Vroon
@ 2009-01-18  7:29 ` Stephen Gildea
  2009-01-18 23:10 ` Jonathan Woithe
  2009-02-02  0:31 ` [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware Jonathan Woithe
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Gildea @ 2009-01-18  7:29 UTC (permalink / raw)
  To: Tony Vroon; +Cc: Jonathan Woithe, Peter Gruber, Julian Brown, linux-acpi

The /sys/devices/platform/fujitsu-laptop/{dock,radios,lid} files
still work on my P8010.  I applied this patch to 2.6.29-rc2.

Tested-by: Stephen Gildea <stepheng+linux@gildea.com>

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

* Re: [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware
  2009-01-18  1:53 [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware Tony Vroon
  2009-01-18  7:29 ` Stephen Gildea
@ 2009-01-18 23:10 ` Jonathan Woithe
  2009-01-19  0:46   ` Tony Vroon
  2009-02-02  0:31 ` [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware Jonathan Woithe
  2 siblings, 1 reply; 6+ messages in thread
From: Jonathan Woithe @ 2009-01-18 23:10 UTC (permalink / raw)
  To: Tony Vroon
  Cc: Jonathan Woithe, Stephen Gildea, Peter Gruber, Julian Brown,
	linux-acpi

Hi Tony

> Up until now, we polled the rfkill status for every incoming FUJ02E3 ACPI event. 
> It turns out that the firmware has a bitmask which indicates what rfkill-related 
> state it can report.
> The rfkill_supported bitmask is now used to avoid polling for rfkill at all in 
> the notification handler if there is no support. Also, it is used in the platform 
> device callbacks. As before we register all callbacks and report "unknown" if the 
> firmware does not give us status updates for that particular bit.
> 
> This was fed through checkpatch.pl and tested on the S6420 platform.
> Jonathan, your platform is of particular importance as you are the only tester 
> on a platform with no S000 function in the DSDT. Please confirm you still get a 
> unknown status in the platform files. With debugging on full, you should see the 
> 0x1000 0x4 0x0 0x0 call disappear from your trace entirely.

I'll check this as soon as I can.  I'm at Linux.conf.au this week though so
I'm not sure I'll be able to.  We'll see.

What kernel is the patch against?

Regards
  jonathan

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

* Re: [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware
  2009-01-18 23:10 ` Jonathan Woithe
@ 2009-01-19  0:46   ` Tony Vroon
  2009-01-19  3:37     ` [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from Jonathan Woithe
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Vroon @ 2009-01-19  0:46 UTC (permalink / raw)
  To: Jonathan Woithe; +Cc: Stephen Gildea, Peter Gruber, Julian Brown, linux-acpi

[-- Attachment #1: Type: text/plain, Size: 297 bytes --]

On Mon, 2009-01-19 at 09:40 +1030, Jonathan Woithe wrote:
> What kernel is the patch against?

2.6.29-rc2 (as it assumes the move from misc to x86/platform has been
made). Fairly sure it would apply to -rc1 as well, should that be
convenient.

> Regards
>   jonathan

Regards,
Tony V.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from
  2009-01-19  0:46   ` Tony Vroon
@ 2009-01-19  3:37     ` Jonathan Woithe
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Woithe @ 2009-01-19  3:37 UTC (permalink / raw)
  To: Tony Vroon
  Cc: Jonathan Woithe, Stephen Gildea, Peter Gruber, Julian Brown,
	linux-acpi

Hi Tony

> On Mon, 2009-01-19 at 09:40 +1030, Jonathan Woithe wrote:
> > What kernel is the patch against?
> 
> 2.6.29-rc2 (as it assumes the move from misc to x86/platform has been
> made). Fairly sure it would apply to -rc1 as well, should that be
> convenient.

Ah, they resolved the new location issue then?  A lot happens in a week. :-)
Thanks for the heads-up.

Regards
  jonathan

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

* Re: [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware
  2009-01-18  1:53 [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware Tony Vroon
  2009-01-18  7:29 ` Stephen Gildea
  2009-01-18 23:10 ` Jonathan Woithe
@ 2009-02-02  0:31 ` Jonathan Woithe
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Woithe @ 2009-02-02  0:31 UTC (permalink / raw)
  To: Tony Vroon
  Cc: Jonathan Woithe, Stephen Gildea, Peter Gruber, Julian Brown,
	linux-acpi

Hi Tony

> Jonathan, your platform is of particular importance as you are the only
> tester on a platform with no S000 function in the DSDT. Please confirm you
> still get a unknown status in the platform files. With debugging on full,
> you should see the 0x1000 0x4 0x0 0x0 call disappear from your trace
> entirely.

I can confirm that this patch does not break the S7020 - I still get
"unknown" in the status platform files, as expected.

Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>

Patch reproduced below for convenience.

Regards
  jonathan


Up until now, we polled the rfkill status for every incoming FUJ02E3 ACPI event. 
It turns out that the firmware has a bitmask which indicates what rfkill-related 
state it can report.
The rfkill_supported bitmask is now used to avoid polling for rfkill at all in 
the notification handler if there is no support. Also, it is used in the platform 
device callbacks. As before we register all callbacks and report "unknown" if the 
firmware does not give us status updates for that particular bit.

This was fed through checkpatch.pl and tested on the S6420 platform.
Jonathan, your platform is of particular importance as you are the only tester 
on a platform with no S000 function in the DSDT. Please confirm you still get a 
unknown status in the platform files. With debugging on full, you should see the 
0x1000 0x4 0x0 0x0 call disappear from your trace entirely.

Signed-off-by: Tony Vroon <tony@linx.net>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>


--- linux-2.6/drivers/platform/x86/fujitsu-laptop.c.orig	2009-01-18 01:05:55.000000000 +0000
+++ linux-2.6/drivers/platform/x86/fujitsu-laptop.c	2009-01-18 01:21:27.000000000 +0000
@@ -166,6 +166,7 @@
 	struct platform_device *pf_device;
 	struct kfifo *fifo;
 	spinlock_t fifo_lock;
+	int rfkill_supported;
 	int rfkill_state;
 	int logolamp_registered;
 	int kblamps_registered;
@@ -526,7 +527,7 @@
 show_lid_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+	if (!(fujitsu_hotkey->rfkill_supported & 0x100))
 		return sprintf(buf, "unknown\n");
 	if (fujitsu_hotkey->rfkill_state & 0x100)
 		return sprintf(buf, "open\n");
@@ -538,7 +539,7 @@
 show_dock_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+	if (!(fujitsu_hotkey->rfkill_supported & 0x200))
 		return sprintf(buf, "unknown\n");
 	if (fujitsu_hotkey->rfkill_state & 0x200)
 		return sprintf(buf, "docked\n");
@@ -550,7 +551,7 @@
 show_radios_state(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
-	if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+	if (!(fujitsu_hotkey->rfkill_supported & 0x20))
 		return sprintf(buf, "unknown\n");
 	if (fujitsu_hotkey->rfkill_state & 0x20)
 		return sprintf(buf, "on\n");
@@ -928,8 +929,17 @@
 		; /* No action, result is discarded */
 	vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
 
-	fujitsu_hotkey->rfkill_state =
-		call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
+	fujitsu_hotkey->rfkill_supported =
+		call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
+
+	/* Make sure our bitmask of supported functions is cleared if the
+	   RFKILL function block is not implemented, like on the S7020. */
+	if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
+		fujitsu_hotkey->rfkill_supported = 0;
+
+	if (fujitsu_hotkey->rfkill_supported)
+		fujitsu_hotkey->rfkill_state =
+			call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
 
 	/* Suspect this is a keymap of the application panel, print it */
 	printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n",
@@ -1005,8 +1015,9 @@
 
 	input = fujitsu_hotkey->input;
 
-	fujitsu_hotkey->rfkill_state =
-		call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
+	if (fujitsu_hotkey->rfkill_supported)
+		fujitsu_hotkey->rfkill_state =
+			call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
 
 	switch (event) {
 	case ACPI_FUJITSU_NOTIFY_CODE1:


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

end of thread, other threads:[~2009-02-02  0:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-18  1:53 [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware Tony Vroon
2009-01-18  7:29 ` Stephen Gildea
2009-01-18 23:10 ` Jonathan Woithe
2009-01-19  0:46   ` Tony Vroon
2009-01-19  3:37     ` [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from Jonathan Woithe
2009-02-02  0:31 ` [PATCH RFT] fujitsu-laptop: Use RFKILL support bitmask from firmware Jonathan Woithe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).