Patch "spi: imx: fix runtime pm support for !CONFIG_PM" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    spi: imx: fix runtime pm support for !CONFIG_PM

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     spi-imx-fix-runtime-pm-support-for-config_pm.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ebf9fb3dbbbcf9b66cd578ab8da5cc2992fa15a4
Author: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Date:   Wed Oct 21 12:45:13 2020 +0200

    spi: imx: fix runtime pm support for !CONFIG_PM
    
    [ Upstream commit 43b6bf406cd0319e522638f97c9086b7beebaeaa ]
    
    525c9e5a32bd 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: 525c9e5a32bd spi: imx: enable runtime pm support
    Tested-by: Christian Eggers <ceggers@xxxxxxx> [tested for !CONFIG_PM only]
    Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20201021104513.21560-1-s.hauer@xxxxxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index e38e5ad3c7068..9aac515b718c8 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1674,15 +1674,18 @@ static int spi_imx_probe(struct platform_device *pdev)
 		goto out_master_put;
 	}
 
-	pm_runtime_enable(spi_imx->dev);
+	ret = clk_prepare_enable(spi_imx->clk_per);
+	if (ret)
+		goto out_master_put;
+
+	ret = clk_prepare_enable(spi_imx->clk_ipg);
+	if (ret)
+		goto out_put_per;
+
 	pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
 	pm_runtime_use_autosuspend(spi_imx->dev);
-
-	ret = pm_runtime_get_sync(spi_imx->dev);
-	if (ret < 0) {
-		dev_err(spi_imx->dev, "failed to enable clock\n");
-		goto out_runtime_pm_put;
-	}
+	pm_runtime_set_active(spi_imx->dev);
+	pm_runtime_enable(spi_imx->dev);
 
 	spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
 	/*
@@ -1722,8 +1725,12 @@ out_bitbang_start:
 		spi_imx_sdma_exit(spi_imx);
 out_runtime_pm_put:
 	pm_runtime_dont_use_autosuspend(spi_imx->dev);
-	pm_runtime_put_sync(spi_imx->dev);
+	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_disable(spi_imx->dev);
+
+	clk_disable_unprepare(spi_imx->clk_ipg);
+out_put_per:
+	clk_disable_unprepare(spi_imx->clk_per);
 out_master_put:
 	spi_master_put(master);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux