drm/rockchip: dw-dp: fixup the timing min limit

Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
Change-Id: I776ed1eaf38a7d91db3541bade02eac68908b977
This commit is contained in:
Zhang Yubing
2022-11-07 15:53:00 +08:00
committed by Tao Huang
parent 2c418fb7b9
commit 286b1fafa8

View File

@@ -1854,6 +1854,26 @@ static void dw_dp_encoder_disable(struct drm_encoder *encoder)
s->output_if &= ~(dp->id ? VOP_OUTPUT_IF_DP1 : VOP_OUTPUT_IF_DP0);
}
static void dw_dp_mode_fixup(struct dw_dp *dp, struct drm_display_mode *adjusted_mode)
{
int min_hbp = 16;
int min_hsync = 9;
if (dp->split_mode) {
min_hbp *= 2;
min_hsync *= 2;
}
if (adjusted_mode->hsync_end - adjusted_mode->hsync_start < min_hsync) {
adjusted_mode->hsync_end = adjusted_mode->hsync_start + min_hsync;
dev_warn(dp->dev, "hsync is too narrow, fixup to min hsync:%d\n", min_hsync);
}
if (adjusted_mode->htotal - adjusted_mode->hsync_end < min_hbp) {
adjusted_mode->htotal = adjusted_mode->hsync_end + min_hbp;
dev_warn(dp->dev, "hbp is too narrow, fixup to min hbp:%d\n", min_hbp);
}
}
static int dw_dp_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
@@ -1892,6 +1912,8 @@ static int dw_dp_encoder_atomic_check(struct drm_encoder *encoder,
s->eotf = HDMI_EOTF_TRADITIONAL_GAMMA_SDR;
s->color_space = V4L2_COLORSPACE_DEFAULT;
dw_dp_mode_fixup(dp, &crtc_state->adjusted_mode);
return 0;
}
@@ -2032,9 +2054,6 @@ static int dw_dp_bridge_mode_valid(struct drm_bridge *bridge,
if (dp->split_mode)
drm_mode_convert_to_origin_mode(&m);
if (m.hsync_end - m.hsync_start <= 8)
return MODE_HSYNC_NARROW;
if (info->color_formats & DRM_COLOR_FORMAT_YCRCB420 &&
link->vsc_sdp_extension_for_colorimetry_supported &&
(drm_mode_is_420_only(info, &m) || drm_mode_is_420_also(info, &m)))