Commit e882575e authored by shengfei Xu's avatar shengfei Xu Committed by Mark Brown

spi: rockchip: Suspend and resume the bus during NOIRQ_SYSTEM_SLEEP_PM ops

the wakeup interrupt handler which is guaranteed not to run while
@resume noirq() is being executed. the patch can help to avoid the
wakeup source try to access spi when the spi is in suspend mode.
Signed-off-by: default avatarshengfei Xu <xsf@rock-chips.com>
Signed-off-by: default avatarJon Lin <jon.lin@rock-chips.com>
Link: https://lore.kernel.org/r/20220216014028.8123-6-jon.lin@rock-chips.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3a4bf922
...@@ -964,14 +964,14 @@ static int rockchip_spi_suspend(struct device *dev) ...@@ -964,14 +964,14 @@ static int rockchip_spi_suspend(struct device *dev)
{ {
int ret; int ret;
struct spi_controller *ctlr = dev_get_drvdata(dev); struct spi_controller *ctlr = dev_get_drvdata(dev);
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
ret = spi_controller_suspend(ctlr); ret = spi_controller_suspend(ctlr);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = pm_runtime_force_suspend(dev); clk_disable_unprepare(rs->spiclk);
if (ret < 0) clk_disable_unprepare(rs->apb_pclk);
return ret;
pinctrl_pm_select_sleep_state(dev); pinctrl_pm_select_sleep_state(dev);
...@@ -986,10 +986,14 @@ static int rockchip_spi_resume(struct device *dev) ...@@ -986,10 +986,14 @@ static int rockchip_spi_resume(struct device *dev)
pinctrl_pm_select_default_state(dev); pinctrl_pm_select_default_state(dev);
ret = pm_runtime_force_resume(dev); ret = clk_prepare_enable(rs->apb_pclk);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = clk_prepare_enable(rs->spiclk);
if (ret < 0)
clk_disable_unprepare(rs->apb_pclk);
ret = spi_controller_resume(ctlr); ret = spi_controller_resume(ctlr);
if (ret < 0) { if (ret < 0) {
clk_disable_unprepare(rs->spiclk); clk_disable_unprepare(rs->spiclk);
...@@ -1031,7 +1035,7 @@ static int rockchip_spi_runtime_resume(struct device *dev) ...@@ -1031,7 +1035,7 @@ static int rockchip_spi_runtime_resume(struct device *dev)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static const struct dev_pm_ops rockchip_spi_pm = { static const struct dev_pm_ops rockchip_spi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume) SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume)
SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend, SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend,
rockchip_spi_runtime_resume, NULL) rockchip_spi_runtime_resume, NULL)
}; };
......
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