Skip to content

Commit cd6cad5

Browse files
author
Jiri Kosina
committed
Merge branch 'for-5.9/intel-ish' into for-linus
2 parents a66eebd + 7e34106 commit cd6cad5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/hid/intel-ish-hid/ipc/pci-ish.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ static inline bool ish_should_enter_d0i3(struct pci_dev *pdev)
106106
return !pm_suspend_via_firmware() || pdev->device == CHV_DEVICE_ID;
107107
}
108108

109+
static inline bool ish_should_leave_d0i3(struct pci_dev *pdev)
110+
{
111+
return !pm_resume_via_firmware() || pdev->device == CHV_DEVICE_ID;
112+
}
113+
109114
/**
110115
* ish_probe() - PCI driver probe callback
111116
* @pdev: pci device
@@ -215,9 +220,7 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work)
215220
struct ishtp_device *dev = pci_get_drvdata(pdev);
216221
int ret;
217222

218-
/* Check the NO_D3 flag to distinguish the resume paths */
219-
if (pdev->dev_flags & PCI_DEV_FLAGS_NO_D3) {
220-
pdev->dev_flags &= ~PCI_DEV_FLAGS_NO_D3;
223+
if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag) {
221224
disable_irq_wake(pdev->irq);
222225

223226
ishtp_send_resume(dev);
@@ -281,8 +284,11 @@ static int __maybe_unused ish_suspend(struct device *device)
281284
*/
282285
ish_disable_dma(dev);
283286
} else {
284-
/* Set the NO_D3 flag, the ISH would enter D0i3 */
285-
pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3;
287+
/*
288+
* Save state so PCI core will keep the device at D0,
289+
* the ISH would enter D0i3
290+
*/
291+
pci_save_state(pdev);
286292

287293
enable_irq_wake(pdev->irq);
288294
}

0 commit comments

Comments
 (0)