Message ID | 20201014140507.v3.3.Id0cc5d859e2422082a29a7909658932c857f5a81@changeid |
---|---|
State | New |
Headers | show |
Series | [v3,1/3] clk: qcom: lpasscc-sc7810: Use devm in probe | expand |
Quoting Douglas Anderson (2020-10-14 14:05:23) > diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c > index 48d370e2108e..e12d4c2b1b70 100644 > --- a/drivers/clk/qcom/lpasscorecc-sc7180.c > +++ b/drivers/clk/qcom/lpasscorecc-sc7180.c > @@ -388,6 +388,25 @@ static int lpass_create_pm_clks(struct platform_device *pdev) > return ret; > } > > +static int lpass_core_cc_pm_clk_resume(struct device *dev) > +{ > + struct regmap *regmap = dev_get_regmap(dev, "lpass_core_cc"); Please make "lpass_core_cc" a static const pointer in this driver so that it can be used here and when the regmap is made so that we're certain they match. > + unsigned int l_val; > + int ret; > + > + ret = pm_clk_resume(dev); > + if (ret) > + return ret; > + > + /* If PLL_L_VAL was cleared then we should re-init the whole PLL */ > + regmap_read(regmap, 0x1004, &l_val); > + if (!l_val) > + clk_fabia_pll_configure(&lpass_lpaaudio_dig_pll, regmap, > + &lpass_lpaaudio_dig_pll_config); > + > + return 0; > +} > + > static int lpass_core_cc_sc7180_probe(struct platform_device *pdev) > { > const struct qcom_cc_desc *desc;
diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c index 48d370e2108e..e12d4c2b1b70 100644 --- a/drivers/clk/qcom/lpasscorecc-sc7180.c +++ b/drivers/clk/qcom/lpasscorecc-sc7180.c @@ -388,6 +388,25 @@ static int lpass_create_pm_clks(struct platform_device *pdev) return ret; } +static int lpass_core_cc_pm_clk_resume(struct device *dev) +{ + struct regmap *regmap = dev_get_regmap(dev, "lpass_core_cc"); + unsigned int l_val; + int ret; + + ret = pm_clk_resume(dev); + if (ret) + return ret; + + /* If PLL_L_VAL was cleared then we should re-init the whole PLL */ + regmap_read(regmap, 0x1004, &l_val); + if (!l_val) + clk_fabia_pll_configure(&lpass_lpaaudio_dig_pll, regmap, + &lpass_lpaaudio_dig_pll_config); + + return 0; +} + static int lpass_core_cc_sc7180_probe(struct platform_device *pdev) { const struct qcom_cc_desc *desc; @@ -457,7 +476,7 @@ static const struct of_device_id lpass_core_cc_sc7180_match_table[] = { MODULE_DEVICE_TABLE(of, lpass_core_cc_sc7180_match_table); static const struct dev_pm_ops lpass_core_cc_pm_ops = { - SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL) + SET_RUNTIME_PM_OPS(pm_clk_suspend, lpass_core_cc_pm_clk_resume, NULL) }; static struct platform_driver lpass_core_cc_sc7180_driver = {