diff options
author | Jiri Kosina <jkosina@suse.cz> | 2020-08-10 12:21:59 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2020-08-10 12:21:59 +0300 |
commit | cd6cad553bab964241b4e1e50e33a4df45b23943 (patch) | |
tree | ef5ec38cce8e64990f354dd3df9eee09c7882909 /drivers | |
parent | a66eebd702616850b8b48e72ed4391a2dc0caccc (diff) | |
parent | 7e341061ddd9239f7214fc3abb794f0ed977e259 (diff) | |
download | linux-cd6cad553bab964241b4e1e50e33a4df45b23943.tar.xz |
Merge branch 'for-5.9/intel-ish' into for-linus
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/intel-ish-hid/ipc/pci-ish.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index f491d8b4e24c..c6d48a8648b7 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c @@ -106,6 +106,11 @@ static inline bool ish_should_enter_d0i3(struct pci_dev *pdev) return !pm_suspend_via_firmware() || pdev->device == CHV_DEVICE_ID; } +static inline bool ish_should_leave_d0i3(struct pci_dev *pdev) +{ + return !pm_resume_via_firmware() || pdev->device == CHV_DEVICE_ID; +} + /** * ish_probe() - PCI driver probe callback * @pdev: pci device @@ -215,9 +220,7 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work) struct ishtp_device *dev = pci_get_drvdata(pdev); int ret; - /* Check the NO_D3 flag to distinguish the resume paths */ - if (pdev->dev_flags & PCI_DEV_FLAGS_NO_D3) { - pdev->dev_flags &= ~PCI_DEV_FLAGS_NO_D3; + if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag) { disable_irq_wake(pdev->irq); ishtp_send_resume(dev); @@ -281,8 +284,11 @@ static int __maybe_unused ish_suspend(struct device *device) */ ish_disable_dma(dev); } else { - /* Set the NO_D3 flag, the ISH would enter D0i3 */ - pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3; + /* + * Save state so PCI core will keep the device at D0, + * the ISH would enter D0i3 + */ + pci_save_state(pdev); enable_irq_wake(pdev->irq); } |