From 1e695983251029dc0b0fc516290077539df400ff Mon Sep 17 00:00:00 2001 From: Phil Edworthy Date: Wed, 18 Sep 2019 09:04:35 +0100 Subject: spi: dw: Add basic runtime PM support Enable runtime PM so that the clock used to access the registers in the peripheral is turned on using a clock domain. Signed-off-by: Phil Edworthy Signed-off-by: Gareth Williams Link: https://lore.kernel.org/r/1568793876-9009-4-git-send-email-gareth.williams.jx@renesas.com Signed-off-by: Mark Brown --- drivers/spi/spi-dw.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/spi/spi-dw.c') diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 9a49e073e8b7..54ed6eb3e252 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -493,10 +494,13 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) master->dev.of_node = dev->of_node; master->dev.fwnode = dev->fwnode; master->flags = SPI_MASTER_GPIO_SS; + master->auto_runtime_pm = true; if (dws->set_cs) master->set_cs = dws->set_cs; + pm_runtime_enable(dev); + /* Basic HW init */ spi_hw_init(dev, dws); @@ -525,6 +529,7 @@ err_dma_exit: spi_enable_chip(dws, 0); free_irq(dws->irq, master); err_free_master: + pm_runtime_disable(dev); spi_controller_put(master); return ret; } @@ -539,6 +544,9 @@ void dw_spi_remove_host(struct dw_spi *dws) spi_shutdown_chip(dws); + if (dws->master) + pm_runtime_disable(&dws->master->dev); + free_irq(dws->irq, dws->master); } EXPORT_SYMBOL_GPL(dw_spi_remove_host); -- cgit From 76f0030f367c61d4d1f4b1393ff3d9dc43d20c6a Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Wed, 30 Oct 2019 13:31:37 +0200 Subject: spi: dw: Remove runtime PM enable/disable from common part of the driver Committed version of the commit b9fc2d207e54 ("spi: dw: Move runtime PM enable/disable from common to platform driver part") does not include by some reason changes to drivers/spi/spi-dw.c that were part of the original patch sent to the mailing list. Complete the code move by doing those changes now. Fixes: b9fc2d207e54 ("spi: dw: Move runtime PM enable/disable from common to platform driver part") Cc: Phil Edworthy Signed-off-by: Jarkko Nikula Link: https://lore.kernel.org/r/20191030113137.15459-1-jarkko.nikula@linux.intel.com Signed-off-by: Mark Brown --- drivers/spi/spi-dw.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'drivers/spi/spi-dw.c') diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 54ed6eb3e252..466f5c67843b 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -499,8 +498,6 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) if (dws->set_cs) master->set_cs = dws->set_cs; - pm_runtime_enable(dev); - /* Basic HW init */ spi_hw_init(dev, dws); @@ -529,7 +526,6 @@ err_dma_exit: spi_enable_chip(dws, 0); free_irq(dws->irq, master); err_free_master: - pm_runtime_disable(dev); spi_controller_put(master); return ret; } @@ -544,9 +540,6 @@ void dw_spi_remove_host(struct dw_spi *dws) spi_shutdown_chip(dws); - if (dws->master) - pm_runtime_disable(&dws->master->dev); - free_irq(dws->irq, dws->master); } EXPORT_SYMBOL_GPL(dw_spi_remove_host); -- cgit