aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-12-08 20:36:22 -0500
committerLen Brown <len.brown@intel.com>2009-12-09 15:45:30 -0500
commit208b996b6c460285650d39b2330f8ef82c007d10 (patch)
tree02509f302a515b6a928cb6e73de50e9589b43244 /drivers/platform
parenta9f8eacca4e9e8693de9b896c1fa7aadaa9402e8 (diff)
thinkpad-acpi: preserve rfkill state across suspend/resume
Since the rfkill rework in 2.6.31, the driver is always resuming with the radios disabled. Change thinkpad-acpi to ask the firmware to resume with the radios in the last state. This fixes the Bluetooth and WWAN rfkill switches. Note that it means we respect the firmware's oddities. Should the user toggle the hardware rfkill switch on and off, it might cause the radios to resume enabled. UWB is an unknown quantity since it has nowhere the same level of firmware support (no control over state storage in NVRAM, for example), and might need further fixing. Testers welcome. This change fixes a regression from 2.6.30. Reported-by: Jerone Young <jerone.young@canonical.com> Reported-by: Ian Molton <ian.molton@collabora.co.uk> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Tested-by: Ian Molton <ian.molton@collabora.co.uk> Cc: stable@kernel.org Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 9c6d5a929e96..1ee734c14cc1 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -3866,15 +3866,6 @@ enum {
3866 3866
3867#define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw" 3867#define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw"
3868 3868
3869static void bluetooth_suspend(pm_message_t state)
3870{
3871 /* Try to make sure radio will resume powered off */
3872 if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd",
3873 TP_ACPI_BLTH_PWR_OFF_ON_RESUME))
3874 vdbg_printk(TPACPI_DBG_RFKILL,
3875 "bluetooth power down on resume request failed\n");
3876}
3877
3878static int bluetooth_get_status(void) 3869static int bluetooth_get_status(void)
3879{ 3870{
3880 int status; 3871 int status;
@@ -3908,10 +3899,9 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state)
3908#endif 3899#endif
3909 3900
3910 /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */ 3901 /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */
3902 status = TP_ACPI_BLUETOOTH_RESUMECTRL;
3911 if (state == TPACPI_RFK_RADIO_ON) 3903 if (state == TPACPI_RFK_RADIO_ON)
3912 status = TP_ACPI_BLUETOOTH_RADIOSSW; 3904 status |= TP_ACPI_BLUETOOTH_RADIOSSW;
3913 else
3914 status = 0;
3915 3905
3916 if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) 3906 if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
3917 return -EIO; 3907 return -EIO;
@@ -4050,7 +4040,6 @@ static struct ibm_struct bluetooth_driver_data = {
4050 .read = bluetooth_read, 4040 .read = bluetooth_read,
4051 .write = bluetooth_write, 4041 .write = bluetooth_write,
4052 .exit = bluetooth_exit, 4042 .exit = bluetooth_exit,
4053 .suspend = bluetooth_suspend,
4054 .shutdown = bluetooth_shutdown, 4043 .shutdown = bluetooth_shutdown,
4055}; 4044};
4056 4045
@@ -4068,15 +4057,6 @@ enum {
4068 4057
4069#define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw" 4058#define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw"
4070 4059
4071static void wan_suspend(pm_message_t state)
4072{
4073 /* Try to make sure radio will resume powered off */
4074 if (!acpi_evalf(NULL, NULL, "\\WGSV", "qvd",
4075 TP_ACPI_WGSV_PWR_OFF_ON_RESUME))
4076 vdbg_printk(TPACPI_DBG_RFKILL,
4077 "WWAN power down on resume request failed\n");
4078}
4079
4080static int wan_get_status(void) 4060static int wan_get_status(void)
4081{ 4061{
4082 int status; 4062 int status;
@@ -4109,11 +4089,10 @@ static int wan_set_status(enum tpacpi_rfkill_state state)
4109 } 4089 }
4110#endif 4090#endif
4111 4091
4112 /* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */ 4092 /* We make sure to set TP_ACPI_WANCARD_RESUMECTRL */
4093 status = TP_ACPI_WANCARD_RESUMECTRL;
4113 if (state == TPACPI_RFK_RADIO_ON) 4094 if (state == TPACPI_RFK_RADIO_ON)
4114 status = TP_ACPI_WANCARD_RADIOSSW; 4095 status |= TP_ACPI_WANCARD_RADIOSSW;
4115 else
4116 status = 0;
4117 4096
4118 if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) 4097 if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
4119 return -EIO; 4098 return -EIO;
@@ -4251,7 +4230,6 @@ static struct ibm_struct wan_driver_data = {
4251 .read = wan_read, 4230 .read = wan_read,
4252 .write = wan_write, 4231 .write = wan_write,
4253 .exit = wan_exit, 4232 .exit = wan_exit,
4254 .suspend = wan_suspend,
4255 .shutdown = wan_shutdown, 4233 .shutdown = wan_shutdown,
4256}; 4234};
4257 4235