Currently it is next to impossible to implement CEC handling for the setup using drm_bridges and drm_bridge_connector: bridges don't have a hold of the connector at the proper time to be able to route CEC events. At the same time it not very easy and obvious to get the CEC physical address handling correctly. Drivers handle it at various places, ending up with the slight differences in behaviour. Follow up the HDMI Connector and HDMI Audio series and implement generic HDMI CEC set of helpers that link into the HDMI Connector and drm_bridge_connector frameworks and provide a way to implement CEC handling for HDMI bridges in an easy yet standard way. Notes: - the patchset was only compile-tested - being an RFC some of the API functions and structures are left undocumented - although the patchset provides drm_bridge / drm_bridge_connector API for working with CEC, there is no actual bridge that uses the API (yet) - I'm pretty unhappy with the drm_bridge integration code, we end up duplicating wrappers for CEC functions instead of reusing the drm_connector wrapping functions. An easy way would be to map drm_bridge to the corresponding drm_connector, but that would either require a state or storing drm_connector inside a drm_bridge. Current code stores cec_adapter instead. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> --- Changes in v2: - Refactored CEC funcs, adding more wrappers to provide more consistent interface (Maxime) - Removed export of drm_connector_cec_unregister() (Maxime) - Restored and rephrased comment in vc4_hdmi (Maxime) - Squashed vc4 patches - Link to v1: https://lore.kernel.org/r/20241225-drm-hdmi-connector-cec-v1-0-b80380c67221@xxxxxxxxxx --- Dmitry Baryshkov (8): drm/connector: add CEC-related fields drm/display: add CEC helpers code drm/display: hdmi-state-helper: handle CEC physicall address drm/vc4: hdmi: switch to generic CEC helpers drm/display: bridge-connector: hook in CEC notifier support drm/bridge: move private data to the end of the struct drm/display: hdmi-cec-helper: add bridge-related functions drm/display: bridge-connector: handle CEC adapters drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +- drivers/gpu/drm/display/Kconfig | 6 + drivers/gpu/drm/display/Makefile | 2 + drivers/gpu/drm/display/drm_bridge_connector.c | 106 +++++++++- drivers/gpu/drm/display/drm_hdmi_cec_helper.c | 246 ++++++++++++++++++++++++ drivers/gpu/drm/display/drm_hdmi_state_helper.c | 7 +- drivers/gpu/drm/drm_bridge.c | 16 ++ drivers/gpu/drm/drm_connector.c | 13 ++ drivers/gpu/drm/vc4/Kconfig | 1 + drivers/gpu/drm/vc4/vc4_hdmi.c | 132 +++++-------- drivers/gpu/drm/vc4/vc4_hdmi.h | 1 - include/drm/display/drm_hdmi_cec_helper.h | 70 +++++++ include/drm/drm_bridge.h | 78 ++++++-- include/drm/drm_connector.h | 44 +++++ 14 files changed, 621 insertions(+), 103 deletions(-) --- base-commit: 74509d54ebf1ecfbdf5f7edec32c490fefa01b8b change-id: 20241223-drm-hdmi-connector-cec-34902ce847b7 Best regards, -- Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>