diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-07-21 08:15:50 -0400 |
---|---|---|
committer | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2008-07-21 08:15:50 -0400 |
commit | 133ec3bd3ae409895eacdce326cdc8d73c249e8a (patch) | |
tree | 0e97e3089febe85b478c3b72022f4e058bb709ec | |
parent | 07431ec82bf9dc74b470a1d820b41c92c4d86e6f (diff) |
ACPI: thinkpad-acpi: WLSW overrides other rfkill switches
On ThinkPads where the WLSW switch exists, the firmware or the hardware
ANDs the WLSW state with the device-specific switches (WWAN, Bluetooth).
It is downright impossible to enable WWAN or Bluetooth when WLSW is
blocking the radios.
This reality does not necessarily carry over to the WWAN and Bluetooth
firmware interfaces, though... so the state thinkpad-acpi was reporting
could be incorrect.
Tie the three switches in the driver so that we keep their state sane.
When WLSL is off, force the other switches to off as well.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 743a4d6098e8..202d63e1b391 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -2588,6 +2588,10 @@ static int bluetooth_get_radiosw(void) | |||
2588 | if (!tp_features.bluetooth) | 2588 | if (!tp_features.bluetooth) |
2589 | return -ENODEV; | 2589 | return -ENODEV; |
2590 | 2590 | ||
2591 | /* WLSW overrides bluetooth in firmware/hardware, reflect that */ | ||
2592 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) | ||
2593 | return 0; | ||
2594 | |||
2591 | if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) | 2595 | if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) |
2592 | return -EIO; | 2596 | return -EIO; |
2593 | 2597 | ||
@@ -2601,6 +2605,12 @@ static int bluetooth_set_radiosw(int radio_on) | |||
2601 | if (!tp_features.bluetooth) | 2605 | if (!tp_features.bluetooth) |
2602 | return -ENODEV; | 2606 | return -ENODEV; |
2603 | 2607 | ||
2608 | /* WLSW overrides bluetooth in firmware/hardware, but there is no | ||
2609 | * reason to risk weird behaviour. */ | ||
2610 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status | ||
2611 | && radio_on) | ||
2612 | return -EPERM; | ||
2613 | |||
2604 | if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) | 2614 | if (!acpi_evalf(hkey_handle, &status, "GBDC", "d")) |
2605 | return -EIO; | 2615 | return -EIO; |
2606 | if (radio_on) | 2616 | if (radio_on) |
@@ -2760,6 +2770,10 @@ static int wan_get_radiosw(void) | |||
2760 | if (!tp_features.wan) | 2770 | if (!tp_features.wan) |
2761 | return -ENODEV; | 2771 | return -ENODEV; |
2762 | 2772 | ||
2773 | /* WLSW overrides WWAN in firmware/hardware, reflect that */ | ||
2774 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status) | ||
2775 | return 0; | ||
2776 | |||
2763 | if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) | 2777 | if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) |
2764 | return -EIO; | 2778 | return -EIO; |
2765 | 2779 | ||
@@ -2773,6 +2787,12 @@ static int wan_set_radiosw(int radio_on) | |||
2773 | if (!tp_features.wan) | 2787 | if (!tp_features.wan) |
2774 | return -ENODEV; | 2788 | return -ENODEV; |
2775 | 2789 | ||
2790 | /* WLSW overrides bluetooth in firmware/hardware, but there is no | ||
2791 | * reason to risk weird behaviour. */ | ||
2792 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status | ||
2793 | && radio_on) | ||
2794 | return -EPERM; | ||
2795 | |||
2776 | if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) | 2796 | if (!acpi_evalf(hkey_handle, &status, "GWAN", "d")) |
2777 | return -EIO; | 2797 | return -EIO; |
2778 | if (radio_on) | 2798 | if (radio_on) |