Skip to content

Commit 9bbcb89

Browse files
konradybcioandersson
authored andcommitted
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>
1 parent 4e13c7a commit 9bbcb89

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

drivers/clk/qcom/gpucc-sc8280xp.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/kernel.h>
88
#include <linux/module.h>
99
#include <linux/platform_device.h>
10+
#include <linux/pm_runtime.h>
1011
#include <linux/regmap.h>
1112

1213
#include <dt-bindings/clock/qcom,gpucc-sc8280xp.h>
@@ -424,10 +425,21 @@ static struct qcom_cc_desc gpu_cc_sc8280xp_desc = {
424425
static int gpu_cc_sc8280xp_probe(struct platform_device *pdev)
425426
{
426427
struct regmap *regmap;
428+
int ret;
429+
430+
ret = devm_pm_runtime_enable(&pdev->dev);
431+
if (ret)
432+
return ret;
433+
434+
ret = pm_runtime_resume_and_get(&pdev->dev);
435+
if (ret)
436+
return ret;
427437

428438
regmap = qcom_cc_map(pdev, &gpu_cc_sc8280xp_desc);
429-
if (IS_ERR(regmap))
439+
if (IS_ERR(regmap)) {
440+
pm_runtime_put(&pdev->dev);
430441
return PTR_ERR(regmap);
442+
}
431443

432444
clk_lucid_pll_configure(&gpu_cc_pll0, regmap, &gpu_cc_pll0_config);
433445
clk_lucid_pll_configure(&gpu_cc_pll1, regmap, &gpu_cc_pll1_config);
@@ -439,7 +451,10 @@ static int gpu_cc_sc8280xp_probe(struct platform_device *pdev)
439451
regmap_update_bits(regmap, 0x1170, BIT(0), BIT(0));
440452
regmap_update_bits(regmap, 0x109c, BIT(0), BIT(0));
441453

442-
return qcom_cc_really_probe(pdev, &gpu_cc_sc8280xp_desc, regmap);
454+
ret = qcom_cc_really_probe(pdev, &gpu_cc_sc8280xp_desc, regmap);
455+
pm_runtime_put(&pdev->dev);
456+
457+
return ret;
443458
}
444459

445460
static const struct of_device_id gpu_cc_sc8280xp_match_table[] = {

0 commit comments

Comments
 (0)