blob: f0f89ba27db9e83813736263c5af5b192f01ef66 [file] [log] [blame]
From 29af91364af8b7e44f5fa589a4790e8175b58c30 Mon Sep 17 00:00:00 2001
From: Romain Perier <>
Date: Fri, 7 Apr 2017 14:17:43 +0200
Subject: [PATCH 246/286] drm: dw-hdmi: Implement the mode_fixup drm helper
This helper is supposed to validate or reject the modeline before it
applied by the mode setting. Currently this function has been dropped,
it was previously set to a dummy function that always returned true. For
both cases, this means that userspace can ask for a bad modeline that
will be always accepted.
On some platforms, like Rockchip, the drm dw_hdmi-rockchip variant driver
already implements the atomic_check drm helper, so mode_fixup cannot be
handled and implemented there (as drm_atomic_helper relies on either
atomic_check or mode_fixup).
This commit implements this helper. It only checks that this mode is
correct from the connector point of view.
Acked-by: Daniel Vetter <>
Signed-off-by: Romain Perier <>
Signed-off-by: Archit Taneja <>
(cherry picked from commit 6ce2ca580f10d8d76cc3661a0b6b88d419725c9c)
Signed-off-by: Simon Horman <>
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -1947,6 +1947,20 @@ static int dw_hdmi_bridge_attach(struct
return 0;
+static bool dw_hdmi_bridge_mode_fixup(struct drm_bridge *bridge,
+ const struct drm_display_mode *orig_mode,
+ struct drm_display_mode *mode)
+ struct dw_hdmi *hdmi = bridge->driver_private;
+ struct drm_connector *connector = &hdmi->connector;
+ enum drm_mode_status status;
+ status = dw_hdmi_connector_mode_valid(connector, mode);
+ if (status != MODE_OK)
+ return false;
+ return true;
static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
struct drm_display_mode *orig_mode,
struct drm_display_mode *mode)
@@ -1988,6 +2002,7 @@ static const struct drm_bridge_funcs dw_
.enable = dw_hdmi_bridge_enable,
.disable = dw_hdmi_bridge_disable,
.mode_set = dw_hdmi_bridge_mode_set,
+ .mode_fixup = dw_hdmi_bridge_mode_fixup,
static irqreturn_t dw_hdmi_i2c_irq(struct dw_hdmi *hdmi)