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

clk: qcom: videocc-sm8250: use runtime PM for the clock controller

On sm8250 dispcc and videocc registers are powered up by the MMCX power
domain. Use runtime PM calls to make sure that required power domain is
powered on while we access clock controller's registers.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210829154757.784699-5-dmitry.baryshkov@linaro.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Dmitry Baryshkov and committed by
Stephen Boyd
a91c483b 6158b94e

+25 -2
+25 -2
drivers/clk/qcom/videocc-sm8250.c
··· 6 6 #include <linux/clk-provider.h> 7 7 #include <linux/module.h> 8 8 #include <linux/platform_device.h> 9 + #include <linux/pm_runtime.h> 9 10 #include <linux/regmap.h> 10 11 11 12 #include <dt-bindings/clock/qcom,videocc-sm8250.h> ··· 365 364 }; 366 365 MODULE_DEVICE_TABLE(of, video_cc_sm8250_match_table); 367 366 367 + static void video_cc_sm8250_pm_runtime_disable(void *data) 368 + { 369 + pm_runtime_disable(data); 370 + } 371 + 368 372 static int video_cc_sm8250_probe(struct platform_device *pdev) 369 373 { 370 374 struct regmap *regmap; 375 + int ret; 376 + 377 + pm_runtime_enable(&pdev->dev); 378 + 379 + ret = devm_add_action_or_reset(&pdev->dev, video_cc_sm8250_pm_runtime_disable, &pdev->dev); 380 + if (ret) 381 + return ret; 382 + 383 + ret = pm_runtime_resume_and_get(&pdev->dev); 384 + if (ret) 385 + return ret; 371 386 372 387 regmap = qcom_cc_map(pdev, &video_cc_sm8250_desc); 373 - if (IS_ERR(regmap)) 388 + if (IS_ERR(regmap)) { 389 + pm_runtime_put(&pdev->dev); 374 390 return PTR_ERR(regmap); 391 + } 375 392 376 393 clk_lucid_pll_configure(&video_pll0, regmap, &video_pll0_config); 377 394 clk_lucid_pll_configure(&video_pll1, regmap, &video_pll1_config); ··· 398 379 regmap_update_bits(regmap, 0xe58, BIT(0), BIT(0)); 399 380 regmap_update_bits(regmap, 0xeec, BIT(0), BIT(0)); 400 381 401 - return qcom_cc_really_probe(pdev, &video_cc_sm8250_desc, regmap); 382 + ret = qcom_cc_really_probe(pdev, &video_cc_sm8250_desc, regmap); 383 + 384 + pm_runtime_put(&pdev->dev); 385 + 386 + return ret; 402 387 } 403 388 404 389 static struct platform_driver video_cc_sm8250_driver = {