From: Steve Longerbeam Date: Fri, 19 Dec 2014 02:00:23 +0000 (-0800) Subject: imx-drm: ipuv3-crtc: Implement mode_fixup X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0c460a55dd97b639202d6152979669c8951522cd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git imx-drm: ipuv3-crtc: Implement mode_fixup 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 Signed-off-by: Philipp Zabel --- diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index ebee59cb96d8..23d69ecb62dd 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c @@ -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; }