Skip to contentSkip to conversation

drm/bridge: dw-hdmi: disable loading of DW-HDMI CEC sub-driver

PATCH In review Neil Armstrong 4 participants 9 messages Apr 16, 2021 – Apr 20, 2021

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

cover drm/bridge: dw-hdmi: disable loading of DW-HDMI CEC sub-driver

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.

Jernej Skrabec (1):
drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC
driver

Neil Armstrong (1):
drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 1 +
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/2 drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC driver

From: Jernej Skrabec <[email protected]>

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.

---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 include/drm/bridge/dw_hdmi.h              | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
index dda4fa9a1a08..ae97513ef886 100644
@@ -3421,7 +3421,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
 		hdmi->audio = platform_device_register_full(&pdevinfo);
 	}
 
-	if (config0 & HDMI_CONFIG0_CEC) {
+	if (!plat_data->disable_cec && (config0 & HDMI_CONFIG0_CEC)) {
 		cec.hdmi = hdmi;
 		cec.ops = &dw_hdmi_cec_ops;
 		cec.irq = irq;
include/drm/bridge/dw_hdmi.h +2 -0
index ea34ca146b82..6a5716655619 100644
@@ -153,6 +153,8 @@ struct dw_hdmi_plat_data {
 	const struct dw_hdmi_phy_config *phy_config;
 	int (*configure_phy)(struct dw_hdmi *hdmi, void *data,
 			     unsigned long mpixelclock);
+
+	unsigned int disable_cec : 1;
 };
 
 struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

In reply to Neil Armstrong

On the Amlogic SoCs, the DW-HDMI HW support is here but the DW-HDMI CEC signal is not connected to a physical pin, leading to confusion when the dw-hdmi cec controller can't communicate on the bus.

Disable it to avoid exposing a non-functinal bus.

---
 drivers/gpu/drm/meson/meson_dw_hdmi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/meson/meson_dw_hdmi.c +1 -0
index aad75a22dc33..2ed87cfdd735 100644
@@ -1103,6 +1103,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
 	dw_plat_data->phy_data = meson_dw_hdmi;
 	dw_plat_data->input_bus_encoding = V4L2_YCBCR_ENC_709;
 	dw_plat_data->ycbcr_420_allowed = true;
+	dw_plat_data->disable_cec = true;
 
 	if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
 	    dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxm-dw-hdmi") ||
Signature · 1 line
2.25.1
#3 lore raw
In reply to Neil Armstrong

Hi Neil,

Quoted 6 lines · Neil Armstrong

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.

If we can't trust the CEC config bit, would it be better to not use it at all, and instead let each platform glue logic tell whether to enable CEC or not ?

Quoted 12 lines

Jernej Skrabec (1):
drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC
driver

Neil Armstrong (1):
drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 1 +
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)
Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 5 lines · Laurent Pinchart

Hi Neil,

Quoted 2 lines · Neil Armstrong

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

Quoted 8 lines
Quoted 4 lines

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.

If we can't trust the CEC config bit, would it be better to not use it at all, and instead let each platform glue logic tell whether to enable CEC or not ?

Actually, the CEC config bit is right, the HW exists and should be functional, but this bit doesn't tell if the CEC signal is connected to something.

This lies in the IP integration, like other bits under the "amlogic,meson-*-dw-hdmi" umbrella.

The first attempt was by Hans using DT, but adding a property in DT for a vendor specific compatible doesn't make sense. Another idea would be to describe the CEC signal endpoint like we do for video signal, but I think this is out of scope and this solution is much simpler and straightforward, and it's more an exception than a general use case to solve.

Neil

Quoted 5 lines
Quoted 5 lines

Jernej Skrabec (1):
drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC
driver

Quoted 9 lines
Quoted 8 lines

Neil Armstrong (1):
drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 1 +
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

CC Hans Verkuil

Dne petek, 16. april 2021 ob 13:38:59 CEST je Neil Armstrong napisal(a):

Quoted 12 lines · Laurent Pinchart
Quoted 11 lines

Hi Neil,

Quoted 8 lines · Neil Armstrong

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.>

Quoted 7 lines
Quoted 3 lines

If we can't trust the CEC config bit, would it be better to not use it at all, and instead let each platform glue logic tell whether to enable CEC or not ?

Actually, the CEC config bit is right, the HW exists and should be functional, but this bit doesn't tell if the CEC signal is connected to something.

I'm in favour of Neil's solution. Currently we have only one exception.

Quoted 9 lines

This lies in the IP integration, like other bits under the "amlogic,meson-*-dw-hdmi" umbrella.

The first attempt was by Hans using DT, but adding a property in DT for a vendor specific compatible doesn't make sense. Another idea would be to describe the CEC signal endpoint like we do for video signal, but I think this is out of scope and this solution is much simpler and straightforward, and it's more an exception than a general use case to solve.

Note that we still need DT property for disabling CEC. I have one Allwinner H3 board where board designer decided to use GPIO CEC implementation instead of DW HDMI one (vendor Linux doesn't implement DW HDMI CEC driver). Other H3 boards happily use DW HDMI CEC.

Best regards,
Jernej

Quoted 15 lines

Neil

Quoted 12 lines
Quoted 12 lines

Jernej Skrabec (1):
drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC

driver

Neil Armstrong (1):
drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 1 +
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by
#6 lore raw
In reply to Neil Armstrong
Quoted 18 lines · Neil Armstrong
Quoted 5 lines · Laurent Pinchart

Hi Neil,

Quoted 2 lines · Neil Armstrong

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

Quoted 8 lines
Quoted 4 lines

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.

If we can't trust the CEC config bit, would it be better to not use it at all, and instead let each platform glue logic tell whether to enable CEC or not ?

Actually, the CEC config bit is right, the HW exists and should be functional, but this bit doesn't tell if the CEC signal is connected to something.

Quoted 8 lines

This lies in the IP integration, like other bits under the "amlogic,meson-*-dw-hdmi" umbrella.

The first attempt was by Hans using DT, but adding a property in DT for a vendor specific compatible doesn't make sense. Another idea would be to describe the CEC signal endpoint like we do for video signal, but I think this is out of scope and this solution is much simpler and straightforward, and it's more an exception than a general use case to solve.

While a DT property might not make sense in this particular case, I still believe that it is a perfectly valid approach in general: whether or not the CEC pin is connected is at the hardware level decision, it is not something that software can detect. If the designer of the board didn't connect it, then the only place you can define that is in the device tree.

Anyway, for meson I am fine with this solution. At least it prevents creating a non-functioning cec device. So for this series:

Regards,

Hans

Quoted 18 lines

Neil

Quoted 5 lines
Quoted 5 lines

Jernej Skrabec (1):
drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC
driver

Quoted 9 lines
Quoted 8 lines

Neil Armstrong (1):
drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 1 +
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)
Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw
Quoted 28 lines · Hans Verkuil
Quoted 18 lines · Neil Armstrong
Quoted 5 lines · Laurent Pinchart

Hi Neil,

Quoted 2 lines · Neil Armstrong

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

Quoted 8 lines
Quoted 4 lines

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.

If we can't trust the CEC config bit, would it be better to not use it at all, and instead let each platform glue logic tell whether to enable CEC or not ?

Actually, the CEC config bit is right, the HW exists and should be functional, but this bit doesn't tell if the CEC signal is connected to something.

Quoted 8 lines

This lies in the IP integration, like other bits under the "amlogic,meson-*-dw-hdmi" umbrella.

The first attempt was by Hans using DT, but adding a property in DT for a vendor specific compatible doesn't make sense. Another idea would be to describe the CEC signal endpoint like we do for video signal, but I think this is out of scope and this solution is much simpler and straightforward, and it's more an exception than a general use case to solve.

Quoted 5 lines

While a DT property might not make sense in this particular case, I still believe that it is a perfectly valid approach in general: whether or not the CEC pin is connected is at the hardware level decision, it is not something that software can detect. If the designer of the board didn't connect it, then the only place you can define that is in the device tree.

Agreed, we need to define a smart way to declare CEC bus relationship in DT, the side effect would be to handle this particular case.

Quoted 5 lines

Anyway, for meson I am fine with this solution. At least it prevents creating a non-functioning cec device. So for this series:

Thanks,

Applying this serie to drm-misc-next

Neil

Quoted 29 lines

Regards,

Hans

Quoted 23 lines

Neil

Quoted 5 lines
Quoted 5 lines

Jernej Skrabec (1):
drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC
driver

Quoted 9 lines
Quoted 8 lines

Neil Armstrong (1):
drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 1 +
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw
Quoted 29 lines · Neil Armstrong
Quoted 28 lines · Hans Verkuil
Quoted 26 lines · Neil Armstrong
Quoted 5 lines · Laurent Pinchart

Hi Neil,

Quoted 2 lines · Neil Armstrong

This adds DW-HDMI driver a glue option to disable loading of the CEC sub-driver.

Quoted 8 lines
Quoted 4 lines

On some SoCs, the CEC functionality is enabled in the IP config bits, but the CEC bus is non-functional like on Amlogic SoCs, where the CEC config bit is set but the DW-HDMI CEC signal is not connected to a physical pin, leading to some confusion when the DW-HDMI CEC controller can't communicate on the bus.

If we can't trust the CEC config bit, would it be better to not use it at all, and instead let each platform glue logic tell whether to enable CEC or not ?

Actually, the CEC config bit is right, the HW exists and should be functional, but this bit doesn't tell if the CEC signal is connected to something.

This lies in the IP integration, like other bits under the "amlogic,meson-*-dw-hdmi" umbrella.

The first attempt was by Hans using DT, but adding a property in DT for a vendor specific compatible doesn't make sense. Another idea would be to describe the CEC signal endpoint like we do for video signal, but I think this is out of scope and this solution is much simpler and straightforward, and it's more an exception than a general use case to solve.

Quoted 8 lines
Quoted 5 lines

While a DT property might not make sense in this particular case, I still believe that it is a perfectly valid approach in general: whether or not the CEC pin is connected is at the hardware level decision, it is not something that software can detect. If the designer of the board didn't connect it, then the only place you can define that is in the device tree.

Agreed, we need to define a smart way to declare CEC bus relationship in DT, the side effect would be to handle this particular case.

I wonder if it would make sense to use the OF graph bindings to describe the connection between the CEC controller and the CEC "device" (which I assume in most cases will be a DT node for a physical connector). Or is this overkill ?

Quoted 20 lines
Quoted 4 lines

Anyway, for meson I am fine with this solution. At least it prevents creating a non-functioning cec device. So for this series:

Thanks,

Applying this serie to drm-misc-next

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Jernej Skrabec (1):
drm/bridge/synopsys: dw-hdmi: Add an option to suppress loading CEC
driver

Neil Armstrong (1):
drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +-
 drivers/gpu/drm/meson/meson_dw_hdmi.c     | 1 +
 include/drm/bridge/dw_hdmi.h              | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)
Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel