Skip to content

Commit 43b6bf4

Browse files
saschahauerbroonie
authored andcommitted
spi: imx: fix runtime pm support for !CONFIG_PM
525c9e5 introduced pm_runtime support for the i.MX SPI driver. With this pm_runtime is used to bring up the clocks initially. When CONFIG_PM is disabled the clocks are no longer enabled and the driver doesn't work anymore. Fix this by enabling the clocks in the probe function and telling pm_runtime that the device is active using pm_runtime_set_active(). Fixes: 525c9e5 spi: imx: enable runtime pm support Tested-by: Christian Eggers <ceggers@arri.de> [tested for !CONFIG_PM only] Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.kernel.org/r/20201021104513.21560-1-s.hauer@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 855a40c commit 43b6bf4

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

drivers/spi/spi-imx.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,15 +1676,18 @@ static int spi_imx_probe(struct platform_device *pdev)
16761676
goto out_master_put;
16771677
}
16781678

1679-
pm_runtime_enable(spi_imx->dev);
1679+
ret = clk_prepare_enable(spi_imx->clk_per);
1680+
if (ret)
1681+
goto out_master_put;
1682+
1683+
ret = clk_prepare_enable(spi_imx->clk_ipg);
1684+
if (ret)
1685+
goto out_put_per;
1686+
16801687
pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
16811688
pm_runtime_use_autosuspend(spi_imx->dev);
1682-
1683-
ret = pm_runtime_get_sync(spi_imx->dev);
1684-
if (ret < 0) {
1685-
dev_err(spi_imx->dev, "failed to enable clock\n");
1686-
goto out_runtime_pm_put;
1687-
}
1689+
pm_runtime_set_active(spi_imx->dev);
1690+
pm_runtime_enable(spi_imx->dev);
16881691

16891692
spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
16901693
/*
@@ -1719,8 +1722,12 @@ static int spi_imx_probe(struct platform_device *pdev)
17191722

17201723
out_runtime_pm_put:
17211724
pm_runtime_dont_use_autosuspend(spi_imx->dev);
1722-
pm_runtime_put_sync(spi_imx->dev);
1725+
pm_runtime_set_suspended(&pdev->dev);
17231726
pm_runtime_disable(spi_imx->dev);
1727+
1728+
clk_disable_unprepare(spi_imx->clk_ipg);
1729+
out_put_per:
1730+
clk_disable_unprepare(spi_imx->clk_per);
17241731
out_master_put:
17251732
spi_master_put(master);
17261733

0 commit comments

Comments
 (0)