Skip to contentSkip to conversation

clk: qcom: gpucc-sc8280xp: fix GX external supply lookup

PATCH In review Johan Hovold 5 participants 13 messages Mar 26, 2024 – Mar 28, 2024

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

cover clk: qcom: gpucc-sc8280xp: fix GX external supply lookup

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

This series adds a new SA8540P GPU clock controller compatible which can be used to determine whether to look up the external supply.

This specifically avoids warnings such as:

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

on SC8280XP, which were introduced in 6.9-rc1.

Note that this also avoids triggering a potential deadlock on SC8280XP even if the underlying issue still remains for the derivative platforms like SA8540P and SA8295P that actually use the supply. [1]

Also note that this is a better alternative to simply making the external supply optional as that would suppress any warnings about missing supplies on platforms that actually require it. This series therefore supersedes [2].

Johan

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/

Johan Hovold (5):
dt-bindings: clock: qcom: add SA8540P gpucc
arm64: dts: qcom: sa8540p: use sa8540p gpucc compatible
clk: qcom: gpucc-sc8280xp: make cc descriptor const
clk: qcom: gpucc-sc8280xp: fix GX external supply lookup
arm64: dts: qcom: sa8540p: drop fallback gpucc compatible

 .../devicetree/bindings/clock/qcom,gpucc.yaml |  1 +
 arch/arm64/boot/dts/qcom/sa8540p.dtsi         |  2 +
 drivers/clk/qcom/gpucc-sc8280xp.c             | 42 ++++++++++++++++---
 3 files changed, 39 insertions(+), 6 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/5 dt-bindings: clock: qcom: add SA8540P gpucc

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Add a new compatible string for the SA8540P GPU clock controller so that the OS can determine which resources to look for.

Fixes e60b95d2b687 ("dt-bindings: clock: qcom: Allow VDD_GFX supply to GX")
---
 Documentation/devicetree/bindings/clock/qcom,gpucc.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +1 -0
index f57aceddac6b..5b385e4976b6 100644
@@ -28,6 +28,7 @@ properties:
   compatible:
     enum:
       - qcom,sdm845-gpucc
+      - qcom,sa8540p-gpucc
       - qcom,sa8775p-gpucc
       - qcom,sc7180-gpucc
       - qcom,sc7280-gpucc
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/5] dt-bindings: clock: qcom: add SA8540P gpucc

Quoted 7 lines · Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Add a new compatible string for the SA8540P GPU clock controller so that the OS can determine which resources to look for.

Fixes e60b95d2b687 ("dt-bindings: clock: qcom: Allow VDD_GFX supply to GX")

I don't get why adding new device support is a fix. Commit msg did not help me to understand it.

Quoted 10 lines
---
 Documentation/devicetree/bindings/clock/qcom,gpucc.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +0 -0
index f57aceddac6b..5b385e4976b6 100644

Documentation/devicetree/bindings/clock/qcom,gpucc.yaml properties: · line 31

Quoted 4 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +1 -0
@@ -28,6 +28,7 @@ properties:
   compatible:
     enum:
       - qcom,sdm845-gpucc
+      - qcom,sa8540p-gpucc

This looks fine and pretty trivial, but I really do not understand why skipping our list for automated testing.

<standard letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline), work on fork of kernel (don't, instead use mainline) or you ignore some maintainers (really don't). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.

Please kindly resend and include all necessary To/Cc entries. </standard letter>

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH 1/5] dt-bindings: clock: qcom: add SA8540P gpucc

Quoted 11 lines · Krzysztof Kozlowski
Quoted 7 lines · Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Add a new compatible string for the SA8540P GPU clock controller so that the OS can determine which resources to look for.

Fixes e60b95d2b687 ("dt-bindings: clock: qcom: Allow VDD_GFX supply to GX")

I don't get why adding new device support is a fix. Commit msg did not help me to understand it.

Yeah, perhaps I could have expanded on the problem a bit more here.

Hopefully it's clear if you look at the cover letter, but the commit referred to above should have added a new compatible for SA8540P which uses the new supply so that the OS can determine when it should try to look it up and when it is required.

The Fixes tag can also be dropped, I admit this is not clear-cut.

Quoted 19 lines
Quoted 10 lines
---
 Documentation/devicetree/bindings/clock/qcom,gpucc.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +0 -0
index f57aceddac6b..5b385e4976b6 100644

Documentation/devicetree/bindings/clock/qcom,gpucc.yaml properties: · line 31

Quoted 4 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +1 -0
@@ -28,6 +28,7 @@ properties:
   compatible:
     enum:
       - qcom,sdm845-gpucc
+      - qcom,sa8540p-gpucc

This looks fine and pretty trivial, but I really do not understand why skipping our list for automated testing.

<standard letter>

...

Quoted 1 line

</standard letter>

Spare me the rant. This was obviously a mistake from reusing and manually amending a git-send-email command from shell history and failing to notice that this series also should have been CCed the devicetree list.

Johan

#4 lore raw

Re: [PATCH 1/5] dt-bindings: clock: qcom: add SA8540P gpucc

Quoted 13 lines · Johan Hovold
Quoted 11 lines · Krzysztof Kozlowski
Quoted 7 lines · Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Add a new compatible string for the SA8540P GPU clock controller so that the OS can determine which resources to look for.

Fixes e60b95d2b687 ("dt-bindings: clock: qcom: Allow VDD_GFX supply to GX")

I don't get why adding new device support is a fix. Commit msg did not help me to understand it.

Quoted 8 lines

Yeah, perhaps I could have expanded on the problem a bit more here.

Hopefully it's clear if you look at the cover letter, but the commit referred to above should have added a new compatible for SA8540P which uses the new supply so that the OS can determine when it should try to look it up and when it is required.

The Fixes tag can also be dropped, I admit this is not clear-cut.

Some sort of short explanation would be good in the commit msg, so Fixes can stay.

Quoted 19 lines
Quoted 19 lines
Quoted 11 lines
---
 Documentation/devicetree/bindings/clock/qcom,gpucc.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +0 -0
index f57aceddac6b..5b385e4976b6 100644

Documentation/devicetree/bindings/clock/qcom,gpucc.yaml properties: · line 31

Quoted 4 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +1 -0
@@ -28,6 +28,7 @@ properties:
   compatible:
     enum:
       - qcom,sdm845-gpucc
+      - qcom,sa8540p-gpucc

This looks fine and pretty trivial, but I really do not understand why skipping our list for automated testing.

Quoted 8 lines
Quoted 1 line

<standard letter>

...

Quoted 1 line

</standard letter>

Spare me the rant. This was obviously a mistake from reusing and manually amending a git-send-email command from shell history and failing to notice that this series also should have been CCed the devicetree list.

That's not a rant but a template. :) You know, some people don't Cc DT list on purpose, claiming "it is trivial patch and I already Cc'ed other mailing lists". I don't know what was the reason here.

I forgot one more template to add:

P.S. This review might include comments based on templates. My intention is not to offend or patronize but streamline my review process. Thank you for understanding.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH 1/5] dt-bindings: clock: qcom: add SA8540P gpucc

Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Johan Hovold
Quoted 11 lines · Krzysztof Kozlowski
Quoted 7 lines · Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Add a new compatible string for the SA8540P GPU clock controller so that the OS can determine which resources to look for.

Fixes e60b95d2b687 ("dt-bindings: clock: qcom: Allow VDD_GFX supply to GX")

I don't get why adding new device support is a fix. Commit msg did not help me to understand it.

Yeah, perhaps I could have expanded on the problem a bit more here.

Hopefully it's clear if you look at the cover letter, but the commit referred to above should have added a new compatible for SA8540P which uses the new supply so that the OS can determine when it should try to look it up and when it is required.

Quoted 4 lines
Quoted 1 line

The Fixes tag can also be dropped, I admit this is not clear-cut.

Some sort of short explanation would be good in the commit msg, so Fixes can stay.

There is an explanation in the commit message, but I agree that it could be expanded.

After talking to Bjorn about this yesterday, he convinced me that simply treating the supply as optional is the right thing to do here.

Apparently it is possible to us an external supply also on sc8280xp. There's more to the story, and I don't have access to the documentation, but we'll go with the simpler:

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

for now.

Johan

#6 lore raw

PATCH 2/5 arm64: dts: qcom: sa8540p: use sa8540p gpucc compatible

In reply to Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Use the new SA8540P compatible string for the GPU clock controller so that the OS can determine which resources to look for.

Note that a fallback SC8280XP compatible is added temporarily to avoid any temporary regressions for sa8295p-adp.

Fixes fd5821a1a83c ("arm64: dts: qcom: sa8540p: Drop gfx.lvl as power-domain for gpucc")
---
 arch/arm64/boot/dts/qcom/sa8540p.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sa8540p.dtsi +2 -0
index 23888029cc11..3b31a9ea3492 100644
@@ -168,6 +168,8 @@ opp-2592000000 {
 };
 
 &gpucc {
+	compatible = "qcom,sa8540p-gpucc", "qcom,sc8280xp-gpucc";
+
 	/* SA8295P and SA8540P doesn't provide gfx.lvl */
 	/delete-property/ power-domains;
 
Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sa8540p: use sa8540p gpucc compatible

Quoted 20 lines · Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Use the new SA8540P compatible string for the GPU clock controller so that the OS can determine which resources to look for.

Note that a fallback SC8280XP compatible is added temporarily to avoid any temporary regressions for sa8295p-adp.

Fixes fd5821a1a83c ("arm64: dts: qcom: sa8540p: Drop gfx.lvl as power-domain for gpucc")
---
 arch/arm64/boot/dts/qcom/sa8540p.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sa8540p.dtsi +0 -0
index 23888029cc11..3b31a9ea3492 100644

arch/arm64/boot/dts/qcom/sa8540p.dtsi opp-2592000000 { · line 171

Quoted 4 lines
arch/arm64/boot/dts/qcom/sa8540p.dtsi +1 -0
@@ -168,6 +168,8 @@ opp-2592000000 {
 };
 
 &gpucc {
+	compatible = "qcom,sa8540p-gpucc", "qcom,sc8280xp-gpucc";

This introduces new dtbs_check failures. Please fix the binding and drop the last patch in the series.

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH 2/5] arm64: dts: qcom: sa8540p: use sa8540p gpucc compatible

Quoted 23 lines · Krzysztof Kozlowski
Quoted 22 lines · Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Use the new SA8540P compatible string for the GPU clock controller so that the OS can determine which resources to look for.

Note that a fallback SC8280XP compatible is added temporarily to avoid any temporary regressions for sa8295p-adp.

Fixes fd5821a1a83c ("arm64: dts: qcom: sa8540p: Drop gfx.lvl as power-domain for gpucc")
---
 arch/arm64/boot/dts/qcom/sa8540p.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/sa8540p.dtsi +0 -0
index 23888029cc11..3b31a9ea3492 100644
@@ -168,6 +168,8 @@ opp-2592000000 {
 };
 
Quoted 5 lines

arch/arm64/boot/dts/qcom/sa8540p.dtsi opp-2592000000 { · line 171

Quoted 2 lines
arch/arm64/boot/dts/qcom/sa8540p.dtsi +1 -0
 &gpucc {
+	compatible = "qcom,sa8540p-gpucc", "qcom,sc8280xp-gpucc";

This introduces new dtbs_check failures. Please fix the binding and drop the last patch in the series.

I know, and this is done on purpose.

I doubt anyone cares if the sa8295p GPU breaks for one commit in case this series goes in through the same tree or even for a couple of RCs in case they go in through separate trees.

But we recently had a similar discussion about a bluetooth fix and whatever course of action I would have chosen here, someone is bound to whine.

In this case I figured it was worth doing the extra work. But this is just a temporary workaround as "qcom,sa8540p-gpucc" is not truly compatible with "qcom,sc8280xp-gpucc" as only the former depends on the external supply.

Heck, I even spelled it out in the commit message...

Johan

#9 lore raw

PATCH 3/5 clk: qcom: gpucc-sc8280xp: make cc descriptor const

In reply to Johan Hovold

Add the missing 'const' keyword to mark the Qualcomm clock controller descriptor data as constant.

---
 drivers/clk/qcom/gpucc-sc8280xp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gpucc-sc8280xp.c +1 -1
index 3611d2d1823d..df6b01768767 100644
@@ -415,7 +415,7 @@ static const struct regmap_config gpu_cc_sc8280xp_regmap_config = {
 	.fast_io = true,
 };
 
-static struct qcom_cc_desc gpu_cc_sc8280xp_desc = {
+static const struct qcom_cc_desc gpu_cc_sc8280xp_desc = {
 	.config = &gpu_cc_sc8280xp_regmap_config,
 	.clks = gpu_cc_sc8280xp_clocks,
 	.num_clks = ARRAY_SIZE(gpu_cc_sc8280xp_clocks),
Signature · 1 line
2.43.0
#11 lore raw

PATCH 4/5 clk: qcom: gpucc-sc8280xp: fix GX external supply lookup

In reply to Johan Hovold

The SA8540P platform is closely related to SC8280XP but differs in that it uses an external supply for the GX power domain.

Use the new SA8540P compatible to determine whether to look up the external supply.

This specifically avoids warnings such as:

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

on SC8280XP.

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

Fixes deebc79b28d6 ("clk: qcom: gpucc-sc8280xp: Add external supply for GX gdsc")
---
 drivers/clk/qcom/gpucc-sc8280xp.c | 40 +++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 5 deletions(-)
drivers/clk/qcom/gpucc-sc8280xp.c +35 -5
index df6b01768767..48a2e8df14f2 100644
@@ -390,7 +390,7 @@ static struct gdsc cx_gdsc = {
 	.flags = VOTABLE | RETAIN_FF_ENABLE,
 };
 
-static struct gdsc gx_gdsc = {
+static struct gdsc sa8540p_gx_gdsc = {
 	.gdscr = 0x100c,
 	.clamp_io_ctrl = 0x1508,
 	.pd = {
@@ -402,9 +402,25 @@ static struct gdsc gx_gdsc = {
 	.supply = "vdd-gfx",
 };
 
+static struct gdsc sc8280xp_gx_gdsc = {
+	.gdscr = 0x100c,
+	.clamp_io_ctrl = 0x1508,
+	.pd = {
+		.name = "gx_gdsc",
+		.power_on = gdsc_gx_do_nothing_enable,
+	},
+	.pwrsts = PWRSTS_OFF_ON,
+	.flags = CLAMP_IO | RETAIN_FF_ENABLE,
+};
+
+static struct gdsc *gpu_cc_sa8540p_gdscs[] = {
+	[GPU_CC_CX_GDSC] = &cx_gdsc,
+	[GPU_CC_GX_GDSC] = &sa8540p_gx_gdsc,
+};
+
 static struct gdsc *gpu_cc_sc8280xp_gdscs[] = {
 	[GPU_CC_CX_GDSC] = &cx_gdsc,
-	[GPU_CC_GX_GDSC] = &gx_gdsc,
+	[GPU_CC_GX_GDSC] = &sc8280xp_gx_gdsc,
 };
 
 static const struct regmap_config gpu_cc_sc8280xp_regmap_config = {
@@ -415,6 +431,14 @@ static const struct regmap_config gpu_cc_sc8280xp_regmap_config = {
 	.fast_io = true,
 };
 
+static const struct qcom_cc_desc gpu_cc_sa8540p_desc = {
+	.config = &gpu_cc_sc8280xp_regmap_config,
+	.clks = gpu_cc_sc8280xp_clocks,
+	.num_clks = ARRAY_SIZE(gpu_cc_sc8280xp_clocks),
+	.gdscs = gpu_cc_sa8540p_gdscs,
+	.num_gdscs = ARRAY_SIZE(gpu_cc_sa8540p_gdscs),
+};
+
 static const struct qcom_cc_desc gpu_cc_sc8280xp_desc = {
 	.config = &gpu_cc_sc8280xp_regmap_config,
 	.clks = gpu_cc_sc8280xp_clocks,
@@ -425,9 +449,14 @@ static const struct qcom_cc_desc gpu_cc_sc8280xp_desc = {
 
 static int gpu_cc_sc8280xp_probe(struct platform_device *pdev)
 {
+	const struct qcom_cc_desc *desc;
 	struct regmap *regmap;
 	int ret;
 
+	desc = of_device_get_match_data(&pdev->dev);
+	if (!desc)
+		return -EINVAL;
+
 	ret = devm_pm_runtime_enable(&pdev->dev);
 	if (ret)
 		return ret;
@@ -436,7 +465,7 @@ static int gpu_cc_sc8280xp_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	regmap = qcom_cc_map(pdev, &gpu_cc_sc8280xp_desc);
+	regmap = qcom_cc_map(pdev, desc);
 	if (IS_ERR(regmap)) {
 		pm_runtime_put(&pdev->dev);
 		return PTR_ERR(regmap);
@@ -449,14 +478,15 @@ static int gpu_cc_sc8280xp_probe(struct platform_device *pdev)
 	qcom_branch_set_clk_en(regmap, 0x1170); /* GPU_CC_CB_CLK */
 	qcom_branch_set_clk_en(regmap, 0x109c); /* GPU_CC_CXO_CLK */
 
-	ret = qcom_cc_really_probe(pdev, &gpu_cc_sc8280xp_desc, regmap);
+	ret = qcom_cc_really_probe(pdev, desc, regmap);
 	pm_runtime_put(&pdev->dev);
 
 	return ret;
 }
 
 static const struct of_device_id gpu_cc_sc8280xp_match_table[] = {
-	{ .compatible = "qcom,sc8280xp-gpucc" },
+	{ .compatible = "qcom,sa8540p-gpucc", &gpu_cc_sa8540p_desc },
+	{ .compatible = "qcom,sc8280xp-gpucc", &gpu_cc_sc8280xp_desc },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, gpu_cc_sc8280xp_match_table);
Signature · 1 line
2.43.0
#12 lore raw

PATCH 5/5 arm64: dts: qcom: sa8540p: drop fallback gpucc compatible

In reply to Johan Hovold

Drop the fallback SC8280XP GPU clock controller compatible that was added temporarily to handle the transition to the new SA8540P compatible.

---
 arch/arm64/boot/dts/qcom/sa8540p.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sa8540p.dtsi +1 -1
index 3b31a9ea3492..9c2e99d30d08 100644
@@ -168,7 +168,7 @@ opp-2592000000 {
 };
 
 &gpucc {
-	compatible = "qcom,sa8540p-gpucc", "qcom,sc8280xp-gpucc";
+	compatible = "qcom,sa8540p-gpucc";
 
 	/* SA8295P and SA8540P doesn't provide gfx.lvl */
 	/delete-property/ power-domains;
Signature · 1 line
2.43.0