From patchwork Wed Sep 6 10:36:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9940297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32DA76038C for ; Wed, 6 Sep 2017 10:37:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 380CB1FF27 for ; Wed, 6 Sep 2017 10:37:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B5A828B90; Wed, 6 Sep 2017 10:37:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B814028B8F for ; Wed, 6 Sep 2017 10:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107AbdIFKhf (ORCPT ); Wed, 6 Sep 2017 06:37:35 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:35939 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753069AbdIFKhc (ORCPT ); Wed, 6 Sep 2017 06:37:32 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170906103731euoutp01ed04f2a1fd4db7d5879d71ef62076725~hv3L3SYty1659916599euoutp01i; Wed, 6 Sep 2017 10:37:31 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170906103730eucas1p217c4b61f0e740e231c53f543b0771429~hv3LFOW-b0161901619eucas1p2E; Wed, 6 Sep 2017 10:37:30 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 3D.50.12743.9EFCFA95; Wed, 6 Sep 2017 11:37:29 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170906103729eucas1p1844077cd598fb44535719925f3279c6e~hv3KcsnOw0372303723eucas1p1i; Wed, 6 Sep 2017 10:37:29 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d0000031c7-8a-59afcfe9e423 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 42.FA.20118.9EFCFA95; Wed, 6 Sep 2017 11:37:29 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OVU00L0NTIFI200@eusync1.samsung.com>; Wed, 06 Sep 2017 11:37:29 +0100 (BST) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, Tobias Jakobi , Daniel Drake Subject: [PATCH 04/10] drm/exynos/mixer: fix mode validation code Date: Wed, 06 Sep 2017 12:36:54 +0200 Message-id: <1504694220-15818-5-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1504694220-15818-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7djPc7ovz6+PNNi11sLi1rpzrBYbZ6xn tXg0/zGzxZWv79ksJt2fwGIx4/w+Jou1R+6yW7St/sDqwOGx6HuWx/3u40we/46xe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H08BSzOK+AscfHqfkaIbXISN891MoPYnAIuEqeuf2KF2Ows MfPhIsYJjLwLGBlWMYqklhbnpucWG+kVJ+YWl+al6yXn525iBAbWtmM/t+xg7HoXfIhRgINR iYfXcsO6SCHWxLLiytxDjBIczEoivH/PrY8U4k1JrKxKLcqPLyrNSS0+xCjNwaIkztu7Z3Wk kEB6YklqdmpqQWoRTJaJg1OqgdFkWr9/wX+tS64sP+xPnlZfWl6X0t+/9HZSvS3jJPdjDxbq s5lzcU02n7jrxBLXjI3VTb7a897tuVLwLMdy5eL4ba+yznhYvjbvrJrdtkd604U1j6JU/7mu j3wSGWSWn/CggGn281ncxSrP4zy2XuEoLdHki9e9GLWFkcWU+be72n59t5PxF5VYijMSDbWY i4oTAbDn2xsoAgAA X-CMS-MailID: 20170906103729eucas1p1844077cd598fb44535719925f3279c6e X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20170906103729eucas1p1844077cd598fb44535719925f3279c6e X-RootMTR: 20170906103729eucas1p1844077cd598fb44535719925f3279c6e References: <1504694220-15818-1-git-send-email-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Mode limitation checked in mixer driver affects only older HW. Mixer in Exynos542x has no such limitations. While at it patch changes validation callback to recently introduced mode_valid which is more suitable for the check. Additionally little cleanup is performed. Signed-off-by: Andrzej Hajda Reviewed-by: Tobias Jakobi --- drivers/gpu/drm/exynos/exynos_mixer.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index a87f60b..d530c18 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1040,26 +1040,24 @@ static void mixer_disable(struct exynos_drm_crtc *crtc) clear_bit(MXR_BIT_POWERED, &ctx->flags); } -/* Only valid for Mixer version 16.0.33.0 */ -static int mixer_atomic_check(struct exynos_drm_crtc *crtc, - struct drm_crtc_state *state) +static int mixer_mode_valid(struct exynos_drm_crtc *crtc, + const struct drm_display_mode *mode) { - struct drm_display_mode *mode = &state->adjusted_mode; - u32 w, h; + struct mixer_context *ctx = crtc->ctx; + u32 w = mode->hdisplay, h = mode->vdisplay; - w = mode->hdisplay; - h = mode->vdisplay; + DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d\n", w, h, + mode->vrefresh, !!(mode->flags & DRM_MODE_FLAG_INTERLACE)); - DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d\n", - mode->hdisplay, mode->vdisplay, mode->vrefresh, - (mode->flags & DRM_MODE_FLAG_INTERLACE) ? 1 : 0); + if (ctx->mxr_ver == MXR_VER_128_0_0_184) + return MODE_OK; 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; + return MODE_OK; - return -EINVAL; + return MODE_BAD; } static const struct exynos_drm_crtc_ops mixer_crtc_ops = { @@ -1071,7 +1069,7 @@ static const struct exynos_drm_crtc_ops mixer_crtc_ops = { .update_plane = mixer_update_plane, .disable_plane = mixer_disable_plane, .atomic_flush = mixer_atomic_flush, - .atomic_check = mixer_atomic_check, + .mode_valid = mixer_mode_valid, }; static const struct mixer_drv_data exynos5420_mxr_drv_data = {