]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ACPI: thinkpad-acpi: WLSW overrides other rfkill switches
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Mon, 21 Jul 2008 12:15:50 +0000 (09:15 -0300)
committerHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Mon, 21 Jul 2008 12:15:50 +0000 (09:15 -0300)
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>
drivers/misc/thinkpad_acpi.c

index 743a4d6098e8fe50d85f77605f133c38d92283ce..202d63e1b391899f2228d4e9f2e0abb695862c34 100644 (file)
@@ -2588,6 +2588,10 @@ static int bluetooth_get_radiosw(void)
        if (!tp_features.bluetooth)
                return -ENODEV;
 
+       /* WLSW overrides bluetooth in firmware/hardware, reflect that */
+       if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
+               return 0;
+
        if (!acpi_evalf(hkey_handle, &status, "GBDC", "d"))
                return -EIO;
 
@@ -2601,6 +2605,12 @@ static int bluetooth_set_radiosw(int radio_on)
        if (!tp_features.bluetooth)
                return -ENODEV;
 
+       /* WLSW overrides bluetooth in firmware/hardware, but there is no
+        * reason to risk weird behaviour. */
+       if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status
+           && radio_on)
+               return -EPERM;
+
        if (!acpi_evalf(hkey_handle, &status, "GBDC", "d"))
                return -EIO;
        if (radio_on)
@@ -2760,6 +2770,10 @@ static int wan_get_radiosw(void)
        if (!tp_features.wan)
                return -ENODEV;
 
+       /* WLSW overrides WWAN in firmware/hardware, reflect that */
+       if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
+               return 0;
+
        if (!acpi_evalf(hkey_handle, &status, "GWAN", "d"))
                return -EIO;
 
@@ -2773,6 +2787,12 @@ static int wan_set_radiosw(int radio_on)
        if (!tp_features.wan)
                return -ENODEV;
 
+       /* WLSW overrides bluetooth in firmware/hardware, but there is no
+        * reason to risk weird behaviour. */
+       if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status
+           && radio_on)
+               return -EPERM;
+
        if (!acpi_evalf(hkey_handle, &status, "GWAN", "d"))
                return -EIO;
        if (radio_on)