Skip to contentSkip to conversation

platform/x86: fujitsu-laptop: Fix radio LED detection

PATCH In review Michał Kępień 4 participants 10 messages Oct 25, 2017 – Oct 31, 2017

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

PATCH 1/1 platform/x86: fujitsu-laptop: Fix radio LED detection

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

---
I do not have a Fujitsu laptop with a radio LED for testing, so I was only able to check that this patch still does not cause a radio LED to be detected on a Lifebook S7020.

Harvey, could you please try this patch on your Lifebook E751 and see whether the log messages you reported disappear? I will be happy to assist you off-list in case you need help with it.

 drivers/platform/x86/fujitsu-laptop.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +9 -5
index 56a8195096a2..2cfbd3fa5136 100644
@@ -691,6 +691,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
 
 static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
 {
+	struct fujitsu_laptop *priv = acpi_driver_data(device);
 	struct led_classdev *led;
 	int result;
 
@@ -724,12 +725,15 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
 	}
 
 	/*
-	 * BTNI bit 24 seems to indicate the presence of a radio toggle
-	 * button in place of a slide switch, and all such machines appear
-	 * to also have an RF LED.  Therefore use bit 24 as an indicator
-	 * that an RF LED is present.
+	 * Some Fujitsu laptops have a radio toggle button in place of a slide
+	 * switch and all such machines appear to also have an RF LED.  Based on
+	 * comparing DSDT tables of four Fujitsu Lifebook models (E744, E751,
+	 * S7110, S8420; the first one has a radio toggle button, the other
+	 * three have slide switches), bit 17 of flags_supported (the value
+	 * returned by method S000 of ACPI device FUJ02E3) seems to indicate
+	 * whether given model has a radio toggle button.
 	 */
-	if (call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) {
+	if (priv->flags_supported & BIT(17)) {
 		led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
 		if (!led)
 			return -ENOMEM;
Signature · 1 line
2.14.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Micha?? K??pie??

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

This seems to be a reasonable approach given the most recent set of observations. Assuming it tests ok on the E751:

Regards
jonathan

Quoted 47 lines

---
I do not have a Fujitsu laptop with a radio LED for testing, so I was only able to check that this patch still does not cause a radio LED to be detected on a Lifebook S7020.

Harvey, could you please try this patch on your Lifebook E751 and see whether the log messages you reported disappear? I will be happy to assist you off-list in case you need help with it.

 drivers/platform/x86/fujitsu-laptop.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +9 -5
index 56a8195096a2..2cfbd3fa5136 100644
@@ -691,6 +691,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
 
 static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
 {
+	struct fujitsu_laptop *priv = acpi_driver_data(device);
 	struct led_classdev *led;
 	int result;
 
@@ -724,12 +725,15 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
 	}
 
 	/*
-	 * BTNI bit 24 seems to indicate the presence of a radio toggle
-	 * button in place of a slide switch, and all such machines appear
-	 * to also have an RF LED.  Therefore use bit 24 as an indicator
-	 * that an RF LED is present.
+	 * Some Fujitsu laptops have a radio toggle button in place of a slide
+	 * switch and all such machines appear to also have an RF LED.  Based on
+	 * comparing DSDT tables of four Fujitsu Lifebook models (E744, E751,
+	 * S7110, S8420; the first one has a radio toggle button, the other
+	 * three have slide switches), bit 17 of flags_supported (the value
+	 * returned by method S000 of ACPI device FUJ02E3) seems to indicate
+	 * whether given model has a radio toggle button.
 	 */
-	if (call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) {
+	if (priv->flags_supported & BIT(17)) {
 		led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
 		if (!led)
 			return -ENOMEM;
Signature · 1 line
2.14.2
Tested-by
#2 lore raw

Am 25.10.2017 um 08:33 schrieb Jonathan Woithe:

Quoted 10 lines · Micha?? K??pie??
Quoted 9 lines

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

Quoted 7 lines
Quoted 2 lines

This seems to be a reasonable approach given the most recent set of observations. Assuming it tests ok on the E751:

It does. I applied the patch against an Archlinux vanilla 4.13.9 kernel. The resulting module is clean and the error messages are gone, while anything else seems to work as expected.

So this looks ok for me.

Quoted 51 lines

Regards
jonathan

Quoted 47 lines

---
I do not have a Fujitsu laptop with a radio LED for testing, so I was only able to check that this patch still does not cause a radio LED to be detected on a Lifebook S7020.

Harvey, could you please try this patch on your Lifebook E751 and see whether the log messages you reported disappear? I will be happy to assist you off-list in case you need help with it.

 drivers/platform/x86/fujitsu-laptop.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +9 -5
index 56a8195096a2..2cfbd3fa5136 100644
@@ -691,6 +691,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
 
 static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
 {
+	struct fujitsu_laptop *priv = acpi_driver_data(device);
 	struct led_classdev *led;
 	int result;
 
@@ -724,12 +725,15 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
 	}
 
 	/*
-	 * BTNI bit 24 seems to indicate the presence of a radio toggle
-	 * button in place of a slide switch, and all such machines appear
-	 * to also have an RF LED.  Therefore use bit 24 as an indicator
-	 * that an RF LED is present.
+	 * Some Fujitsu laptops have a radio toggle button in place of a slide
+	 * switch and all such machines appear to also have an RF LED.  Based on
+	 * comparing DSDT tables of four Fujitsu Lifebook models (E744, E751,
+	 * S7110, S8420; the first one has a radio toggle button, the other
+	 * three have slide switches), bit 17 of flags_supported (the value
+	 * returned by method S000 of ACPI device FUJ02E3) seems to indicate
+	 * whether given model has a radio toggle button.
 	 */
-	if (call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) {
+	if (priv->flags_supported & BIT(17)) {
 		led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
 		if (!led)
 			return -ENOMEM;
Signature · 1 line
2.14.2
Signature · 1 line
I am root. If you see me laughing, you'd better have a backup!
#3 lore raw
In reply to Michał Kępień
Quoted 9 lines · Michał Kępień

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

Pushed to my review and testing queue, thanks!

Quoted 50 lines

---
I do not have a Fujitsu laptop with a radio LED for testing, so I was only able to check that this patch still does not cause a radio LED to be detected on a Lifebook S7020.

Harvey, could you please try this patch on your Lifebook E751 and see whether the log messages you reported disappear? I will be happy to assist you off-list in case you need help with it.

 drivers/platform/x86/fujitsu-laptop.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/platform/x86/fujitsu-laptop.c +9 -6
index 56a8195096a2..2cfbd3fa5136 100644
@@ -691,6 +691,7 @@ static enum led_brightness eco_led_get(struct led_classdev *cdev)
 
 static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
 {
+       struct fujitsu_laptop *priv = acpi_driver_data(device);
        struct led_classdev *led;
        int result;
 
@@ -724,12 +725,15 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
        }
 
        /*
-        * BTNI bit 24 seems to indicate the presence of a radio toggle
-        * button in place of a slide switch, and all such machines appear
-        * to also have an RF LED.  Therefore use bit 24 as an indicator
-        * that an RF LED is present.
+        * Some Fujitsu laptops have a radio toggle button in place of a slide
+        * switch and all such machines appear to also have an RF LED.  Based on
+        * comparing DSDT tables of four Fujitsu Lifebook models (E744, E751,
+        * S7110, S8420; the first one has a radio toggle button, the other
+        * three have slide switches), bit 17 of flags_supported (the value
+        * returned by method S000 of ACPI device FUJ02E3) seems to indicate
+        * whether given model has a radio toggle button.
         */
-       if (call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) {
+       if (priv->flags_supported & BIT(17)) {
                led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
                if (!led)
                        return -ENOMEM;
--

2.14.2

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 11 lines · Michał Kępień
Quoted 9 lines

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

Quoted 1 line

Pushed to my review and testing queue, thanks!

I forgot that this patch can also be tagged with:

Fixes 4f62568c1fcf ("fujitsu-laptop: Support radio LED")
Signature · 2 lines
Best regards,
Michał Kępień
#5 lore raw
Quoted 11 lines · Michał Kępień
Quoted 11 lines · Michał Kępień
Quoted 9 lines

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

Quoted 5 lines
Quoted 1 line

Pushed to my review and testing queue, thanks!

I forgot that this patch can also be tagged with:

Fixes 4f62568c1fcf ("fujitsu-laptop: Support radio LED")

Added.

Do you consider this an important fix? We are at -rc7 now, I'm not sure it's so critical. Tell me if you consider otherwise.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Reviewed-by Tested-by Heinrich Siebmanns
#6 lore raw
Quoted 14 lines · Andy Shevchenko
Quoted 13 lines · Micha?? K??pie??
Quoted 12 lines · Micha?? K??pie??
Quoted 9 lines

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

Pushed to my review and testing queue, thanks!

Quoted 8 lines
Quoted 3 lines

I forgot that this patch can also be tagged with:

Fixes 4f62568c1fcf ("fujitsu-laptop: Support radio LED")

Added.

Do you consider this an important fix? We are at -rc7 now, I'm not sure it's so critical. Tell me if you consider otherwise.

I agree - from my perspective I wouldn't have thought it so critical as to push it out this late in the development cycle. It's not a regression as such and is largely cosmetic. Others may argue differently though.

BTW, it looks like you may have missed my Reviewed-by tag on this patch, sent on 25 Oct. There was also a Tested-by added by Heinrich Siebmanns on the same day:

Or perhaps such peripheral tags aren't carried forward on patches like this, in which case it's a moot point.

Regards
jonathan

#7 lore raw
Quoted 19 lines · Jonathan Woithe
Quoted 18 lines · Andy Shevchenko
Quoted 16 lines · Micha?? K??pie??
Quoted 11 lines · Micha?? K??pie??
Quoted 9 lines

Radio LED detection method implemented in commit 4f62568c1fcf ("fujitsu-laptop: Support radio LED") turned out to be incorrect as it causes a radio LED to be erroneously detected on a Fujitsu Lifebook E751 which has a slide switch (and thus no radio LED). Use bit 17 of flags_supported (the value returned by method S000 of ACPI device FUJ02E3) to determine whether a radio LED is present as it seems to be a more reliable indicator, based on comparing DSDT tables of four Fujitsu Lifebook models (E744, E751, S7110, S8420).

Quoted 1 line

Pushed to my review and testing queue, thanks!

I forgot that this patch can also be tagged with:

Fixes 4f62568c1fcf ("fujitsu-laptop: Support radio LED")
Quoted 9 lines
Quoted 4 lines

Added.

Do you consider this an important fix? We are at -rc7 now, I'm not sure it's so critical. Tell me if you consider otherwise.

I agree - from my perspective I wouldn't have thought it so critical as to push it out this late in the development cycle. It's not a regression as such and is largely cosmetic. Others may argue differently though.

Got it!

Quoted 6 lines

BTW, it looks like you may have missed my Reviewed-by tag on this patch, sent on 25 Oct. There was also a Tested-by added by Heinrich Siebmanns on the same day:

The first one is indeed missed and sorry, can't touch the change anymore (it is published now).
The second one is there.

So, I applied a patch with tags that were parsed by patchwork at that time. Since Heinrich's ones are there, perhaps something happened to your tag that it wasn't recognized, sorry.

Quoted 2 lines

Or perhaps such peripheral tags aren't carried forward on patches like this, in which case it's a moot point.

It's okay to have them.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw
In reply to Jonathan Woithe
Quoted 6 lines
Quoted 2 lines

Do you consider this an important fix? We are at -rc7 now, I'm not sure it's so critical. Tell me if you consider otherwise.

I agree - from my perspective I wouldn't have thought it so critical as to push it out this late in the development cycle. It's not a regression as such and is largely cosmetic. Others may argue differently though.

I agree as well. The erroneous log messages will only be generated when any rfkill device in the system is enabled or disabled, so IMHO this is mostly a nuisance thus can be handled when convenient.

Signature · 2 lines
Best regards,
Michał Kępień
#9 lore raw
Quoted 3 lines

I agree as well. The erroneous log messages will only be generated when any rfkill device in the system is enabled or disabled, so IMHO this is mostly a nuisance thus can be handled when convenient.

FWIW: They are generated several times during every startup of the machine:

sudo journalctl -b | grep radio_led
718:Okt 31 11:46:21 gruenix kernel: leds fujitsu::radio_led: Setting an LED's brightness failed (-2147483648)
744:Okt 31 11:46:22 gruenix kernel: leds fujitsu::radio_led: Setting an LED's brightness failed (-2147483648)
760:Okt 31 11:46:22 gruenix kernel: leds fujitsu::radio_led: Setting an LED's brightness failed (-2147483648)
790:Okt 31 11:46:22 gruenix kernel: leds fujitsu::radio_led: Setting an LED's brightness failed (-2147483648)
793:Okt 31 11:46:22 gruenix kernel: leds fujitsu::radio_led: Setting an LED's brightness failed (-2147483648)
893:Okt 31 11:46:29 gruenix kernel: leds fujitsu::radio_led: Setting an LED's brightness failed (-2147483648)

But, yes. This is only a cosmetic issue. There don't seem to be too many people reportig this as well.

Greetings
Harvey

Signature · 1 line
I am root. If you see me laughing, you'd better have a backup!