[PATCH] drm/bridge: dw-hdmi-qp: Guard clear_audio_infoframe when PHY is down

From: Frank Zhang

Date: Tue Sep 08 2026 - 02:28:49 EST


The following panic was observed during system reboot:

Kernel panic - not syncing: Asynchronous SError Interrupt
CPU: 6 UID: 1000 PID: 2348 Comm: pipewire ... 7.0.5+ #4 PREEMPT(full)
Call trace:
...
regmap_update_bits_base+0x70/0xa8
dw_hdmi_qp_bridge_clear_audio_infoframe+0x3c/0x58 [dw_hdmi_qp]
drm_bridge_connector_clear_audio_infoframe+0x2c/0x48 [drm_display_helper]
...
dw_hdmi_qp_audio_disable+0x28/0xa8 [dw_hdmi_qp]
drm_bridge_connector_audio_shutdown+0x38/0x68 [drm_display_helper]
drm_connector_hdmi_audio_shutdown+0x28/0x40 [drm_display_helper]
hdmi_codec_shutdown+0x60/0x90 [snd_soc_hdmi_codec]
...
snd_pcm_release_substream+0xcc/0x120 [snd_pcm]
snd_pcm_release+0x4c/0xc0 [snd_pcm]
...

The root cause is pipewire tries to close the HDMI audio device after
atomic_disable(), which sets tmds_char_rate to 0 and disables the PHY.

In this case, dw_hdmi_qp_audio_disable() will call
dw_hdmi_qp_bridge_clear_audio_infoframe(), accessing register without
checking tmds_char_rate.

Guard the register access in drm_display_helper callback function with
tmds_char_rate check.

Fixes: fd0141d1a8a2 ("drm/bridge: synopsys: Add audio support for dw-hdmi-qp")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Frank Zhang <rmxpzlb@xxxxxxxxx>

---
Changes in v2:
- Move drm_atomic_helper_connector_hdmi_clear_audio_infoframe() inside
the if (hdmi->tmds_char_rate) of dw_hdmi_qp_audio_disable().
- Link to v1: https://lore.kernel.org/all/20260416093150.13853-1-rmxpzlb@xxxxxxxxx/

Changes in v3:
- Add a tmds_char_rate guard in clear_audio_infoframe path.
- Decouple write_audio_infoframe from clear_audio_infoframe.
- Balance the PKTSCHED_AMD_TX_EN bit enable/disable.
- Link to v2: https://lore.kernel.org/all/20260418101936.7731-1-rmxpzlb@xxxxxxxxx/

Changes in v4:
- Update panic stack on 7.0.5
- Link to v3: https://lore.kernel.org/all/20260423081514.15444-1-rmxpzlb@xxxxxxxxx/

Changes in v5:
- Reuse the origin dw_hdmi_qp_bridge_clear_audio_infoframe and add
tmds_char_rate guard in new callback function.
- Link to v4: https://lore.kernel.org/all/20260512103153.8861-1-rmxpzlb@xxxxxxxxx/

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
index 1c214a8e6dc2..8729783d4eb6 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -880,7 +880,7 @@ static int dw_hdmi_qp_bridge_clear_spd_infoframe(struct drm_bridge *bridge)
return 0;
}

-static int dw_hdmi_qp_bridge_clear_audio_infoframe(struct drm_bridge *bridge)
+static int __dw_hdmi_qp_bridge_clear_audio_infoframe(struct drm_bridge *bridge)
{
struct dw_hdmi_qp *hdmi = bridge->driver_private;

@@ -893,6 +893,16 @@ static int dw_hdmi_qp_bridge_clear_audio_infoframe(struct drm_bridge *bridge)
return 0;
}

+static int dw_hdmi_qp_bridge_clear_audio_infoframe(struct drm_bridge *bridge)
+{
+ struct dw_hdmi_qp *hdmi = bridge->driver_private;
+
+ if (hdmi->tmds_char_rate > 0)
+ return __dw_hdmi_qp_bridge_clear_audio_infoframe(bridge);
+
+ return 0;
+}
+
static void dw_hdmi_qp_write_pkt(struct dw_hdmi_qp *hdmi, const u8 *buffer,
size_t start, size_t len, unsigned int reg)
{
@@ -987,7 +997,7 @@ static int dw_hdmi_qp_bridge_write_audio_infoframe(struct drm_bridge *bridge,
{
struct dw_hdmi_qp *hdmi = bridge->driver_private;

- dw_hdmi_qp_bridge_clear_audio_infoframe(bridge);
+ __dw_hdmi_qp_bridge_clear_audio_infoframe(bridge);

/*
* AUDI_CONTENTS0: { RSV, HB2, HB1, RSV }
--
2.55.0