From: Rahul Sharma Subject: [PATCH 2/4] drm/exynos: implement display-mode-check callback in mixer driver Date: Thu, 27 Dec 2012 06:38:46 -0500 Message-ID: <1356608328-5847-3-git-send-email-rahul.sharma@samsung.com> References: <1356608328-5847-1-git-send-email-rahul.sharma@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 2925FE5C2A for ; Thu, 27 Dec 2012 03:18:47 -0800 (PST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MFO00708SRAZZJ0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 27 Dec 2012 20:18:46 +0900 (KST) Received: from chrome-ubuntu.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MFO001M3SNASQ10@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 27 Dec 2012 20:18:46 +0900 (KST) In-reply-to: <1356608328-5847-1-git-send-email-rahul.sharma@samsung.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: kgene.kim@samsung.com, seanpaul@google.com, sw0312.kim@samsung.com, joshi@samsung.com List-Id: dri-devel@lists.freedesktop.org This patch adds the implementation of check_mode callback in the mixer driver. Based on the mixer version, correct set of restrictions will be exposed by the mixer driver. A resolution will be acceptable only if passes the criteria set by mixer and hdmi IPs. Signed-off-by: Rahul Sharma Signed-off-by: Sean Paul --- drivers/gpu/drm/exynos/exynos_mixer.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 21db895..093b374 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -810,6 +810,33 @@ static void mixer_win_disable(void *ctx, int win) mixer_ctx->win_data[win].enabled = false; } +int mixer_check_mode(void *ctx, void *mode) +{ + struct mixer_context *mixer_ctx = ctx; + struct fb_videomode *check_mode = mode; + unsigned int w, h; + + w = check_mode->xres; + h = check_mode->yres; + + DRM_DEBUG_KMS("%s : xres=%d, yres=%d, refresh=%d, intl=%d\n", + __func__, check_mode->xres, check_mode->yres, + check_mode->refresh, (check_mode->vmode & + FB_VMODE_INTERLACED) ? true : false); + + if (mixer_ctx->mxr_ver == MXR_VER_16_0_33_0) { + if ((w >= 464 && w <= 720 && h >= 261 && h <= 576) || + (w >= 1024 && w <= 1280 && + h >= 576 && h <= 720) || + (w >= 1664 && w <= 1920 && + h >= 936 && h <= 1080)) + return 0; + } else { + return 0; + } + + return -EINVAL; +} static void mixer_wait_for_vblank(void *ctx) { struct mixer_context *mixer_ctx = ctx; @@ -947,6 +974,9 @@ static struct exynos_mixer_ops mixer_ops = { .win_mode_set = mixer_win_mode_set, .win_commit = mixer_win_commit, .win_disable = mixer_win_disable, + + /* display */ + .check_mode = mixer_check_mode, }; /* for pageflip event */ -- 1.8.0