Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3217011imu; Sat, 24 Nov 2018 00:19:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/U/WTPQikWuIEv1qWTCUKwJanZ1Ej9GRofqCsmGq0rhXsimShnPkvroy4oqeQZVyrLnGPdC X-Received: by 2002:a63:507:: with SMTP id 7mr13821706pgf.411.1543047594958; Sat, 24 Nov 2018 00:19:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047594; cv=none; d=google.com; s=arc-20160816; b=NAJKyCf+QvEWtQ464yY9u1e5KK/Dvg6qdfOGoIlMrL06IQu9a0MvMo/uywP7LZLcE/ VVcOKRtUzglIzZllqTn8HKbmv+4zF2ORekobkOqhWAwgXYAk8x8wbZJNEGEdMj5p+Hkh catYa5EZj+2FTWCxjup/d1nEktw21T4hHiLHDnHnJRbKF4jR+1rKoYOvn0EBTtmLWYSQ yoK3wL0ZUloaJwmn5qA/hluxh8Pt6F9OPnsfdPepQ2GzqPz9qVTMSp2dvxN6iZ03Vqjm mC3AvL94PqZgwmJQoS8GQJMh5vQXMyrrVKIWp6AV3mrr4nu9z/8H3NzrlYoDh56po1ST n7gA== 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=QJSuzhnfg8k9oynXdbgpTf2Z7q/l61cQ8aTZkKk9m34=; b=apd0Ic4nRzdb7Q3kRdl2oA4i1MHI/K1hGEneFE7VBRcl0jfikDLsEqWRk7mg96jcJt +9O4dT4El3t6LwjWKXxdELRvdV/M2IP9sjjLzlgCggJn+xRrscnuYLr84McXRUz/A1pT UQVnqLdkVXxWCTHnZsIbDLM0y7M5CFDh49VtOI4YmvuUzH3Jn0w2o4eaDZVwLuLr0VGw 3GIaUWMmEARkpy0MSq4FsvJFkLOWD5DLcRJ7Q+0eRBaphy97PVRBDYKhwn1pksFgqHj6 ocAnRPBZ2oEej5Ou+iYP08LlcFd/jp6AjonvvgbGmAAqMazgrpRLSozOmIIMhu7I/4Y+ f98g== 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 d12si46268121pga.506.2018.11.24.00.19.40; Sat, 24 Nov 2018 00:19:54 -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 S2502592AbeKWUNL (ORCPT + 99 others); Fri, 23 Nov 2018 15:13:11 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49334 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393938AbeKWUK0 (ORCPT ); Fri, 23 Nov 2018 15:10:26 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 23D3F20DE5; 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 A8AD320DED; 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 20/43] drm/sun4i: frontend: Determine input format based on colorspace Date: Fri, 23 Nov 2018 10:24:52 +0100 Message-Id: <20181123092515.2511-21-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 Since all the RGB input formats have the same value for the DATA_FMT field of the INPUT_FMT register, we can group them when the format is known to be RGB. Here, we assume that a non-YUV format is RGB, because the hardware does not support any other colorspace than RGB and YUV. Thus, we can use the associated common DRM helper. 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 a16697b0eac5..7a8efbd516ac 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -106,14 +106,12 @@ EXPORT_SYMBOL(sun4i_frontend_update_buffer); static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val) { - switch (fmt) { - case DRM_FORMAT_XRGB8888: + if (!drm_format_is_yuv(fmt)) *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB; - return 0; - - default: + else return -EINVAL; - } + + return 0; } static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val) -- 2.19.1