static int mei_me_pm_runtime_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct mei_device *dev; int ret; dev_dbg(&pdev->dev, "rpm: me: runtime suspend\n"); dev = pci_get_drvdata(pdev); if (!dev) return -ENODEV; mutex_lock(&dev->device_lock); if (mei_write_is_idle(dev)) ret = mei_me_pg_set_sync(dev); else ret = -EAGAIN; mutex_unlock(&dev->device_lock); dev_dbg(&pdev->dev, "rpm: me: runtime suspend ret=%d\n", ret); return ret; }
static int mei_txe_pm_runtime_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct mei_device *dev; int ret; dev_dbg(&pdev->dev, "rpm: txe: runtime suspend\n"); dev = pci_get_drvdata(pdev); if (!dev) return -ENODEV; mutex_lock(&dev->device_lock); if (mei_write_is_idle(dev)) ret = mei_txe_aliveness_set_sync(dev, 0); else ret = -EAGAIN; /* * If everything is okay we're about to enter PCI low * power state therefor we need to save and disable * the interrupts towards host. * However if device is not wakeable we cannot do that */ if (!ret && pci_dev_run_wake(pdev)) mei_txe_intr_save(dev); dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret); mutex_unlock(&dev->device_lock); return ret; }
static int mei_me_pm_runtime_idle(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct mei_device *dev; dev_dbg(&pdev->dev, "rpm: me: runtime_idle\n"); dev = pci_get_drvdata(pdev); if (!dev) return -ENODEV; if (mei_write_is_idle(dev)) pm_runtime_autosuspend(device); return -EBUSY; }
static int mei_txe_pm_runtime_idle(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct mei_device *dev; dev_dbg(&pdev->dev, "rpm: txe: runtime_idle\n"); dev = pci_get_drvdata(pdev); if (!dev) return -ENODEV; if (mei_write_is_idle(dev)) pm_schedule_suspend(device, MEI_TXI_RPM_TIMEOUT * 2); return -EBUSY; }
static int mei_txe_pm_runtime_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); struct mei_device *dev; int ret; dev_dbg(&pdev->dev, "rpm: txe: runtime suspend\n"); dev = pci_get_drvdata(pdev); if (!dev) return -ENODEV; mutex_lock(&dev->device_lock); if (mei_write_is_idle(dev)) ret = mei_txe_aliveness_set_sync(dev, 0); else ret = -EAGAIN; /* * If everything is okay we're about to enter PCI low * power state (D3) therefor we need to disable the * interrupts towards host. * However if device is not wakeable we do not enter * D-low state and we need to keep the interrupt kicking */ if (!ret && pci_dev_run_wake(pdev)) mei_disable_interrupts(dev); dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret); mutex_unlock(&dev->device_lock); if (ret && ret != -EAGAIN) schedule_work(&dev->reset_work); return ret; }