diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2009-08-28 08:56:40 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-08-28 15:21:11 -0400 |
commit | c200da5d2900df9c24fb8041870d92a4175bbef3 (patch) | |
tree | 27c2aa5a17c3b6c9eaeef823ec96834714a6c161 /drivers/platform/x86/eeepc-laptop.c | |
parent | c1edd99f1c2b0285ce810d217180bf37bbae550e (diff) |
eeepc-laptop: switch to dev_pm_ops
This also involves switching the resume handler from the acpi device
to the platform device. Using the more fine grained handlers allows
two improvements:
1. We only need to recheck rfkill state after resume from hibernation.
2. The wireless LED workaround accounts for up to 1.1s out of 1.7s
resuming devices (when wireless is enabled). We can limit the
workaround to thaw(), so that it only delays suspend to disk.
The workaround is only likely to help when hibernation is aborted.
Suspend to ram cannot be aborted by the user. Device suspend errors may
well happen before eeepc-laptop would even be frozen. Suspend errors
which happen after that could be pretty funky anyway.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/eeepc-laptop.c')
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index df68ae6a55d5..1c948604af94 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -150,10 +150,19 @@ struct eeepc_hotk { | |||
150 | static struct eeepc_hotk *ehotk; | 150 | static struct eeepc_hotk *ehotk; |
151 | 151 | ||
152 | /* Platform device/driver */ | 152 | /* Platform device/driver */ |
153 | static int eeepc_hotk_thaw(struct device *device); | ||
154 | static int eeepc_hotk_restore(struct device *device); | ||
155 | |||
156 | static struct dev_pm_ops eeepc_pm_ops = { | ||
157 | .thaw = eeepc_hotk_thaw, | ||
158 | .restore = eeepc_hotk_restore, | ||
159 | }; | ||
160 | |||
153 | static struct platform_driver platform_driver = { | 161 | static struct platform_driver platform_driver = { |
154 | .driver = { | 162 | .driver = { |
155 | .name = EEEPC_HOTK_FILE, | 163 | .name = EEEPC_HOTK_FILE, |
156 | .owner = THIS_MODULE, | 164 | .owner = THIS_MODULE, |
165 | .pm = &eeepc_pm_ops, | ||
157 | } | 166 | } |
158 | }; | 167 | }; |
159 | 168 | ||
@@ -192,7 +201,6 @@ static struct key_entry eeepc_keymap[] = { | |||
192 | */ | 201 | */ |
193 | static int eeepc_hotk_add(struct acpi_device *device); | 202 | static int eeepc_hotk_add(struct acpi_device *device); |
194 | static int eeepc_hotk_remove(struct acpi_device *device, int type); | 203 | static int eeepc_hotk_remove(struct acpi_device *device, int type); |
195 | static int eeepc_hotk_resume(struct acpi_device *device); | ||
196 | static void eeepc_hotk_notify(struct acpi_device *device, u32 event); | 204 | static void eeepc_hotk_notify(struct acpi_device *device, u32 event); |
197 | 205 | ||
198 | static const struct acpi_device_id eeepc_device_ids[] = { | 206 | static const struct acpi_device_id eeepc_device_ids[] = { |
@@ -209,7 +217,6 @@ static struct acpi_driver eeepc_hotk_driver = { | |||
209 | .ops = { | 217 | .ops = { |
210 | .add = eeepc_hotk_add, | 218 | .add = eeepc_hotk_add, |
211 | .remove = eeepc_hotk_remove, | 219 | .remove = eeepc_hotk_remove, |
212 | .resume = eeepc_hotk_resume, | ||
213 | .notify = eeepc_hotk_notify, | 220 | .notify = eeepc_hotk_notify, |
214 | }, | 221 | }, |
215 | }; | 222 | }; |
@@ -821,7 +828,7 @@ error_slot: | |||
821 | return ret; | 828 | return ret; |
822 | } | 829 | } |
823 | 830 | ||
824 | static int eeepc_hotk_resume(struct acpi_device *device) | 831 | static int eeepc_hotk_thaw(struct device *device) |
825 | { | 832 | { |
826 | if (ehotk->wlan_rfkill) { | 833 | if (ehotk->wlan_rfkill) { |
827 | bool wlan; | 834 | bool wlan; |
@@ -829,14 +836,20 @@ static int eeepc_hotk_resume(struct acpi_device *device) | |||
829 | /* | 836 | /* |
830 | * Work around bios bug - acpi _PTS turns off the wireless led | 837 | * Work around bios bug - acpi _PTS turns off the wireless led |
831 | * during suspend. Normally it restores it on resume, but | 838 | * during suspend. Normally it restores it on resume, but |
832 | * we should kick it ourselves in case suspend is aborted. | 839 | * we should kick it ourselves in case hibernation is aborted. |
833 | */ | 840 | */ |
834 | wlan = get_acpi(CM_ASL_WLAN); | 841 | wlan = get_acpi(CM_ASL_WLAN); |
835 | set_acpi(CM_ASL_WLAN, wlan); | 842 | set_acpi(CM_ASL_WLAN, wlan); |
843 | } | ||
844 | |||
845 | return 0; | ||
846 | } | ||
836 | 847 | ||
837 | /* Refresh both rfkill state and pci hotplug */ | 848 | static int eeepc_hotk_restore(struct device *device) |
849 | { | ||
850 | /* Refresh both wlan rfkill state and pci hotplug */ | ||
851 | if (ehotk->wlan_rfkill) | ||
838 | eeepc_rfkill_hotplug(); | 852 | eeepc_rfkill_hotplug(); |
839 | } | ||
840 | 853 | ||
841 | if (ehotk->bluetooth_rfkill) | 854 | if (ehotk->bluetooth_rfkill) |
842 | rfkill_set_sw_state(ehotk->bluetooth_rfkill, | 855 | rfkill_set_sw_state(ehotk->bluetooth_rfkill, |