imx-drm: ipuv3-crtc: Implement mode_fixup
authorSteve Longerbeam <slongerbeam@gmail.com>
Fri, 19 Dec 2014 02:00:23 +0000 (18:00 -0800)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 7 Jan 2015 18:15:02 +0000 (19:15 +0100)
Ask the IPU display interface, via ipu_di_adjust_videomode(), to
adjust a video mode to meet any DI restrictions. The function takes
a subsystem independent videomode, so the drm_display_mode must be
converted to videomode first, and then the adjusted mode converted
back to a drm_display_mode.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/drm/imx/ipuv3-crtc.c

index ebee59cb96d8a3f1fa8ab831341b3babc63f452a..23d69ecb62dd539b222aa25125f605d4e224f76e 100644 (file)
@@ -237,6 +237,18 @@ static bool ipu_crtc_mode_fixup(struct drm_crtc *crtc,
                                  const struct drm_display_mode *mode,
                                  struct drm_display_mode *adjusted_mode)
 {
+       struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
+       struct videomode vm;
+       int ret;
+
+       drm_display_mode_to_videomode(adjusted_mode, &vm);
+
+       ret = ipu_di_adjust_videomode(ipu_crtc->di, &vm);
+       if (ret)
+               return false;
+
+       drm_display_mode_from_videomode(&vm, adjusted_mode);
+
        return true;
 }