Add patches accepted for 2.6.27-rc1
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / releases / upstream / 2.6.27-rc1 / 0004-ACPI-thinkpad-acpi-WLSW-overrides-other-rfkill-swi.patch
blobc664dc72190a3b8d6e770933b1ebebe8c18a5b64
1 From 133ec3bd3ae409895eacdce326cdc8d73c249e8a Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Mon, 21 Jul 2008 09:15:50 -0300
4 Subject: ACPI: thinkpad-acpi: WLSW overrides other rfkill switches
6 On ThinkPads where the WLSW switch exists, the firmware or the hardware
7 ANDs the WLSW state with the device-specific switches (WWAN, Bluetooth).
8 It is downright impossible to enable WWAN or Bluetooth when WLSW is
9 blocking the radios.
11 This reality does not necessarily carry over to the WWAN and Bluetooth
12 firmware interfaces, though... so the state thinkpad-acpi was reporting
13 could be incorrect.
15 Tie the three switches in the driver so that we keep their state sane.
16 When WLSL is off, force the other switches to off as well.
18 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
19 ---
20 drivers/misc/thinkpad_acpi.c | 20 ++++++++++++++++++++
21 1 files changed, 20 insertions(+), 0 deletions(-)
23 diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
24 index 743a4d6..202d63e 100644
25 --- a/drivers/misc/thinkpad_acpi.c
26 +++ b/drivers/misc/thinkpad_acpi.c
27 @@ -2588,6 +2588,10 @@ static int bluetooth_get_radiosw(void)
28 if (!tp_features.bluetooth)
29 return -ENODEV;
31 + /* WLSW overrides bluetooth in firmware/hardware, reflect that */
32 + if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
33 + return 0;
35 if (!acpi_evalf(hkey_handle, &status, "GBDC", "d"))
36 return -EIO;
38 @@ -2601,6 +2605,12 @@ static int bluetooth_set_radiosw(int radio_on)
39 if (!tp_features.bluetooth)
40 return -ENODEV;
42 + /* WLSW overrides bluetooth in firmware/hardware, but there is no
43 + * reason to risk weird behaviour. */
44 + if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status
45 + && radio_on)
46 + return -EPERM;
48 if (!acpi_evalf(hkey_handle, &status, "GBDC", "d"))
49 return -EIO;
50 if (radio_on)
51 @@ -2760,6 +2770,10 @@ static int wan_get_radiosw(void)
52 if (!tp_features.wan)
53 return -ENODEV;
55 + /* WLSW overrides WWAN in firmware/hardware, reflect that */
56 + if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status)
57 + return 0;
59 if (!acpi_evalf(hkey_handle, &status, "GWAN", "d"))
60 return -EIO;
62 @@ -2773,6 +2787,12 @@ static int wan_set_radiosw(int radio_on)
63 if (!tp_features.wan)
64 return -ENODEV;
66 + /* WLSW overrides bluetooth in firmware/hardware, but there is no
67 + * reason to risk weird behaviour. */
68 + if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&status) && !status
69 + && radio_on)
70 + return -EPERM;
72 if (!acpi_evalf(hkey_handle, &status, "GWAN", "d"))
73 return -EIO;
74 if (radio_on)
75 --
76 1.5.6.2