Linux clock framework development
 help / color / mirror / Atom feed
* [PATCH] clk: qcom: gdsc: treat optional supplies as optional
@ 2024-03-25  8:19 Johan Hovold
  2024-03-25 14:01 ` Mark Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Johan Hovold @ 2024-03-25  8:19 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Konrad Dybcio, Michael Turquette, Stephen Boyd, Liam Girdwood,
	Mark Brown, Dmitry Baryshkov, linux-arm-msm, linux-clk,
	linux-kernel, Johan Hovold

Since commit deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external
supply for GX gdsc") the GDSC supply must be treated as optional to
avoid warnings like:

	gpu_cc-sc8280xp 3d90000.clock-controller: supply vdd-gfx not found, using dummy regulator

on SC8280XP.

Fortunately, the driver is already prepared to handle this by checking
that the regulator pointer is non-NULL before use.

This also avoids triggering a potential deadlock on SC8280XP even if the
underlying issue still remains for the derivative platforms like SA8295P
that actually use the supply.

Fixes: deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external supply for GX gdsc")
Link: https://lore.kernel.org/lkml/Zf25Sv2x9WaCFuIH@hovoldconsulting.com/
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/clk/qcom/gdsc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index e7a4068b9f39..df9618ab7eea 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -487,9 +487,14 @@ int gdsc_register(struct gdsc_desc *desc,
 		if (!scs[i] || !scs[i]->supply)
 			continue;
 
-		scs[i]->rsupply = devm_regulator_get(dev, scs[i]->supply);
-		if (IS_ERR(scs[i]->rsupply))
-			return PTR_ERR(scs[i]->rsupply);
+		scs[i]->rsupply = devm_regulator_get_optional(dev, scs[i]->supply);
+		if (IS_ERR(scs[i]->rsupply)) {
+			ret = PTR_ERR(scs[i]->rsupply);
+			if (ret != -ENODEV)
+				return ret;
+
+			scs[i]->rsupply = NULL;
+		}
 	}
 
 	data->num_domains = num;
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [PATCH] clk: qcom: gdsc: treat optional supplies as optional
@ 2024-03-25  8:58 Johan Hovold
  2024-03-25 14:02 ` Bjorn Andersson
  2024-04-04 21:22 ` Bjorn Andersson
  0 siblings, 2 replies; 12+ messages in thread
From: Johan Hovold @ 2024-03-25  8:58 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Konrad Dybcio, Michael Turquette, Stephen Boyd, Liam Girdwood,
	Mark Brown, Dmitry Baryshkov, linux-arm-msm, linux-clk,
	linux-kernel, Johan Hovold

Since commit deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external
supply for GX gdsc") the GDSC supply must be treated as optional to
avoid warnings like:

	gpu_cc-sc8280xp 3d90000.clock-controller: supply vdd-gfx not found, using dummy regulator

on SC8280XP.

Fortunately, the driver is already prepared to handle this by checking
that the regulator pointer is non-NULL before use.

This also avoids triggering a potential deadlock on SC8280XP even if the
underlying issue still remains for the derivative platforms like SA8295P
that actually use the supply.

Fixes: deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external supply for GX gdsc")
Link: https://lore.kernel.org/lkml/Zf25Sv2x9WaCFuIH@hovoldconsulting.com/
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/clk/qcom/gdsc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index e7a4068b9f39..df9618ab7eea 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -487,9 +487,14 @@ int gdsc_register(struct gdsc_desc *desc,
 		if (!scs[i] || !scs[i]->supply)
 			continue;
 
-		scs[i]->rsupply = devm_regulator_get(dev, scs[i]->supply);
-		if (IS_ERR(scs[i]->rsupply))
-			return PTR_ERR(scs[i]->rsupply);
+		scs[i]->rsupply = devm_regulator_get_optional(dev, scs[i]->supply);
+		if (IS_ERR(scs[i]->rsupply)) {
+			ret = PTR_ERR(scs[i]->rsupply);
+			if (ret != -ENODEV)
+				return ret;
+
+			scs[i]->rsupply = NULL;
+		}
 	}
 
 	data->num_domains = num;
-- 
2.43.0


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

end of thread, other threads:[~2024-04-22 18:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25  8:19 [PATCH] clk: qcom: gdsc: treat optional supplies as optional Johan Hovold
2024-03-25 14:01 ` Mark Brown
2024-03-25 14:10   ` Dmitry Baryshkov
2024-03-25 19:21     ` Konrad Dybcio
2024-03-26  7:20       ` Johan Hovold
2024-03-26  7:16   ` Johan Hovold
2024-03-26 11:24     ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2024-03-25  8:58 Johan Hovold
2024-03-25 14:02 ` Bjorn Andersson
2024-04-04 21:22 ` Bjorn Andersson
2024-04-22 10:31   ` Linux regression tracking (Thorsten Leemhuis)
2024-04-22 18:31     ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox