diff options
author | Corentin Chary <corentincj@iksaif.net> | 2011-02-06 07:28:32 -0500 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-03-28 06:05:16 -0400 |
commit | 0773d7f9f1c0ad5fb86d23ad7e4ef5bfd2f48b5e (patch) | |
tree | 91bfeeeb9b8932c99bdd1407b1b3071fa209eb9b /drivers/platform | |
parent | 5c95638d115f9c6661fff254b3beb14b19f88e41 (diff) |
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.c | 49 |
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) | |||
1183 | return 0; | 1183 | return 0; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | /* | ||
1187 | * Platform driver - hibernate/resume callbacks | ||
1188 | */ | ||
1189 | static int eeepc_hotk_thaw(struct device *device) | ||
1190 | { | ||
1191 | struct eeepc_wmi *eeepc = dev_get_drvdata(device); | ||
1192 | |||
1193 | if (eeepc->wlan_rfkill) { | ||
1194 | bool wlan; | ||
1195 | |||
1196 | /* | ||
1197 | * Work around bios bug - acpi _PTS turns off the wireless led | ||
1198 | * during suspend. Normally it restores it on resume, but | ||
1199 | * we should kick it ourselves in case hibernation is aborted. | ||
1200 | */ | ||
1201 | wlan = eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WLAN); | ||
1202 | eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_WLAN, wlan, NULL); | ||
1203 | } | ||
1204 | |||
1205 | return 0; | ||
1206 | } | ||
1207 | |||
1208 | static int eeepc_hotk_restore(struct device *device) | ||
1209 | { | ||
1210 | struct eeepc_wmi *eeepc = dev_get_drvdata(device); | ||
1211 | int bl; | ||
1212 | |||
1213 | /* Refresh both wlan rfkill state and pci hotplug */ | ||
1214 | if (eeepc->wlan_rfkill) | ||
1215 | eeepc_rfkill_hotplug(eeepc); | ||
1216 | |||
1217 | if (eeepc->bluetooth_rfkill) { | ||
1218 | bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_BLUETOOTH); | ||
1219 | rfkill_set_sw_state(eeepc->bluetooth_rfkill, bl); | ||
1220 | } | ||
1221 | if (eeepc->wwan3g_rfkill) { | ||
1222 | bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WWAN3G); | ||
1223 | rfkill_set_sw_state(eeepc->wwan3g_rfkill, bl); | ||
1224 | } | ||
1225 | |||
1226 | return 0; | ||
1227 | } | ||
1228 | |||
1229 | static const struct dev_pm_ops eeepc_pm_ops = { | ||
1230 | .thaw = eeepc_hotk_thaw, | ||
1231 | .restore = eeepc_hotk_restore, | ||
1232 | }; | ||
1233 | |||
1186 | static struct platform_driver platform_driver = { | 1234 | static struct platform_driver platform_driver = { |
1187 | .driver = { | 1235 | .driver = { |
1188 | .name = EEEPC_WMI_FILE, | 1236 | .name = EEEPC_WMI_FILE, |
1189 | .owner = THIS_MODULE, | 1237 | .owner = THIS_MODULE, |
1238 | .pm = &eeepc_pm_ops, | ||
1190 | }, | 1239 | }, |
1191 | }; | 1240 | }; |
1192 | 1241 | ||