drm/rockchip: dw_hdmi: Set output_type in dw_hdmi_rockchip_mode_valid

The &drm_crtc_helper_funcs.mode_valid() needs to know the output_type
in order to correctly validate the drm mode, especially when HDMI
request_clock > VOP2_MAX_DCLK_RATE. This should be set in
dw_hdmi_rockchip_mode_valid().

When the HDMI is plugged in, the output_type has not yet been set
when drm_mode_getconnector() is called for the first time.

[  951.213585][  T419] CPU: 0 PID: 419 Comm: hwc2-event Tainted: G           OE      6.1.118 #117
[  951.213596][  T419] Hardware name: Rockchip RK3576 TABLET V10 Board (DT)
[  951.213604][  T419] Call trace:
[  951.213612][  T419]  dump_backtrace+0xf4/0x118
[  951.213627][  T419]  show_stack+0x18/0x24
[  951.213636][  T419]  dump_stack_lvl+0x60/0x7c
[  951.213647][  T419]  dump_stack+0x18/0x38
[  951.213657][  T419]  dw_dp_encoder_mode_valid+0x78/0xac [rockchipdrm]
[  951.213812][  T419]  drm_mode_validate_pipeline+0x128/0x1f4
[  951.213824][  T419]  __drm_helper_update_and_validate+0x120/0x210
[  951.213834][  T419]  drm_helper_probe_single_connector_modes+0x388/0x594
[  951.213844][  T419]  drm_mode_getconnector+0x260/0x5bc
[  951.213855][  T419]  drm_ioctl_kernel+0xf8/0x184
[  951.213864][  T419]  drm_ioctl+0x2cc/0x528
[  951.213872][  T419]  __arm64_sys_ioctl+0xa8/0xe4
[  951.213884][  T419]  invoke_syscall+0x58/0x118
[  951.213896][  T419]  el0_svc_common+0xb4/0xf4
[  951.213906][  T419]  do_el0_svc+0x24/0x80
[  951.213916][  T419]  el0_svc+0x2c/0x90
[  951.213926][  T419]  el0t_64_sync_handler+0x68/0xb4
[  951.213935][  T419]  el0t_64_sync+0x1a4/0x1a8
[  951.213974][  T419] CPU: 0 PID: 419 Comm: hwc2-event Tainted: G           OE      6.1.118 #117
[  951.213984][  T419] Hardware name: Rockchip RK3576 TABLET V10 Board (DT)
[  951.213991][  T419] Call trace:
[  951.213997][  T419]  dump_backtrace+0xf4/0x118
[  951.214006][  T419]  show_stack+0x18/0x24
[  951.214015][  T419]  dump_stack_lvl+0x60/0x7c
[  951.214024][  T419]  dump_stack+0x18/0x38
[  951.214034][  T419]  vop2_crtc_mode_valid+0x60/0x278 [rockchipdrm]
[  951.214163][  T419]  drm_mode_validate_pipeline+0x1b8/0x1f4
[  951.214173][  T419]  __drm_helper_update_and_validate+0x120/0x210
[  951.214183][  T419]  drm_helper_probe_single_connector_modes+0x388/0x594
[  951.214193][  T419]  drm_mode_getconnector+0x260/0x5bc
[  951.214203][  T419]  drm_ioctl_kernel+0xf8/0x184
[  951.214211][  T419]  drm_ioctl+0x2cc/0x528
[  951.214220][  T419]  __arm64_sys_ioctl+0xa8/0xe4
[  951.214230][  T419]  invoke_syscall+0x58/0x118
[  951.214240][  T419]  el0_svc_common+0xb4/0xf4
[  951.214251][  T419]  do_el0_svc+0x24/0x80
[  951.214260][  T419]  el0_svc+0x2c/0x90
[  951.214270][  T419]  el0t_64_sync_handler+0x68/0xb4
[  951.214279][  T419]  el0t_64_sync+0x1a4/0x1a8

Change-Id: Idbb7e760c8bde3f538b88e4d5e06a778b2fc387c
Signed-off-by: chaoyi.chen <chaoyi.chen@rock-chips.com>
This commit is contained in:
chaoyi.chen
2025-02-13 10:10:10 +08:00
committed by Tao Huang
parent aa6da9dd81
commit 7c90786eef

View File

@@ -1847,6 +1847,7 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
struct rockchip_drm_private *priv = dev->dev_private;
struct drm_crtc *crtc;
struct rockchip_hdmi *hdmi;
struct rockchip_crtc_state *s;
if (!encoder) {
const struct drm_connector_helper_funcs *funcs;
@@ -1892,6 +1893,19 @@ dw_hdmi_rockchip_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
return MODE_BAD;
};
if (encoder->crtc) {
s = to_rockchip_crtc_state(encoder->crtc->state);
s->output_type = DRM_MODE_CONNECTOR_HDMIA;
} else {
drm_for_each_crtc(crtc, connector->dev) {
if (!drm_encoder_crtc_ok(encoder, crtc))
continue;
s = to_rockchip_crtc_state(crtc->state);
s->output_type = DRM_MODE_CONNECTOR_HDMIA;
}
}
if (hdmi->is_hdmi_qp) {
if (!hdmi->enable_gpio && mode->clock > 600000)
return MODE_BAD;