Skip to contentSkip to conversation

drm/bridge: dw_hdmi: allow to disable CEC from DT

PATCH In review Jernej Skrabec 5 participants 10 messages Apr 15, 2023 – Apr 21, 2023

Subsystems (6)
lore
Share & tools
lore

Jernej Skrabec

author maintainer
#0 lore raw

cover drm/bridge: dw_hdmi: allow to disable CEC from DT

Boards can have perfectly working DW HDMI CEC implementation but they may prefer to use bit banged implementation instead. This is the situation on Beelink X2.

Add DW HDMI DT property for disabling CEC. This prevents confusion on userspace side by not exposing unused CEC interface.

Best regards,
Jernej

Jernej Skrabec (3):
dt-bindings: display: synopsys,dw-hdmi: Add property for disabling CEC drm/bridge: dw_hdmi: Handle snps,disable-cec property
ARM: dts: sun8i: h3: beelink-x2: Disable DW-HDMI CEC

 .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 +++++
 arch/arm/boot/dts/sun8i-h3-beelink-x2.dts                    | 1 +
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c                    | 4 +++-
 3 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.40.0
author maintainer
#1 lore raw

PATCH 1/3 dt-bindings: display: synopsys,dw-hdmi: Add property for disabling CEC

Even though some DW-HDMI controllers have perfectly usable HDMI-CEC implementation, some boards might prefer not to use it or even use software implementation instead.

Add property for disabling CEC so driver doesn't expose unused CEC interface, if CEC pin isn't connected anywhere.

---
 .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml +5 -0
index 4b7e54a8f037..624d32c024f6 100644
@@ -48,6 +48,11 @@ properties:
   interrupts:
     maxItems: 1
 
+  snps,disable-cec:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Disable HDMI-CEC.
+
 additionalProperties: true
 
 ...
Signature · 1 line
2.40.0
maintainer
#2 lore raw

Re: [PATCH 1/3] dt-bindings: display: synopsys,dw-hdmi: Add property for disabling CEC

Quoted 6 lines · Jernej Skrabec

Even though some DW-HDMI controllers have perfectly usable HDMI-CEC implementation, some boards might prefer not to use it or even use software implementation instead.

Add property for disabling CEC so driver doesn't expose unused CEC interface, if CEC pin isn't connected anywhere.

Isn't this all true for any bridge supporting CEC? Make this common.

Quoted 25 lines
---
 .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml +5 -0
index 4b7e54a8f037..624d32c024f6 100644
@@ -48,6 +48,11 @@ properties:
   interrupts:
     maxItems: 1
 
+  snps,disable-cec:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Disable HDMI-CEC.
+
 additionalProperties: true
 
...
Signature · 1 line
2.40.0
#3 lore raw

Re: [PATCH 1/3] dt-bindings: display: synopsys,dw-hdmi: Add property for disabling CEC

Quoted 9 lines · Rob Herring
Quoted 6 lines · Jernej Skrabec

Even though some DW-HDMI controllers have perfectly usable HDMI-CEC implementation, some boards might prefer not to use it or even use software implementation instead.

Add property for disabling CEC so driver doesn't expose unused CEC interface, if CEC pin isn't connected anywhere.

Isn't this all true for any bridge supporting CEC? Make this common.

I agree with that, there was a similar case in the past:

https://lore.kernel.org/linux-media/[email protected]/

I never followed up to that, but I believe this is generic for any HDMI transmitter or receiver with built-in CEC support where the CEC line is not actually hooked up to the HDMI pin.

There is no way for the CEC driver to detect that, so this has to be communicated in the device tree.

For standalone CEC devices you can just disable them in the device tree, of course, but if it is incorporated into the HDMI device itself, then it needs to be told.

Regards,

Hans

Quoted 26 lines
Quoted 26 lines
---
 .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml +5 -0
index 4b7e54a8f037..624d32c024f6 100644
@@ -48,6 +48,11 @@ properties:
   interrupts:
     maxItems: 1
 
+  snps,disable-cec:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Disable HDMI-CEC.
+
 additionalProperties: true
 
...
Signature · 1 line
2.40.0
author maintainer
#4 lore raw

PATCH 2/3 drm/bridge: dw_hdmi: Handle snps,disable-cec property

In reply to Jernej Skrabec

New DT property allows to skip CEC initialization.

---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -1
index 603bb3c51027..e7e8199d2fb1 100644
@@ -3615,7 +3615,9 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
 		hdmi->audio = platform_device_register_full(&pdevinfo);
 	}
 
-	if (!plat_data->disable_cec && (config0 & HDMI_CONFIG0_CEC)) {
+	if (!plat_data->disable_cec &&
+	    !of_property_read_bool(np, "snps,disable-cec") &&
+	    (config0 & HDMI_CONFIG0_CEC)) {
 		cec.hdmi = hdmi;
 		cec.ops = &dw_hdmi_cec_ops;
 		cec.irq = irq;
Signature · 1 line
2.40.0
maintainer Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] drm/bridge: dw_hdmi: Handle snps,disable-cec property

Quoted 24 lines · Jernej Skrabec

New DT property allows to skip CEC initialization.

---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
index 603bb3c51027..e7e8199d2fb1 100644
@@ -3615,7 +3615,9 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
                hdmi->audio = platform_device_register_full(&pdevinfo);
        }
 
-       if (!plat_data->disable_cec && (config0 & HDMI_CONFIG0_CEC)) {
+       if (!plat_data->disable_cec &&
+           !of_property_read_bool(np, "snps,disable-cec") &&
+           (config0 & HDMI_CONFIG0_CEC)) {
                cec.hdmi = hdmi;
                cec.ops = &dw_hdmi_cec_ops;
                cec.irq = irq;
--
Quoted 2 lines

2.40.0

author maintainer
#6 lore raw

PATCH 3/3 ARM: dts: sun8i: h3: beelink-x2: Disable DW-HDMI CEC

In reply to Jernej Skrabec

Beelink X2 uses software implementation of CEC even though DW-HDMI has working hardware implementation.

Disable unused DW-HDMI CEC.

---
 arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +1 -0
index a6d38ecee141..38f40d69e5c5 100644
@@ -150,6 +150,7 @@ &emac {
 };
 
 &hdmi {
+	snps,disable-cec;
 	status = "okay";
 };
 
Signature · 1 line
2.40.0
#7 lore raw

Re: [PATCH 3/3] ARM: dts: sun8i: h3: beelink-x2: Disable DW-HDMI CEC

Hi Jernej,

Thank you for the patch.

Quoted 2 lines · Jernej Skrabec

Beelink X2 uses software implementation of CEC even though DW-HDMI has working hardware implementation.

Why ? The reason should be explained in the commit message.

Quoted 19 lines

Disable unused DW-HDMI CEC.

---
 arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +1 -0
index a6d38ecee141..38f40d69e5c5 100644
@@ -150,6 +150,7 @@ &emac {
 };
 
 &hdmi {
+	snps,disable-cec;
 	status = "okay";
 };
 
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#8 lore raw

Re: [PATCH 3/3] ARM: dts: sun8i: h3: beelink-x2: Disable DW-HDMI CEC

Dne nedelja, 16. april 2023 ob 15:25:31 CEST je Laurent Pinchart napisal(a):

Quoted 9 lines

Hi Jernej,

Thank you for the patch.

Quoted 2 lines · Jernej Skrabec

Beelink X2 uses software implementation of CEC even though DW-HDMI has working hardware implementation.

Why ? The reason should be explained in the commit message.

Maybe I should reword this differently. It uses software implementation through GPIO pin. Dedicated DW-HDMI CEC pin is left unconnected.

Best regards,
Jernej

Quoted 25 lines
Quoted 25 lines

Disable unused DW-HDMI CEC.

---

 arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts index
a6d38ecee141..38f40d69e5c5 100644

arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +1 -0
@@ -150,6 +150,7 @@ &emac {
 
 };
 
 &hdmi {
 
+	snps,disable-cec;
 

status = "okay";

};

#9 lore raw

Re: [PATCH 3/3] ARM: dts: sun8i: h3: beelink-x2: Disable DW-HDMI CEC

Quoted 5 lines · Jernej Škrabec

Dne nedelja, 16. april 2023 ob 15:25:31 CEST je Laurent Pinchart napisal(a):

Quoted 4 lines

Hi Jernej,

Thank you for the patch.

Quoted 8 lines
Quoted 5 lines · Jernej Skrabec
Quoted 2 lines

Beelink X2 uses software implementation of CEC even though DW-HDMI has working hardware implementation.

Why ? The reason should be explained in the commit message.

Maybe I should reword this differently. It uses software implementation through GPIO pin. Dedicated DW-HDMI CEC pin is left unconnected.

That's a very good reason :-) I'm then fine with this patch, with a reworded commit message. The DT bindings should be updated accordingly as well, to explain the use case.

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

Disable unused DW-HDMI CEC.

---

 arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts index
a6d38ecee141..38f40d69e5c5 100644

arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +1 -0
@@ -150,6 +150,7 @@ &emac {
 };
 
 &hdmi {
+	snps,disable-cec;
 	status = "okay";
 };
Signature · 3 lines
Regards,

Laurent Pinchart