未验证 提交 1e695983 编写于 作者: P Phil Edworthy 提交者: Mark Brown

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: NPhil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: NGareth Williams <gareth.williams.jx@renesas.com>
Link: https://lore.kernel.org/r/1568793876-9009-4-git-send-email-gareth.williams.jx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 47cf13bc
......@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/highmem.h>
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
......@@ -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 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册