2023-04-15 10:50:35

by Jernej Škrabec

[permalink] [raw]
Subject: [PATCH 0/3] 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(-)

--
2.40.0


2023-04-15 10:50:46

by Jernej Škrabec

[permalink] [raw]
Subject: [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.

Signed-off-by: Jernej Skrabec <[email protected]>
---
.../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
index 4b7e54a8f037..624d32c024f6 100644
--- a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
@@ -48,6 +48,11 @@ properties:
interrupts:
maxItems: 1

+ snps,disable-cec:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ Disable HDMI-CEC.
+
additionalProperties: true

...
--
2.40.0

2023-04-15 10:50:48

by Jernej Škrabec

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

New DT property allows to skip CEC initialization.

Signed-off-by: Jernej Skrabec <[email protected]>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 603bb3c51027..e7e8199d2fb1 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -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;
--
2.40.0

2023-04-15 10:53:57

by Jernej Škrabec

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

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

Disable unused DW-HDMI CEC.

Signed-off-by: Jernej Skrabec <[email protected]>
---
arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
index a6d38ecee141..38f40d69e5c5 100644
--- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
+++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
@@ -150,6 +150,7 @@ &emac {
};

&hdmi {
+ snps,disable-cec;
status = "okay";
};

--
2.40.0

2023-04-16 13:36:09

by Laurent Pinchart

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

Hi Jernej,

Thank you for the patch.

On Sat, Apr 15, 2023 at 12:46:13PM +0200, Jernej Skrabec wrote:
> 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.

> Disable unused DW-HDMI CEC.
>
> Signed-off-by: Jernej Skrabec <[email protected]>
> ---
> arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> index a6d38ecee141..38f40d69e5c5 100644
> --- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> +++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> @@ -150,6 +150,7 @@ &emac {
> };
>
> &hdmi {
> + snps,disable-cec;
> status = "okay";
> };
>

--
Regards,

Laurent Pinchart

2023-04-16 13:36:15

by Jernej Škrabec

[permalink] [raw]
Subject: 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):
> Hi Jernej,
>
> Thank you for the patch.
>
> On Sat, Apr 15, 2023 at 12:46:13PM +0200, Jernej Skrabec wrote:
> > 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

>
> > Disable unused DW-HDMI CEC.
> >
> > Signed-off-by: Jernej Skrabec <[email protected]>
> > ---
> >
> > arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> > b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts index
> > a6d38ecee141..38f40d69e5c5 100644
> > --- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> > +++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> > @@ -150,6 +150,7 @@ &emac {
> >
> > };
> >
> > &hdmi {
> >
> > + snps,disable-cec;
> >
> > status = "okay";
> >
> > };




2023-04-16 13:50:09

by Laurent Pinchart

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

On Sun, Apr 16, 2023 at 03:31:56PM +0200, Jernej Škrabec wrote:
> Dne nedelja, 16. april 2023 ob 15:25:31 CEST je Laurent Pinchart napisal(a):
> > Hi Jernej,
> >
> > Thank you for the patch.
> >
> > On Sat, Apr 15, 2023 at 12:46:13PM +0200, Jernej Skrabec wrote:
> > > 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.

> > > Disable unused DW-HDMI CEC.
> > >
> > > Signed-off-by: Jernej Skrabec <[email protected]>
> > > ---
> > >
> > > arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> > > b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts index
> > > a6d38ecee141..38f40d69e5c5 100644
> > > --- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> > > +++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts
> > > @@ -150,6 +150,7 @@ &emac {
> > > };
> > >
> > > &hdmi {
> > > + snps,disable-cec;
> > > status = "okay";
> > > };

--
Regards,

Laurent Pinchart

2023-04-17 13:36:08

by Robert Foss

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

On Sat, Apr 15, 2023 at 12:47 PM Jernej Skrabec
<[email protected]> wrote:
>
> New DT property allows to skip CEC initialization.
>
> Signed-off-by: Jernej Skrabec <[email protected]>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 603bb3c51027..e7e8199d2fb1 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -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;
> --
> 2.40.0
>


Reviewed-by: Robert Foss <[email protected]>

2023-04-18 21:48:27

by Rob Herring (Arm)

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

On Sat, Apr 15, 2023 at 12:46:11PM +0200, Jernej Skrabec wrote:
> 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.

>
> Signed-off-by: Jernej Skrabec <[email protected]>
> ---
> .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
> index 4b7e54a8f037..624d32c024f6 100644
> --- a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
> @@ -48,6 +48,11 @@ properties:
> interrupts:
> maxItems: 1
>
> + snps,disable-cec:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description:
> + Disable HDMI-CEC.
> +
> additionalProperties: true
>
> ...
> --
> 2.40.0
>

2023-04-21 07:12:11

by Hans Verkuil

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

On 18/04/2023 23:41, Rob Herring wrote:
> On Sat, Apr 15, 2023 at 12:46:11PM +0200, Jernej Skrabec wrote:
>> 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

>
>>
>> Signed-off-by: Jernej Skrabec <[email protected]>
>> ---
>> .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
>> index 4b7e54a8f037..624d32c024f6 100644
>> --- a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
>> +++ b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml
>> @@ -48,6 +48,11 @@ properties:
>> interrupts:
>> maxItems: 1
>>
>> + snps,disable-cec:
>> + $ref: /schemas/types.yaml#/definitions/flag
>> + description:
>> + Disable HDMI-CEC.
>> +
>> additionalProperties: true
>>
>> ...
>> --
>> 2.40.0
>>