On Tue, Sep 01, 2026 at 09:50:54PM +0300, Cristian Ciocaltea wrote:
> Export dw_hdmi_qp_hpd_notify() for platform drivers to report hot-plug
> detection events.  Unlike drm_helper_hpd_irq_event() which polls all
> connectors, this helper targets only the affected connector and ensures
> .detect_ctx() is invoked on reconnection events to trigger SCDC state
> recovery.
> 
> Note that this helper may sleep, so it must only be called from a
> threaded HPD interrupt handler or a work function.
> 
> Tested-by: Maud Spierings <[email protected]>
> Tested-by: Diederik de Haas <[email protected]>  # NanoPC-T6 LTS, Rock 
> 5B
> Signed-off-by: Cristian Ciocaltea <[email protected]>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 37 
> ++++++++++++++++++++++++++++
>  include/drm/bridge/dw_hdmi_qp.h              |  1 +
>  2 files changed, 38 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c 
> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
> index ee74266b7aa9..a2277531182c 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
> @@ -28,6 +28,7 @@
>  #include <drm/drm_edid.h>
>  #include <drm/drm_modes.h>
>  #include <drm/drm_print.h>
> +#include <drm/drm_probe_helper.h>
>  
>  #include <media/cec.h>
>  
> @@ -163,6 +164,8 @@ struct dw_hdmi_qp {
>       struct regmap *regm;
>       int main_irq;
>  
> +     /* Written by the atomic enable/disable hooks, read locklessly by HPD */
> +     struct drm_connector *curr_conn;
>       unsigned long tmds_char_rate;
>       bool no_hpd;
>  };
> @@ -785,6 +788,8 @@ static void dw_hdmi_qp_bridge_atomic_enable(struct 
> drm_bridge *bridge,
>       dw_hdmi_qp_mod(hdmi, op_mode, OPMODE_DVI, LINK_CONFIG0);
>  
>       drm_atomic_helper_connector_hdmi_update_infoframes(connector, state);
> +
> +     WRITE_ONCE(hdmi->curr_conn, connector);

You need to take a reference to the connector, and you really should use
a mutex here.

Maxime

Attachment: signature.asc
Description: PGP signature

Reply via email to