aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEven Xu <even.xu@intel.com>2016-02-11 15:11:34 -0500
committerJiri Kosina <jkosina@suse.cz>2018-06-20 03:27:23 -0400
commitebeaa367548e9e92dd9374b9464ff6e7d157117b (patch)
tree5d7ba22a82ba45772786cc09b79f1e56dd4c4c35
parent4bff980f920693693d7a529c06a1bd1e7f77603a (diff)
HID: intel_ish-hid: ipc: register more pm callbacks to support hibernation
Current ISH driver only registers suspend/resume PM callbacks which don't support hibernation (suspend to disk). Basically after hiberation, the ISH can't resume properly and user may not see sensor events (for example: screen rotation may not work). User will not see a crash or panic or anything except the following message in log: hid-sensor-hub 001F:8086:22D8.0001: timeout waiting for response from ISHTP device So this patch adds support for S4/hiberbation to ISH by using the SIMPLE_DEV_PM_OPS() MACRO instead of struct dev_pm_ops directly. The suspend and resume functions will now be used for both suspend to RAM and hibernation. If power management is disabled, SIMPLE_DEV_PM_OPS will do nothing, the suspend and resume related functions won't be used, so mark them as __maybe_unused to clarify that this is the intended behavior, and remove #ifdefs for power management. Cc: stable@vger.kernel.org Signed-off-by: Even Xu <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/intel-ish-hid/ipc/pci-ish.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
index 582e449be9fe..a2c53ea3b5ed 100644
--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
+++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
@@ -205,8 +205,7 @@ static void ish_remove(struct pci_dev *pdev)
205 kfree(ishtp_dev); 205 kfree(ishtp_dev);
206} 206}
207 207
208#ifdef CONFIG_PM 208static struct device __maybe_unused *ish_resume_device;
209static struct device *ish_resume_device;
210 209
211/* 50ms to get resume response */ 210/* 50ms to get resume response */
212#define WAIT_FOR_RESUME_ACK_MS 50 211#define WAIT_FOR_RESUME_ACK_MS 50
@@ -220,7 +219,7 @@ static struct device *ish_resume_device;
220 * in that case a simple resume message is enough, others we need 219 * in that case a simple resume message is enough, others we need
221 * a reset sequence. 220 * a reset sequence.
222 */ 221 */
223static void ish_resume_handler(struct work_struct *work) 222static void __maybe_unused ish_resume_handler(struct work_struct *work)
224{ 223{
225 struct pci_dev *pdev = to_pci_dev(ish_resume_device); 224 struct pci_dev *pdev = to_pci_dev(ish_resume_device);
226 struct ishtp_device *dev = pci_get_drvdata(pdev); 225 struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -262,7 +261,7 @@ static void ish_resume_handler(struct work_struct *work)
262 * 261 *
263 * Return: 0 to the pm core 262 * Return: 0 to the pm core
264 */ 263 */
265static int ish_suspend(struct device *device) 264static int __maybe_unused ish_suspend(struct device *device)
266{ 265{
267 struct pci_dev *pdev = to_pci_dev(device); 266 struct pci_dev *pdev = to_pci_dev(device);
268 struct ishtp_device *dev = pci_get_drvdata(pdev); 267 struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -288,7 +287,7 @@ static int ish_suspend(struct device *device)
288 return 0; 287 return 0;
289} 288}
290 289
291static DECLARE_WORK(resume_work, ish_resume_handler); 290static __maybe_unused DECLARE_WORK(resume_work, ish_resume_handler);
292/** 291/**
293 * ish_resume() - ISH resume callback 292 * ish_resume() - ISH resume callback
294 * @device: device pointer 293 * @device: device pointer
@@ -297,7 +296,7 @@ static DECLARE_WORK(resume_work, ish_resume_handler);
297 * 296 *
298 * Return: 0 to the pm core 297 * Return: 0 to the pm core
299 */ 298 */
300static int ish_resume(struct device *device) 299static int __maybe_unused ish_resume(struct device *device)
301{ 300{
302 struct pci_dev *pdev = to_pci_dev(device); 301 struct pci_dev *pdev = to_pci_dev(device);
303 struct ishtp_device *dev = pci_get_drvdata(pdev); 302 struct ishtp_device *dev = pci_get_drvdata(pdev);
@@ -311,21 +310,14 @@ static int ish_resume(struct device *device)
311 return 0; 310 return 0;
312} 311}
313 312
314static const struct dev_pm_ops ish_pm_ops = { 313static SIMPLE_DEV_PM_OPS(ish_pm_ops, ish_suspend, ish_resume);
315 .suspend = ish_suspend,
316 .resume = ish_resume,
317};
318#define ISHTP_ISH_PM_OPS (&ish_pm_ops)
319#else
320#define ISHTP_ISH_PM_OPS NULL
321#endif /* CONFIG_PM */
322 314
323static struct pci_driver ish_driver = { 315static struct pci_driver ish_driver = {
324 .name = KBUILD_MODNAME, 316 .name = KBUILD_MODNAME,
325 .id_table = ish_pci_tbl, 317 .id_table = ish_pci_tbl,
326 .probe = ish_probe, 318 .probe = ish_probe,
327 .remove = ish_remove, 319 .remove = ish_remove,
328 .driver.pm = ISHTP_ISH_PM_OPS, 320 .driver.pm = &ish_pm_ops,
329}; 321};
330 322
331module_pci_driver(ish_driver); 323module_pci_driver(ish_driver);