Skip to contentSkip to conversation

platform/x86/acer-wmi: Detect RF Button capability

PATCH In review João Paulo Rechi Vita 3 participants 4 messages Jun 6, 2017 – Jun 8, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86/acer-wmi: Detect RF Button capability

If a machine reports a RF Button in the communication button device bitmap, we need to remove it before calling Get Device Status otherwise it will return the "Undefined device" (0xE2) error code.

Although this may be a BIOS bug, we don't really need to get or set the RF Button status. The status indicator LED embedded in the button is controlled by firmware logic, depending on the status of the wireless radios present on the machine (WiFi || WWAN).

This commit fixes the wireless status indicator LED on the Acer TravelMate P648-G2-MG, and cleans the following message from the kernel
log: "Get Current Device Status failed: 0xe2 - 0x0".

---
 drivers/platform/x86/acer-wmi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/platform/x86/acer-wmi.c +7 -0
index 79fa5ab3fd00..3b381178039b 100644
@@ -149,6 +149,8 @@ struct event_return_value {
 #define ACER_WMID3_GDS_THREEG		(1<<6)	/* 3G */
 #define ACER_WMID3_GDS_WIMAX		(1<<7)	/* WiMAX */
 #define ACER_WMID3_GDS_BLUETOOTH	(1<<11)	/* BT */
+#define ACER_WMID3_GDS_RFBTN		(1<<14)	/* RF Button */
+
 #define ACER_WMID3_GDS_TOUCHPAD		(1<<1)	/* Touchpad */
 
 /* Hotkey Customized Setting and Acer Application Status.
@@ -221,6 +223,7 @@ struct hotkey_function_type_aa {
 #define ACER_CAP_BRIGHTNESS		(1<<3)
 #define ACER_CAP_THREEG			(1<<4)
 #define ACER_CAP_ACCEL			(1<<5)
+#define ACER_CAP_RFBTN			(1<<6)
 #define ACER_CAP_ANY			(0xFFFFFFFF)
 
 /*
@@ -1264,6 +1267,10 @@ static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d)
 		interface->capability |= ACER_CAP_THREEG;
 	if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH)
 		interface->capability |= ACER_CAP_BLUETOOTH;
+	if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_RFBTN) {
+		interface->capability |= ACER_CAP_RFBTN;
+		commun_func_bitmap &= ~ACER_WMID3_GDS_RFBTN;
+	}
 
 	commun_fn_key_number = type_aa->commun_fn_key_number;
 }
Signature · 1 line
2.11.0
#1 lore raw
Quoted 4 lines · João Paulo Rechi Vita

If a machine reports a RF Button in the communication button device bitmap, we need to remove it before calling Get Device Status otherwise it will return the "Undefined device" (0xE2) error code.

Quoted 9 lines

Although this may be a BIOS bug, we don't really need to get or set the RF Button status. The status indicator LED embedded in the button is controlled by firmware logic, depending on the status of the wireless radios present on the machine (WiFi || WWAN).

This commit fixes the wireless status indicator LED on the Acer TravelMate P648-G2-MG, and cleans the following message from the kernel
log: "Get Current Device Status failed: 0xe2 - 0x0".

Pushed to testing, thanks!

Quoted 40 lines
---
 drivers/platform/x86/acer-wmi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/platform/x86/acer-wmi.c +7 -1
index 79fa5ab3fd00..3b381178039b 100644
@@ -149,6 +149,8 @@ struct event_return_value {
 #define ACER_WMID3_GDS_THREEG          (1<<6)  /* 3G */
 #define ACER_WMID3_GDS_WIMAX           (1<<7)  /* WiMAX */
 #define ACER_WMID3_GDS_BLUETOOTH       (1<<11) /* BT */
+#define ACER_WMID3_GDS_RFBTN           (1<<14) /* RF Button */
+
 #define ACER_WMID3_GDS_TOUCHPAD                (1<<1)  /* Touchpad */
 
 /* Hotkey Customized Setting and Acer Application Status.
@@ -221,6 +223,7 @@ struct hotkey_function_type_aa {
 #define ACER_CAP_BRIGHTNESS            (1<<3)
 #define ACER_CAP_THREEG                        (1<<4)
 #define ACER_CAP_ACCEL                 (1<<5)
+#define ACER_CAP_RFBTN                 (1<<6)
 #define ACER_CAP_ANY                   (0xFFFFFFFF)
 
 /*
@@ -1264,6 +1267,10 @@ static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d)
                interface->capability |= ACER_CAP_THREEG;
        if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH)
                interface->capability |= ACER_CAP_BLUETOOTH;
+       if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_RFBTN) {
+               interface->capability |= ACER_CAP_RFBTN;
+               commun_func_bitmap &= ~ACER_WMID3_GDS_RFBTN;
+       }
 
        commun_fn_key_number = type_aa->commun_fn_key_number;
 }
--

2.11.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Reviewed-by Lee, Chun-Yi on v1 1/1
#2 lore raw
In reply to João Paulo Rechi Vita
Quoted 5 lines · João Paulo Rechi Vita

If a machine reports a RF Button in the communication button device bitmap, we need to remove it before calling Get Device Status otherwise it will return the "Undefined device" (0xE2) error code.

Although this may be a BIOS bug, we don't really need to get or set the

Yes, it's possible a BIOS bug.

Because the type aa reports that the 14 bit is raised in bitmap, but it can not be used to query the device status.

Quoted 9 lines

RF Button status. The status indicator LED embedded in the button is controlled by firmware logic, depending on the status of the wireless radios present on the machine (WiFi || WWAN).

This commit fixes the wireless status indicator LED on the Acer TravelMate P648-G2-MG, and cleans the following message from the kernel
log: "Get Current Device Status failed: 0xe2 - 0x0".

Please feel free to add:

Thanks a lot!
Joey Lee

Quoted 39 lines
---
 drivers/platform/x86/acer-wmi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/platform/x86/acer-wmi.c +7 -0
index 79fa5ab3fd00..3b381178039b 100644
@@ -149,6 +149,8 @@ struct event_return_value {
 #define ACER_WMID3_GDS_THREEG		(1<<6)	/* 3G */
 #define ACER_WMID3_GDS_WIMAX		(1<<7)	/* WiMAX */
 #define ACER_WMID3_GDS_BLUETOOTH	(1<<11)	/* BT */
+#define ACER_WMID3_GDS_RFBTN		(1<<14)	/* RF Button */
+
 #define ACER_WMID3_GDS_TOUCHPAD		(1<<1)	/* Touchpad */
 
 /* Hotkey Customized Setting and Acer Application Status.
@@ -221,6 +223,7 @@ struct hotkey_function_type_aa {
 #define ACER_CAP_BRIGHTNESS		(1<<3)
 #define ACER_CAP_THREEG			(1<<4)
 #define ACER_CAP_ACCEL			(1<<5)
+#define ACER_CAP_RFBTN			(1<<6)
 #define ACER_CAP_ANY			(0xFFFFFFFF)
 
 /*
@@ -1264,6 +1267,10 @@ static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d)
 		interface->capability |= ACER_CAP_THREEG;
 	if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH)
 		interface->capability |= ACER_CAP_BLUETOOTH;
+	if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_RFBTN) {
+		interface->capability |= ACER_CAP_RFBTN;
+		commun_func_bitmap &= ~ACER_WMID3_GDS_RFBTN;
+	}
 
 	commun_fn_key_number = type_aa->commun_fn_key_number;
 }
Signature · 1 line
2.11.0
#3 lore raw
Quoted 6 lines · joeyli
Quoted 1 line · João Paulo Rechi Vita

Please feel free to add:

Patchwork by some reason doesn't recognize this tag (presumably it doesn't allow leading spaces in that line). Thus, I would ask you to start tags in new lines without leading spaces.
This one I'm about to apply manually, no need to resend.

Signature · 2 lines
With Best Regards,
Andy Shevchenko