Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: gpucc-sc8280xp: Add runtime PM

The GPU_CC block on SC8280XP is powered by the GFX rail. We need to
ensure that it's enabled to prevent unwanted power collapse.

Enable runtime PM to keep the power flowing only when necessary.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230619-topic-sc8280xp-clk-rpm-v1-1-1e5e1064cdb2@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Konrad Dybcio and committed by
Bjorn Andersson
9bbcb892 4e13c7a5

+17 -2
+17 -2
drivers/clk/qcom/gpucc-sc8280xp.c
··· 7 7 #include <linux/kernel.h> 8 8 #include <linux/module.h> 9 9 #include <linux/platform_device.h> 10 + #include <linux/pm_runtime.h> 10 11 #include <linux/regmap.h> 11 12 12 13 #include <dt-bindings/clock/qcom,gpucc-sc8280xp.h> ··· 425 424 static int gpu_cc_sc8280xp_probe(struct platform_device *pdev) 426 425 { 427 426 struct regmap *regmap; 427 + int ret; 428 + 429 + ret = devm_pm_runtime_enable(&pdev->dev); 430 + if (ret) 431 + return ret; 432 + 433 + ret = pm_runtime_resume_and_get(&pdev->dev); 434 + if (ret) 435 + return ret; 428 436 429 437 regmap = qcom_cc_map(pdev, &gpu_cc_sc8280xp_desc); 430 - if (IS_ERR(regmap)) 438 + if (IS_ERR(regmap)) { 439 + pm_runtime_put(&pdev->dev); 431 440 return PTR_ERR(regmap); 441 + } 432 442 433 443 clk_lucid_pll_configure(&gpu_cc_pll0, regmap, &gpu_cc_pll0_config); 434 444 clk_lucid_pll_configure(&gpu_cc_pll1, regmap, &gpu_cc_pll1_config); ··· 451 439 regmap_update_bits(regmap, 0x1170, BIT(0), BIT(0)); 452 440 regmap_update_bits(regmap, 0x109c, BIT(0), BIT(0)); 453 441 454 - return qcom_cc_really_probe(pdev, &gpu_cc_sc8280xp_desc, regmap); 442 + ret = qcom_cc_really_probe(pdev, &gpu_cc_sc8280xp_desc, regmap); 443 + pm_runtime_put(&pdev->dev); 444 + 445 + return ret; 455 446 } 456 447 457 448 static const struct of_device_id gpu_cc_sc8280xp_match_table[] = {