linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / devfreq: mtk-cci: Handle sram regulator probe deferral
@ 2022-07-13 11:15 AngeloGioacchino Del Regno
  2022-08-23 22:51 ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-07-13 11:15 UTC (permalink / raw)
  To: myungjoo.ham
  Cc: kyungmin.park, cw00.choi, matthias.bgg, lgirdwood, broonie,
	jia-wei.chang, johnson.wang, linux-pm, linux-arm-kernel,
	linux-mediatek, linux-kernel, AngeloGioacchino Del Regno

If the regulator_get_optional()	call for the SRAM regulator returns
a probe deferral, we must bail out and retry probing later: failing
to do this will	produce	unstabilities on platforms requiring the
handling for this regulator.

Fixes: b615b00c42da ("PM / devfreq: mediatek: Introduce MediaTek CCI devfreq driver")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/devfreq/mtk-cci-devfreq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c
index 71abb3fbd042..e5458ada5197 100644
--- a/drivers/devfreq/mtk-cci-devfreq.c
+++ b/drivers/devfreq/mtk-cci-devfreq.c
@@ -291,9 +291,13 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)
 	}
 
 	drv->sram_reg = devm_regulator_get_optional(dev, "sram");
-	if (IS_ERR(drv->sram_reg))
+	if (IS_ERR(drv->sram_reg)) {
+		ret = PTR_ERR(drv->sram_reg);
+		if (ret == -EPROBE_DEFER)
+			goto out_free_resources;
+
 		drv->sram_reg = NULL;
-	else {
+	} else {
 		ret = regulator_enable(drv->sram_reg);
 		if (ret) {
 			dev_err(dev, "failed to enable sram regulator\n");
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM / devfreq: mtk-cci: Handle sram regulator probe deferral
  2022-07-13 11:15 [PATCH] PM / devfreq: mtk-cci: Handle sram regulator probe deferral AngeloGioacchino Del Regno
@ 2022-08-23 22:51 ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2022-08-23 22:51 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, myungjoo.ham
  Cc: kyungmin.park, cw00.choi, matthias.bgg, lgirdwood, broonie,
	jia-wei.chang, johnson.wang, linux-pm, linux-arm-kernel,
	linux-mediatek, linux-kernel

On 22. 7. 13. 20:15, AngeloGioacchino Del Regno wrote:
> If the regulator_get_optional()	call for the SRAM regulator returns
> a probe deferral, we must bail out and retry probing later: failing
> to do this will	produce	unstabilities on platforms requiring the
> handling for this regulator.
> 
> Fixes: b615b00c42da ("PM / devfreq: mediatek: Introduce MediaTek CCI devfreq driver")
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/devfreq/mtk-cci-devfreq.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c
> index 71abb3fbd042..e5458ada5197 100644
> --- a/drivers/devfreq/mtk-cci-devfreq.c
> +++ b/drivers/devfreq/mtk-cci-devfreq.c
> @@ -291,9 +291,13 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)
>  	}
>  
>  	drv->sram_reg = devm_regulator_get_optional(dev, "sram");
> -	if (IS_ERR(drv->sram_reg))
> +	if (IS_ERR(drv->sram_reg)) {
> +		ret = PTR_ERR(drv->sram_reg);
> +		if (ret == -EPROBE_DEFER)
> +			goto out_free_resources;
> +
>  		drv->sram_reg = NULL;
> -	else {
> +	} else {
>  		ret = regulator_enable(drv->sram_reg);
>  		if (ret) {
>  			dev_err(dev, "failed to enable sram regulator\n");

Applied it. Thanks

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-23 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 11:15 [PATCH] PM / devfreq: mtk-cci: Handle sram regulator probe deferral AngeloGioacchino Del Regno
2022-08-23 22:51 ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).