drm/bridge: synopsys: dw-hdmi-qp: Fix crash when accessing audio regs

When dclk_en is set to true, audio regs may be accessed. If
crtc_post_enable() is called at this time, it will cause dclk to
be reset, resulting in a crash when accessing the register.

The crash stack is as follows:

[ 7765.124543][ T2309] CPU: 1 PID: 2309 Comm: writer Tainted: G           O       6.1.118 #1989
[ 7765.124551][ T2309] Hardware name: Rockchip RK3576 TEST1 V10 Board (DT)
[ 7765.124555][ T2309] pstate: 204000c5 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 7765.124562][ T2309] pc : regmap_mmio_read32le+0x8/0x20
[ 7765.124577][ T2309] lr : regmap_mmio_read+0x44/0x70
[ 7765.124583][ T2309] sp : ffffffc012483aa0
[ 7765.124586][ T2309] x29: ffffffc012483aa0 x28: 0000000000000004 x27: 0000000000000041
[ 7765.124595][ T2309] x26: fffffffffffffffc x25: 0000000000000000 x24: 0000000000000000
[ 7765.124603][ T2309] x23: 0000000000000e20 x22: ffffff80c2b25800 x21: ffffffc012483b24
[ 7765.124611][ T2309] x20: ffffff80c134d8c0 x19: ffffffc012483b24
[ 7765.126002][  T640] gsensor_icm4260x 3-0068: set sensor poll time to 133ms
[ 7765.126399][ T2309]  x18: ffffffc012883098
[ 7765.126405][ T2309] x17: 0000000000000001 x16: ffffffffffffffff x15: 0000000000000004
[ 7765.126414][ T2309] x14: ffffffc009f2c980 x13: 0000000000000003 x12: 0000000000000003
[ 7765.126422][ T2309] x11: 0000000000000000 x10: ffffffc009606e28 x9 : 0000000000000000
[ 7765.126430][ T2309] x8 : ffffffc00bd00e20 x7 : 205b5d3639363731 x6 : 0000000000000000
[ 7765.135247][ T2309] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000001001
[ 7765.135950][ T2309] x2 : ffffffc012483b24 x1 : 0000000000000e20 x0 : ffffff80c134d8c0
[ 7765.136651][ T2309] Call trace:
[ 7765.136933][ T2309]  regmap_mmio_read32le+0x8/0x20
[ 7765.137363][ T2309]  _regmap_bus_reg_read+0x28/0x34
[ 7765.137801][ T2309]  _regmap_read+0x18c/0x240
[ 7765.138197][ T2309]  regmap_update_bits_base+0xb8/0x150
[ 7765.138666][ T2309]  dw_hdmi_i2s_audio_disable+0x54/0x64
[ 7765.139148][ T2309]  dw_hdmi_qp_audio_disable+0xb4/0xcc
[ 7765.139616][ T2309]  dw_hdmi_qp_i2s_audio_shutdown+0x14/0x20
[ 7765.140119][ T2309]  hdmi_codec_shutdown+0x48/0x70
[ 7765.140548][ T2309]  snd_soc_dai_shutdown+0x44/0x58
[ 7765.140984][ T2309]  soc_pcm_clean+0xbc/0x1a8
[ 7765.141378][ T2309]  soc_pcm_close+0x34/0x54
[ 7765.141760][ T2309]  snd_pcm_release_substream+0xbc/0x108
[ 7765.142241][ T2309]  snd_pcm_release+0x40/0x9c
[ 7765.142643][ T2309]  __fput+0x80/0x25c
[ 7765.142985][ T2309]  ____fput+0x10/0x1c
[ 7765.143334][ T2309]  task_work_run+0xb4/0xd4
[ 7765.143716][ T2309]  do_notify_resume+0x71c/0x2150
[ 7765.144145][ T2309]  el0_svc_compat+0x44/0x48
[ 7765.144540][ T2309]  el0t_32_sync_handler+0x68/0x8c
[ 7765.144977][ T2309]  el0t_32_sync+0x168/0x16c

Change-Id: Ief2a5ba5633ef8fc445ee5cf3454e0ba79ee6916
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
This commit is contained in:
Algea Cao
2025-07-16 17:43:02 +08:00
committed by Tao Huang
parent 086a0a3087
commit a54e105da3

View File

@@ -3765,6 +3765,8 @@ static void dw_hdmi_qp_bridge_atomic_enable(struct drm_bridge *bridge,
mutex_lock(&hdmi->audio_mutex);
if (hdmi->plat_data->dclk_set)
hdmi->plat_data->dclk_set(data, true, hdmi->vp_id);
if (hdmi->plat_data->crtc_post_enable)
hdmi->plat_data->crtc_post_enable(data, bridge->encoder->crtc);
hdmi->dclk_en = true;
mutex_unlock(&hdmi->audio_mutex);
}
@@ -3772,9 +3774,6 @@ static void dw_hdmi_qp_bridge_atomic_enable(struct drm_bridge *bridge,
if (link_cfg && link_cfg->frl_mode)
queue_work(hdmi->workqueue, &hdmi->flt_work);
if (hdmi->plat_data->crtc_post_enable)
hdmi->plat_data->crtc_post_enable(data, bridge->encoder->crtc);
dw_hdmi_qp_init_audio_infoframe(hdmi);
dw_hdmi_qp_audio_enable(hdmi);
hdmi_clk_regenerator_update_pixel_clock(hdmi);