drm/vc4: Disallow interlaced modes on DPI.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Tue, 19 Jul 2016 18:58:57 +0000 (20:58 +0200)
committerEric Anholt <eric@anholt.net>
Sat, 20 Aug 2016 02:05:43 +0000 (19:05 -0700)
We already don't expose such modes to userspace, but make
sure userspace can't sneak some interlaced mode in.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/vc4/vc4_dpi.c

index 275fedbdbd9eae420939627e7fcdf9236cfce4fa..1e1f6b8184d058c6e55e092653798f4d75b55b7f 100644 (file)
@@ -340,9 +340,20 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
        }
 }
 
+static bool vc4_dpi_encoder_mode_fixup(struct drm_encoder *encoder,
+                                      const struct drm_display_mode *mode,
+                                      struct drm_display_mode *adjusted_mode)
+{
+       if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
+               return false;
+
+       return true;
+}
+
 static const struct drm_encoder_helper_funcs vc4_dpi_encoder_helper_funcs = {
        .disable = vc4_dpi_encoder_disable,
        .enable = vc4_dpi_encoder_enable,
+       .mode_fixup = vc4_dpi_encoder_mode_fixup,
 };
 
 static const struct of_device_id vc4_dpi_dt_match[] = {