From patchwork Fri Sep 29 10:05:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 9977411 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 AA64E60329 for ; Fri, 29 Sep 2017 10:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4A6F2967C for ; Fri, 29 Sep 2017 10:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9980429807; Fri, 29 Sep 2017 10:05:55 +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 32AC42967C for ; Fri, 29 Sep 2017 10:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751831AbdI2KFy (ORCPT ); Fri, 29 Sep 2017 06:05:54 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:42641 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751933AbdI2KFu (ORCPT ); Fri, 29 Sep 2017 06:05:50 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20170929100548euoutp023f5e27cda0ef5867b02e12854ad48fea~ozREdHtgn0289302893euoutp02P; Fri, 29 Sep 2017 10:05:48 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170929100547eucas1p1509f4c112fd9b7fb6933b8c428d30d0f~ozRDwlI6L2558325583eucas1p1Z; Fri, 29 Sep 2017 10:05:47 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 88.32.12576.BFA1EC95; Fri, 29 Sep 2017 11:05:47 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170929100547eucas1p2642f5da0380df27d991cf3b2b1e730b3~ozRDGXr751407614076eucas1p2A; Fri, 29 Sep 2017 10:05:47 +0000 (GMT) X-AuditID: cbfec7ef-f79ee6d000003120-a1-59ce1afb0bf9 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C6.27.18832.BFA1EC95; Fri, 29 Sep 2017 11:05:47 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OX100L2HDDLSN30@eusync4.samsung.com>; Fri, 29 Sep 2017 11:05:47 +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 v2 04/11] drm/exynos/mixer: fix mode validation code Date: Fri, 29 Sep 2017 12:05:35 +0200 Message-id: <20170929100542.12849-5-a.hajda@samsung.com> X-Mailer: git-send-email 2.14.1 In-reply-to: <20170929100542.12849-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djP87q/pc5FGpx+pGtxa905VouNM9az Wjya/5jZ4srX92wWk+5PYLGYcX4fk8XaI3fZLdpWf2B14PBY9D3L4373cSaPf8fYPfq2rGL0 +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m9pYQGxeAQuJb2e+skBsk5c49+A22GZOAUuJxZO/MEEs s5BYtHA96wRG3gWMDKsYRVJLi3PTc4sN9YoTc4tL89L1kvNzNzECQ2vbsZ+bdzBe2hh8iFGA g1GJh/eG3NlIIdbEsuLK3EOMEhzMSiK8TzjPRQrxpiRWVqUW5ccXleakFh9ilOZgURLn7d2z OlJIID2xJDU7NbUgtQgmy8TBKdXAWN5rqjbbKGTWzZtnXmlVl+49obj0/IoLavUcNzblRWq/ 4LrZdtZQVWh/q/nsWy7/k9csuFvyZr/zeQHVJzYHQlMN1CeeDl+r/pPZMeFIrqDzq/27t305 qlUUtzdQTybloocu98XVvImvsv/prj3Gveqo/Jmw6D7jZRFzE1eHvTL1Pi9YZevmpsRSnJFo qMVcVJwIABL7A7ApAgAA X-CMS-MailID: 20170929100547eucas1p2642f5da0380df27d991cf3b2b1e730b3 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 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: 20170929100547eucas1p2642f5da0380df27d991cf3b2b1e730b3 X-RootMTR: 20170929100547eucas1p2642f5da0380df27d991cf3b2b1e730b3 References: <20170929100542.12849-1-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 | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index a87f60bbf2c2..fba120346189 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; + (w >= 1024 && w <= 1280 && h >= 576 && h <= 720) || + (w >= 1664 && w <= 1920 && h >= 936 && h <= 1080)) + 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 = {