提交 c1ee8f3f 编写于 作者: W Wenyou Yang 提交者: Mark Brown

spi/atmel: improve the system suspend/resume functions implementation

To make it cleaner, the system suspend/resume directly call
the runtime suspend/resume functions
and remove the wapper of CONFIG_PM_RUNTIME, CONFIG_PM_SLEEP.
Signed-off-by: NWenyou Yang <wenyou.yang@atmel.com>
Acked-by: NKevin Hilman <khilman@linaro.org>
Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 d0de6ff6
...@@ -1451,11 +1451,30 @@ static int atmel_spi_remove(struct platform_device *pdev) ...@@ -1451,11 +1451,30 @@ static int atmel_spi_remove(struct platform_device *pdev)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
#ifdef CONFIG_PM_SLEEP static int atmel_spi_runtime_suspend(struct device *dev)
static int atmel_spi_suspend(struct device *dev) {
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
clk_disable_unprepare(as->clk);
pinctrl_pm_select_sleep_state(dev);
return 0;
}
static int atmel_spi_runtime_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master); struct atmel_spi *as = spi_master_get_devdata(master);
pinctrl_pm_select_default_state(dev);
return clk_prepare_enable(as->clk);
}
static int atmel_spi_suspend(struct device *dev)
{
struct spi_master *master = dev_get_drvdata(dev);
int ret; int ret;
/* Stop the queue running */ /* Stop the queue running */
...@@ -1465,10 +1484,8 @@ static int atmel_spi_suspend(struct device *dev) ...@@ -1465,10 +1484,8 @@ static int atmel_spi_suspend(struct device *dev)
return ret; return ret;
} }
if (!pm_runtime_suspended(dev)) { if (!pm_runtime_suspended(dev))
clk_disable_unprepare(as->clk); atmel_spi_runtime_suspend(dev);
pinctrl_pm_select_sleep_state(dev);
}
return 0; return 0;
} }
...@@ -1476,12 +1493,10 @@ static int atmel_spi_suspend(struct device *dev) ...@@ -1476,12 +1493,10 @@ static int atmel_spi_suspend(struct device *dev)
static int atmel_spi_resume(struct device *dev) static int atmel_spi_resume(struct device *dev)
{ {
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
int ret; int ret;
if (!pm_runtime_suspended(dev)) { if (!pm_runtime_suspended(dev)) {
pinctrl_pm_select_default_state(dev); ret = atmel_spi_runtime_resume(dev);
ret = clk_prepare_enable(as->clk);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -1493,30 +1508,6 @@ static int atmel_spi_resume(struct device *dev) ...@@ -1493,30 +1508,6 @@ static int atmel_spi_resume(struct device *dev)
return ret; return ret;
} }
#endif
#ifdef CONFIG_PM_RUNTIME
static int atmel_spi_runtime_suspend(struct device *dev)
{
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
clk_disable_unprepare(as->clk);
pinctrl_pm_select_sleep_state(dev);
return 0;
}
static int atmel_spi_runtime_resume(struct device *dev)
{
struct spi_master *master = dev_get_drvdata(dev);
struct atmel_spi *as = spi_master_get_devdata(master);
pinctrl_pm_select_default_state(dev);
return clk_prepare_enable(as->clk);
}
#endif
static const struct dev_pm_ops atmel_spi_pm_ops = { static const struct dev_pm_ops atmel_spi_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(atmel_spi_suspend, atmel_spi_resume) SET_SYSTEM_SLEEP_PM_OPS(atmel_spi_suspend, atmel_spi_resume)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册