dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm: rcar-du: dw-hdmi: Reject modes with a too high clock frequency
@ 2018-12-04 16:36 Laurent Pinchart
  2018-12-04 17:30 ` Geert Uytterhoeven
  2018-12-11 14:57 ` Kieran Bingham
  0 siblings, 2 replies; 8+ messages in thread
From: Laurent Pinchart @ 2018-12-04 16:36 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, kieran.bingham

Implement a .mode_valid() handler in the R-Car glue layer to reject
modes with an unsupported clock frequency.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Changes since v1:

- Add a comment to explain where the limit comes from

diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
index 75490a3e0a2a..603bb340e8cf 100644
--- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
+++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
@@ -35,6 +35,20 @@ static const struct rcar_hdmi_phy_params rcar_hdmi_phy_params[] = {
 	{ ~0UL,      0x0000, 0x0000, 0x0000 },
 };
 
+static enum drm_mode_status
+rcar_hdmi_mode_valid(struct drm_connector *connector,
+		     const struct drm_display_mode *mode)
+{
+	/*
+	 * The maximum supported clock frequency is 297 MHz, as shown in the PHY
+	 * parameters table.
+	 */
+	if (mode->clock > 297000)
+		return MODE_CLOCK_HIGH;
+
+	return MODE_OK;
+}
+
 static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi,
 				   const struct dw_hdmi_plat_data *pdata,
 				   unsigned long mpixelclock)
@@ -59,6 +73,7 @@ static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi,
 }
 
 static const struct dw_hdmi_plat_data rcar_dw_hdmi_plat_data = {
+	.mode_valid = rcar_hdmi_mode_valid,
 	.configure_phy	= rcar_hdmi_phy_configure,
 };
 
-- 
Regards,

Laurent Pinchart

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-11 14:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-04 16:36 [PATCH v2] drm: rcar-du: dw-hdmi: Reject modes with a too high clock frequency Laurent Pinchart
2018-12-04 17:30 ` Geert Uytterhoeven
2018-12-04 18:13   ` Laurent Pinchart
2018-12-04 18:42     ` Geert Uytterhoeven
2018-12-04 18:51       ` Laurent Pinchart
2018-12-04 19:45         ` Geert Uytterhoeven
2018-12-04 19:50           ` Laurent Pinchart
2018-12-11 14:57 ` Kieran Bingham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox