Skip to content

Commit 6158b94

Browse files
lumagbebarino
authored andcommitted
clk: qcom: dispcc-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 a3bb8a7 commit 6158b94

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

drivers/clk/qcom/dispcc-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
#include <linux/reset-controller.h>
1112

@@ -1228,13 +1229,31 @@ static const struct of_device_id disp_cc_sm8250_match_table[] = {
12281229
};
12291230
MODULE_DEVICE_TABLE(of, disp_cc_sm8250_match_table);
12301231

1232+
static void disp_cc_sm8250_pm_runtime_disable(void *data)
1233+
{
1234+
pm_runtime_disable(data);
1235+
}
1236+
12311237
static int disp_cc_sm8250_probe(struct platform_device *pdev)
12321238
{
12331239
struct regmap *regmap;
1240+
int ret;
1241+
1242+
pm_runtime_enable(&pdev->dev);
1243+
1244+
ret = devm_add_action_or_reset(&pdev->dev, disp_cc_sm8250_pm_runtime_disable, &pdev->dev);
1245+
if (ret)
1246+
return ret;
1247+
1248+
ret = pm_runtime_resume_and_get(&pdev->dev);
1249+
if (ret)
1250+
return ret;
12341251

12351252
regmap = qcom_cc_map(pdev, &disp_cc_sm8250_desc);
1236-
if (IS_ERR(regmap))
1253+
if (IS_ERR(regmap)) {
1254+
pm_runtime_put(&pdev->dev);
12371255
return PTR_ERR(regmap);
1256+
}
12381257

12391258
/* note: trion == lucid, except for the prepare() op */
12401259
BUILD_BUG_ON(CLK_ALPHA_PLL_TYPE_TRION != CLK_ALPHA_PLL_TYPE_LUCID);
@@ -1259,7 +1278,11 @@ static int disp_cc_sm8250_probe(struct platform_device *pdev)
12591278
/* DISP_CC_XO_CLK always-on */
12601279
regmap_update_bits(regmap, 0x605c, BIT(0), BIT(0));
12611280

1262-
return qcom_cc_really_probe(pdev, &disp_cc_sm8250_desc, regmap);
1281+
ret = qcom_cc_really_probe(pdev, &disp_cc_sm8250_desc, regmap);
1282+
1283+
pm_runtime_put(&pdev->dev);
1284+
1285+
return ret;
12631286
}
12641287

12651288
static struct platform_driver disp_cc_sm8250_driver = {

0 commit comments

Comments
 (0)