Skip to content

Commit a91c483

Browse files
lumagbebarino
authored andcommitted
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 <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 6158b94 commit a91c483

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

drivers/clk/qcom/videocc-sm8250.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/clk-provider.h>
77
#include <linux/module.h>
88
#include <linux/platform_device.h>
9+
#include <linux/pm_runtime.h>
910
#include <linux/regmap.h>
1011

1112
#include <dt-bindings/clock/qcom,videocc-sm8250.h>
@@ -364,13 +365,31 @@ static const struct of_device_id video_cc_sm8250_match_table[] = {
364365
};
365366
MODULE_DEVICE_TABLE(of, video_cc_sm8250_match_table);
366367

368+
static void video_cc_sm8250_pm_runtime_disable(void *data)
369+
{
370+
pm_runtime_disable(data);
371+
}
372+
367373
static int video_cc_sm8250_probe(struct platform_device *pdev)
368374
{
369375
struct regmap *regmap;
376+
int ret;
377+
378+
pm_runtime_enable(&pdev->dev);
379+
380+
ret = devm_add_action_or_reset(&pdev->dev, video_cc_sm8250_pm_runtime_disable, &pdev->dev);
381+
if (ret)
382+
return ret;
383+
384+
ret = pm_runtime_resume_and_get(&pdev->dev);
385+
if (ret)
386+
return ret;
370387

371388
regmap = qcom_cc_map(pdev, &video_cc_sm8250_desc);
372-
if (IS_ERR(regmap))
389+
if (IS_ERR(regmap)) {
390+
pm_runtime_put(&pdev->dev);
373391
return PTR_ERR(regmap);
392+
}
374393

375394
clk_lucid_pll_configure(&video_pll0, regmap, &video_pll0_config);
376395
clk_lucid_pll_configure(&video_pll1, regmap, &video_pll1_config);
@@ -379,7 +398,11 @@ static int video_cc_sm8250_probe(struct platform_device *pdev)
379398
regmap_update_bits(regmap, 0xe58, BIT(0), BIT(0));
380399
regmap_update_bits(regmap, 0xeec, BIT(0), BIT(0));
381400

382-
return qcom_cc_really_probe(pdev, &video_cc_sm8250_desc, regmap);
401+
ret = qcom_cc_really_probe(pdev, &video_cc_sm8250_desc, regmap);
402+
403+
pm_runtime_put(&pdev->dev);
404+
405+
return ret;
383406
}
384407

385408
static struct platform_driver video_cc_sm8250_driver = {

0 commit comments

Comments
 (0)