Skip to content

Commit 5677aa6

Browse files
lixuzhaJiri Kosina
authored andcommitted
HID: intel-ish-hid: ipc: Separate hibernate callbacks in dev_pm_ops
The same suspend and resume callbacks are used for both suspend-to-RAM/idle and hibernation. These callbacks invoke pm_suspend_via_firmware() and pm_resume_via_firmware(), respectively. In the .freeze() of hibernation, pm_suspend_via_firmware() returns false, causing the driver to put ISH into D0i3. However, during the .thaw(), pm_resume_via_firmware() returns true, leading the driver to treat ISH as resuming from D3 instead of D0i3. The asymmetric behavior between .freeze() and .thaw() during hibernation can cause the client connection states on the firmware side and the driver side to become inconsistent. To address the inconsistent client connection states issue, separate hibernate-related callbacks (freeze, thaw) in dev_pm_ops. Since ISH does not need to save any firmware-related state when entering hibernation, it is sufficient to call pci_save_state() in .freeze() to prevent the PCI bus from changing the ISH power state. No actions are required in .thaw(). Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 507561b commit 5677aa6

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,20 @@ static int __maybe_unused ish_resume(struct device *device)
397397
return 0;
398398
}
399399

400-
static SIMPLE_DEV_PM_OPS(ish_pm_ops, ish_suspend, ish_resume);
400+
static int __maybe_unused ish_freeze(struct device *device)
401+
{
402+
struct pci_dev *pdev = to_pci_dev(device);
403+
404+
return pci_save_state(pdev);
405+
}
406+
407+
static const struct dev_pm_ops __maybe_unused ish_pm_ops = {
408+
.suspend = pm_sleep_ptr(ish_suspend),
409+
.resume = pm_sleep_ptr(ish_resume),
410+
.freeze = pm_sleep_ptr(ish_freeze),
411+
.restore = pm_sleep_ptr(ish_resume),
412+
.poweroff = pm_sleep_ptr(ish_suspend),
413+
};
401414

402415
static ssize_t base_version_show(struct device *cdev,
403416
struct device_attribute *attr, char *buf)

0 commit comments

Comments
 (0)