[PATCH 2/2] drm/rockchip: vop: verify pixelclock for hdmi and displayport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hdmi or DisplayPort request a accurate clock,
reject the display mode if clock is not good.

Signed-off-by: Mark Yao <mark.yao@xxxxxxxxxxxxxx>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 7ec5d7f..a7c118e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -868,14 +868,24 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
 {
 	struct vop *vop = to_vop(crtc);
 	const struct vop_data *vop_data = vop->data;
+	struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state);
+	int clock;
 
 	if (mode->hdisplay > vop_data->max_output.width)
 		return false;
 	if (mode->vdisplay > vop_data->max_output.height)
 		return false;
 
-	adjusted_mode->clock =
-		clk_round_rate(vop->dclk, mode->clock * 1000) / 1000;
+	clock = clk_round_rate(vop->dclk, mode->clock * 1000) / 1000;
+	/*
+	 * Hdmi or DisplayPort request a Accurate clock.
+	 */
+	if (s->output_type == DRM_MODE_CONNECTOR_HDMIA ||
+	    s->output_type == DRM_MODE_CONNECTOR_DisplayPort)
+		if (clock != mode->clock)
+			return false;
+
+	adjusted_mode->clock = clock;
 
 	return true;
 }
-- 
1.9.1


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux