Commit 2db8edaa authored by Zhang Lixu's avatar Zhang Lixu Committed by Jiri Kosina

HID: intel-ish-hid: ipc: make ish suspend paths clear

For suspend-to-idle, send suspend message and set N0_D3 flag to put
the ISH into D0i3 state.
For suspend-to-mem, disable the DMA bit before ISH entering D3, and
NO_D3 flag is cleared by default, then the ISH would enter D3.
Signed-off-by: default avatarZhang Lixu <lixu.zhang@intel.com>
Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent c1ca58f6
...@@ -223,6 +223,8 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work) ...@@ -223,6 +223,8 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work)
* it means ISH isn't powered off, in this case, send a resume message. * it means ISH isn't powered off, in this case, send a resume message.
*/ */
if (fwsts >= FWSTS_SENSOR_APP_LOADED) { if (fwsts >= FWSTS_SENSOR_APP_LOADED) {
disable_irq_wake(pdev->irq);
ishtp_send_resume(dev); ishtp_send_resume(dev);
/* Waiting to get resume response */ /* Waiting to get resume response */
...@@ -255,10 +257,10 @@ static int __maybe_unused ish_suspend(struct device *device) ...@@ -255,10 +257,10 @@ static int __maybe_unused ish_suspend(struct device *device)
struct pci_dev *pdev = to_pci_dev(device); struct pci_dev *pdev = to_pci_dev(device);
struct ishtp_device *dev = pci_get_drvdata(pdev); struct ishtp_device *dev = pci_get_drvdata(pdev);
enable_irq_wake(pdev->irq); if (ish_should_enter_d0i3(pdev)) {
/* /*
* If previous suspend hasn't been asnwered then ISH is likely dead, * If previous suspend hasn't been asnwered then ISH is likely
* don't attempt nested notification * dead, don't attempt nested notification
*/ */
if (dev->suspend_flag) if (dev->suspend_flag)
return 0; return 0;
...@@ -273,9 +275,18 @@ static int __maybe_unused ish_suspend(struct device *device) ...@@ -273,9 +275,18 @@ static int __maybe_unused ish_suspend(struct device *device)
!dev->suspend_flag, !dev->suspend_flag,
msecs_to_jiffies(25)); msecs_to_jiffies(25));
if (ish_should_enter_d0i3(pdev)) { if (dev->suspend_flag) {
/*
* It looks like FW halt, clear the DMA bit, and put
* ISH into D3, and FW would reset on resume.
*/
ish_disable_dma(dev);
} else {
/* Set the NO_D3 flag, the ISH would enter D0i3 */ /* Set the NO_D3 flag, the ISH would enter D0i3 */
pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3; pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3;
enable_irq_wake(pdev->irq);
}
} else { } else {
/* /*
* Clear the DMA bit before putting ISH into D3, * Clear the DMA bit before putting ISH into D3,
...@@ -304,7 +315,6 @@ static int __maybe_unused ish_resume(struct device *device) ...@@ -304,7 +315,6 @@ static int __maybe_unused ish_resume(struct device *device)
ish_resume_device = device; ish_resume_device = device;
dev->resume_flag = 1; dev->resume_flag = 1;
disable_irq_wake(pdev->irq);
schedule_work(&resume_work); schedule_work(&resume_work);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment