Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3215651imu; Sat, 24 Nov 2018 00:18:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9Ez1r52tilVH/4K3ustdoS5z+6aNJNl0WukP0JNHFRvjR3bio2iFWOfhuMchL+/0MT2Sm X-Received: by 2002:a63:e4d:: with SMTP id 13mr15926512pgo.369.1543047486930; Sat, 24 Nov 2018 00:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047486; cv=none; d=google.com; s=arc-20160816; b=crMtshDDDK3lo/wa0zi92v8HbH0bpIdtS+NcqygqztmFwYq56VGW8qUNKmkQ7YXc8a /fBiHMz/qzxP2qwliuNDq9TxIq7U2UZX37caX0ecE4YTVxHF7fEg/KFoGhCltzwlxNWk ATvF28u0jFq/hfJRBgBN48vcIiV9QkpBtmD7lj43YCN7EuM7CfJ5FQ7otJczTbXRUxg1 9ARw3jilU9tFFHjjfS3BtfHhPcOwdBPI31Bz16l3BrJlnibCiobl1ulmRqZQ/CEnfQB5 sBQd5H2o153i9tO7FAEhPYuKyu5h4fZQJb613FXdXTgUHd8+rlRCQub/o+mH0LVrswZA Jqlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=spxlAilPFaq2Mbt+rC4f9EYr3haTFO3dP7Tv9H743zs=; b=iRQC9UH+e9Q7zcJnWpMvI57BCOOH5dg53qaHLH/UX8fm7sOed2G4B9ii3P+kvUA7UG 7AkDUB43PhXL2XPbI7EwytzVE/VGwgSHgh8hPAbvkYeYi8kUaV48R07k6c3AjepMfYl9 skHhhb/6t8c3ZIH9U0fpEiiEPP2X0vMW9A0siInnQBbDnsN5vr7cyiodmL6hmHW+JgY0 tqm+nzUqnZn3l/2yDvDeRg0XmY6xJDgWxMK4lVweRYRmJXMl73hvY4bVL8p8eAmsAdQ7 aYmKE8lWHC49cXt3gXi6kqGdqyntUOdBp7X//3TlZkHKFEtjx7PazlVo+ca298PMDszY BxBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13si56631986pgj.86.2018.11.24.00.17.52; Sat, 24 Nov 2018 00:18:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502788AbeKWUKb (ORCPT + 99 others); Fri, 23 Nov 2018 15:10:31 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49411 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393935AbeKWUK0 (ORCPT ); Fri, 23 Nov 2018 15:10:26 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 31BD820DEB; Fri, 23 Nov 2018 10:26:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 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 Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , linux-sunxi@googlegroups.com, Daniel Vetter , Paul Kocialkowski 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.19.1