clk: qcom: gpucc-sm6375: Enable runtime pm
authorKonrad Dybcio <konrad.dybcio@linaro.org>
Mon, 29 May 2023 13:14:24 +0000 (15:14 +0200)
committerBjorn Andersson <andersson@kernel.org>
Tue, 13 Jun 2023 23:30:13 +0000 (16:30 -0700)
The GPUCC block on SM6375 is powered by VDD_CX and VDD_GX. If the latter
rail is not online, GX_GDSC will never turn on. Enable runtime pm so that
we can reference VDD_GX from the dt to ensure that.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230529-topic-sm6375gpuccpd-v1-2-8d57c41a6066@linaro.org
drivers/clk/qcom/gpucc-sm6375.c

index d3620344a00968b9471ef1306f51f275946a6f4f..2d863dc3d83bd9b03ef828f4695c5ff8595ff306 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/clk-provider.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 
 #include <dt-bindings/clock/qcom,sm6375-gpucc.h>
@@ -434,15 +435,29 @@ MODULE_DEVICE_TABLE(of, gpucc_sm6375_match_table);
 static int gpucc_sm6375_probe(struct platform_device *pdev)
 {
        struct regmap *regmap;
+       int ret;
+
+       ret = devm_pm_runtime_enable(&pdev->dev);
+       if (ret)
+               return ret;
+
+       ret = pm_runtime_resume_and_get(&pdev->dev);
+       if (ret)
+               return ret;
 
        regmap = qcom_cc_map(pdev, &gpucc_sm6375_desc);
-       if (IS_ERR(regmap))
+       if (IS_ERR(regmap)) {
+               pm_runtime_put(&pdev->dev);
                return PTR_ERR(regmap);
+       }
 
        clk_lucid_pll_configure(&gpucc_pll0, regmap, &gpucc_pll0_config);
        clk_lucid_pll_configure(&gpucc_pll1, regmap, &gpucc_pll1_config);
 
-       return qcom_cc_really_probe(pdev, &gpucc_sm6375_desc, regmap);
+       ret = qcom_cc_really_probe(pdev, &gpucc_sm6375_desc, regmap);
+       pm_runtime_put(&pdev->dev);
+
+       return ret;
 }
 
 static struct platform_driver gpucc_sm6375_driver = {