Skip to contentSkip to conversation

clk: qcom: gdsc: treat optional supplies as optional

PATCH In review Johan Hovold 5 participants 7 messages Mar 25, 2024 – Mar 26, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: qcom: gdsc: treat optional supplies as optional

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")
---
 drivers/clk/qcom/gdsc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/clk/qcom/gdsc.c +8 -3
index e7a4068b9f39..df9618ab7eea 100644
@@ -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;
Signature · 1 line
2.43.2
#1 lore raw
Quoted 7 lines · 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.

Can this device actually run with the supply physically disconnected?

#2 lore raw
Quoted 11 lines · Mark Brown
Quoted 7 lines · 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.

Can this device actually run with the supply physically disconnected?

On SC8280XP this is supplied via power-domain instead of the supply.

Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
Quoted 7 lines · Dmitry Baryshkov
Quoted 6 lines · Mark Brown
Quoted 4 lines · 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:

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

on SC8280XP.

Can this device actually run with the supply physically disconnected?

On SC8280XP this is supplied via power-domain instead of the supply.

I think Dmitry is asking about this bit:

if (ret != -ENODEV)

	return ret;

which is basically repeating the difference that _optional makes

Konrad

#4 lore raw
Quoted 10 lines · Konrad Dybcio
Quoted 9 lines · Dmitry Baryshkov
Quoted 8 lines · Mark Brown
Quoted 6 lines · 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
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

on SC8280XP.

Can this device actually run with the supply physically disconnected?

On SC8280XP this is supplied via power-domain instead of the supply.

I think Dmitry is asking about this bit:

AFAICT, Dmitry did not ask anything.

Quoted 4 lines

if (ret != -ENODEV)

	return ret;

which is basically repeating the difference that _optional makes

Not sure what you meant by this either. This is how the regulator subsystem works.

Johan

#5 lore raw
In reply to Mark Brown
Quoted 10 lines · Mark Brown
Quoted 7 lines · 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.

Can this device actually run with the supply physically disconnected?

The gpucc-sc8280xp driver is used for both sc8280xp and a couple of derivative platforms. AFAIU only the latter use this supply, but the driver unfortunately currently cannot tell which platform it runs on and requests the vdd-gfx unconditionally.

An alternative would have been to add new compatible strings for the derivate platforms and only request the regulator for those as I mentioned here:

https://lore.kernel.org/all/[email protected]/

Johan