Commit 208b996b authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by Len Brown

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: default avatarJerone Young <jerone.young@canonical.com>
Reported-by: default avatarIan Molton <ian.molton@collabora.co.uk>
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Tested-by: default avatarIan Molton <ian.molton@collabora.co.uk>
Cc: stable@kernel.org
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent a9f8eacc
...@@ -3866,15 +3866,6 @@ enum { ...@@ -3866,15 +3866,6 @@ enum {
#define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw" #define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw"
static void bluetooth_suspend(pm_message_t state)
{
/* Try to make sure radio will resume powered off */
if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd",
TP_ACPI_BLTH_PWR_OFF_ON_RESUME))
vdbg_printk(TPACPI_DBG_RFKILL,
"bluetooth power down on resume request failed\n");
}
static int bluetooth_get_status(void) static int bluetooth_get_status(void)
{ {
int status; int status;
...@@ -3908,10 +3899,9 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state) ...@@ -3908,10 +3899,9 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state)
#endif #endif
/* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */ /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */
status = TP_ACPI_BLUETOOTH_RESUMECTRL;
if (state == TPACPI_RFK_RADIO_ON) if (state == TPACPI_RFK_RADIO_ON)
status = TP_ACPI_BLUETOOTH_RADIOSSW; status |= TP_ACPI_BLUETOOTH_RADIOSSW;
else
status = 0;
if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
return -EIO; return -EIO;
...@@ -4050,7 +4040,6 @@ static struct ibm_struct bluetooth_driver_data = { ...@@ -4050,7 +4040,6 @@ static struct ibm_struct bluetooth_driver_data = {
.read = bluetooth_read, .read = bluetooth_read,
.write = bluetooth_write, .write = bluetooth_write,
.exit = bluetooth_exit, .exit = bluetooth_exit,
.suspend = bluetooth_suspend,
.shutdown = bluetooth_shutdown, .shutdown = bluetooth_shutdown,
}; };
...@@ -4068,15 +4057,6 @@ enum { ...@@ -4068,15 +4057,6 @@ enum {
#define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw" #define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw"
static void wan_suspend(pm_message_t state)
{
/* Try to make sure radio will resume powered off */
if (!acpi_evalf(NULL, NULL, "\\WGSV", "qvd",
TP_ACPI_WGSV_PWR_OFF_ON_RESUME))
vdbg_printk(TPACPI_DBG_RFKILL,
"WWAN power down on resume request failed\n");
}
static int wan_get_status(void) static int wan_get_status(void)
{ {
int status; int status;
...@@ -4109,11 +4089,10 @@ static int wan_set_status(enum tpacpi_rfkill_state state) ...@@ -4109,11 +4089,10 @@ static int wan_set_status(enum tpacpi_rfkill_state state)
} }
#endif #endif
/* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */ /* We make sure to set TP_ACPI_WANCARD_RESUMECTRL */
status = TP_ACPI_WANCARD_RESUMECTRL;
if (state == TPACPI_RFK_RADIO_ON) if (state == TPACPI_RFK_RADIO_ON)
status = TP_ACPI_WANCARD_RADIOSSW; status |= TP_ACPI_WANCARD_RADIOSSW;
else
status = 0;
if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
return -EIO; return -EIO;
...@@ -4251,7 +4230,6 @@ static struct ibm_struct wan_driver_data = { ...@@ -4251,7 +4230,6 @@ static struct ibm_struct wan_driver_data = {
.read = wan_read, .read = wan_read,
.write = wan_write, .write = wan_write,
.exit = wan_exit, .exit = wan_exit,
.suspend = wan_suspend,
.shutdown = wan_shutdown, .shutdown = wan_shutdown,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment