From patchwork Fri Nov 23 09:24:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 10695491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F1395A4 for ; Fri, 23 Nov 2018 09:47:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27CC92C2DE for ; Fri, 23 Nov 2018 09:47:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A4122C34A; Fri, 23 Nov 2018 09:47:01 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BFA112C2DE for ; Fri, 23 Nov 2018 09:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RFRCaAjPlWMPpBbjUBeeoxy5+6kIiYfMgheYTZTVAy8=; b=pxCgi8g32Xk8wz m6xR1FpG3InvaKUeo7Tl+K1SpQO5vy8Xs6MCD+8lNGNJrJQ6Jn7ZT3quAL4nkFYNHg4ZONkCcGr1i UO5HZrprmNPZj80UlfuZolT0kXvkHl1wIzp4bOyeWhfYHuiRXRUNlbw2yoqi4eIEPP1ECi118E9DO XCOFXxhT7a2RyY0U6AxxxGw0WMtNy/xSUo1ThuQbqwCQYFG93a7LJAZjMAMFkYU+VbJOZIs0c9qjw fcs2c8nFkyaL18ZkPayJjVhnqhk47TcVtWOYFzC4NBi0YeZ9auUD17Wsj0KAXVrygyJUoB2SzHoG+ dHgfxlELSoTCxdsCO2Kg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gQ839-0003tx-3S; Fri, 23 Nov 2018 09:46:59 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gQ7yr-0006Cf-Va for linux-arm-kernel@bombadil.infradead.org; Fri, 23 Nov 2018 09:42:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=spxlAilPFaq2Mbt+rC4f9EYr3haTFO3dP7Tv9H743zs=; b=I1LGQID/pYNVr6IX9H9Hocpbhk 6KBEKD+meXX5wdwnkyrOLuL1GkL+qdRc9UjrqCpivtSvz6KwxqnBN/hVJZC14Zy5ev039sV5uXTM7 btSpyi6w7JQYmQpT4cL3oel0hiZsiEXAraAx/20dZPVhtYwpJlegHqTOpPNjd/aN5/4FBb8c0JFAS gpuzOgLS+fPw1JPcliez2pEiqhiTHsf+5SebVWT5j+dHFhJh8RnMBTtO3R0gl0d3YQaSvDSVDYuMZ 6rAPwtiselobiqrjgUOvxqOt8bpPFhfaiqO+MnpVLlbkXJnpClmcQrNaQDeMghGtHxyJXpcOqKSDN nkl0w4+A==; Received: from mail.bootlin.com ([62.4.15.54]) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gQ7k6-0006AV-CD for linux-arm-kernel@lists.infradead.org; Fri, 23 Nov 2018 09:27:23 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 31BD820DEB; Fri, 23 Nov 2018 10:26:58 +0100 (CET) Received: from localhost.localdomain (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id 67B6220DEB; Fri, 23 Nov 2018 10:26:32 +0100 (CET) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 19/43] drm/sun4i: frontend: Determine input mode based on the number of planes Date: Fri, 23 Nov 2018 10:24:51 +0100 Message-Id: <20181123092515.2511-20-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> References: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181123_092718_493105_EDBE9B27 X-CRM114-Status: GOOD ( 13.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Maxime Ripard , Maarten Lankhorst , linux-sunxi@googlegroups.com, Paul Kocialkowski , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , Sean Paul Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the number of planes associated with the DRM format to determine the input mode configuration instead of the format iteself. This way, the helper can be used for all packed formats without future changes. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index a305b731b042..a16697b0eac5 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -118,14 +118,12 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val) static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val) { - switch (fmt) { - case DRM_FORMAT_XRGB8888: + if (drm_format_num_planes(fmt) == 1) *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED; - return 0; - - default: + else return -EINVAL; - } + + return 0; } static int sun4i_frontend_drm_format_to_input_sequence(uint32_t fmt, u32 *val)