summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2011-02-06 13:28:32 +0100
committerMatthew Garrett <mjg@redhat.com>2011-03-28 06:05:16 -0400
commit0773d7f9f1c0ad5fb86d23ad7e4ef5bfd2f48b5e (patch)
tree91bfeeeb9b8932c99bdd1407b1b3071fa209eb9b /drivers/platform
parent5c95638d115f9c6661fff254b3beb14b19f88e41 (diff)
downloadblackbird-obmc-linux-0773d7f9f1c0ad5fb86d23ad7e4ef5bfd2f48b5e.tar.gz
blackbird-obmc-linux-0773d7f9f1c0ad5fb86d23ad7e4ef5bfd2f48b5e.zip
eeepc-wmi: add hibernate/resume callbacks
Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/eeepc-wmi.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index de501fb3d1bb..583ba78a7f7d 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -1183,10 +1183,59 @@ static int eeepc_wmi_remove(struct platform_device *device)
return 0;
}
+/*
+ * Platform driver - hibernate/resume callbacks
+ */
+static int eeepc_hotk_thaw(struct device *device)
+{
+ struct eeepc_wmi *eeepc = dev_get_drvdata(device);
+
+ if (eeepc->wlan_rfkill) {
+ bool wlan;
+
+ /*
+ * Work around bios bug - acpi _PTS turns off the wireless led
+ * during suspend. Normally it restores it on resume, but
+ * we should kick it ourselves in case hibernation is aborted.
+ */
+ wlan = eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WLAN);
+ eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_WLAN, wlan, NULL);
+ }
+
+ return 0;
+}
+
+static int eeepc_hotk_restore(struct device *device)
+{
+ struct eeepc_wmi *eeepc = dev_get_drvdata(device);
+ int bl;
+
+ /* Refresh both wlan rfkill state and pci hotplug */
+ if (eeepc->wlan_rfkill)
+ eeepc_rfkill_hotplug(eeepc);
+
+ if (eeepc->bluetooth_rfkill) {
+ bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_BLUETOOTH);
+ rfkill_set_sw_state(eeepc->bluetooth_rfkill, bl);
+}
+ if (eeepc->wwan3g_rfkill) {
+ bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WWAN3G);
+ rfkill_set_sw_state(eeepc->wwan3g_rfkill, bl);
+ }
+
+ return 0;
+}
+
+static const struct dev_pm_ops eeepc_pm_ops = {
+ .thaw = eeepc_hotk_thaw,
+ .restore = eeepc_hotk_restore,
+};
+
static struct platform_driver platform_driver = {
.driver = {
.name = EEEPC_WMI_FILE,
.owner = THIS_MODULE,
+ .pm = &eeepc_pm_ops,
},
};
OpenPOWER on IntegriCloud