Commit c8169580 authored by Raymond Tan's avatar Raymond Tan Committed by Mark Brown

spi: dw-pci: Add runtime power management support

Implement pm_runtime hooks at pci driver.
Signed-off-by: default avatarRaymond Tan <raymond.tan@intel.com>
[jarkko.nikula@linux.intel.com: Forward ported on top of
commit 1e695983 ("spi: dw: Add basic runtime PM support")]
Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20191018132131.31608-2-jarkko.nikula@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9c86f12a
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -101,6 +102,11 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -101,6 +102,11 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev_info(&pdev->dev, "found PCI SPI controller(ID: %04x:%04x)\n", dev_info(&pdev->dev, "found PCI SPI controller(ID: %04x:%04x)\n",
pdev->vendor, pdev->device); pdev->vendor, pdev->device);
pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_put_autosuspend(&pdev->dev);
pm_runtime_allow(&pdev->dev);
return 0; return 0;
} }
...@@ -108,6 +114,9 @@ static void spi_pci_remove(struct pci_dev *pdev) ...@@ -108,6 +114,9 @@ static void spi_pci_remove(struct pci_dev *pdev)
{ {
struct dw_spi *dws = pci_get_drvdata(pdev); struct dw_spi *dws = pci_get_drvdata(pdev);
pm_runtime_forbid(&pdev->dev);
pm_runtime_get_noresume(&pdev->dev);
dw_spi_remove_host(dws); dw_spi_remove_host(dws);
pci_free_irq_vectors(pdev); pci_free_irq_vectors(pdev);
} }
......
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