Re: [PATCH v2] clk: qcom: lpasscc: Re-configure the PLL in case lost

From: Stephen Boyd
Date: Wed Oct 14 2020 - 13:06:36 EST


Quoting Douglas Anderson (2020-10-14 08:58:24)
> diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c
> index 228d08f5d26f..ee23eb5b9bf2 100644
> --- a/drivers/clk/qcom/lpasscorecc-sc7180.c
> +++ b/drivers/clk/qcom/lpasscorecc-sc7180.c
> @@ -356,6 +356,25 @@ static const struct qcom_cc_desc lpass_audio_hm_sc7180_desc = {
> .num_gdscs = ARRAY_SIZE(lpass_audio_hm_sc7180_gdscs),
> };
>
> +static int lpass_core_cc_pm_clk_resume(struct device *dev)
> +{
> + struct regmap *regmap = dev_get_drvdata(dev);

Can we use dev_get_remap(dev, NULL) instead?

> + unsigned int l_val;
> + int ret;
> +
> + ret = pm_clk_resume(dev);
> + if (ret)
> + return ret;
> +
> + /* Read PLL_L_VAL */

Please drop this useless comment. Replace it with something like this
(if at all):

/* Reconfigure PLL if PLL was reset across suspend */

> + 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;
> @@ -373,6 +392,8 @@ static int lpass_core_cc_sc7180_probe(struct platform_device *pdev)
> if (IS_ERR(regmap))
> return PTR_ERR(regmap);
>
> + dev_set_drvdata(&pdev->dev, regmap);
> +

And then this isn't needed.

> /*
> * Keep the CLK always-ON
> * LPASS_AUDIO_CORE_SYSNOC_SWAY_CORE_CLK