Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1680087rdb; Wed, 16 Aug 2023 21:07:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH681F9RsGhHuPCPWqOgSw4wXGn5Eos+eZ3tGaCOXh1KTwzE+5PoB6U+I7tXTXBOV9qW9Gg X-Received: by 2002:a05:6402:12c3:b0:523:37f0:2d12 with SMTP id k3-20020a05640212c300b0052337f02d12mr1875450edx.17.1692245250355; Wed, 16 Aug 2023 21:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692245250; cv=none; d=google.com; s=arc-20160816; b=MkV89qeB6mdfjjUahBy+Qtzj40jHfvNaAV0YsenhWP61XCgIXhzdp2k8DiQOuLQNpL 67sLD/1ujuYModnPdd0YbhG1/5cyVI66nMwpXoAKEGMKpnE6P1+GPdw1hsPAyJdKfOfr yYCTHhIJW3jlkwQreN5BQRhU+E/M1C7dZCL0taPXNs9i5w8OPu1mmnMk1KNv2H0zWsVB e1/J1S0v8SPhwpmOMvojYO6U4I389aoRS/gh4RVAFndB6xJCGnvYti6TGMo3mxulGUwf DF7/E0p1aEFaUKceiUnSoTdTinDt1RlLBM0wA/Pnuf3rN8rM8mQRSKT4jWamS50jNuXV tySw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wiD60DM2aZAHXEqWHhIp+wb6uRNLpwm+stk3XrVMmZY=; fh=UWUHlpYIyaM7sVynBT5Ky7qldVK8D81neqNGmwj4p+c=; b=epAbU+pSX9hwHLDbg8p+ODOg8kOLdefATFwMBjOUD+JEBARsYaNM2gG7IyTv1jk3qt 17erbPQmcBk3OSci7cvr0J8RawigENxCymu8oKrnwSM28viCeMQQEKjvepcyEqYoDtZe 5PNUNb77ZF0HnpfRnued11K1M9MG/N4sUhdI4Jsk5cNrkCqvwqhaAGwhXz2qrM3+Kh3c js/QppUPk1YOkV6m/EFNERzrFBBZbQHcSiY/dmFll0IErjCw45loL5l/Kue1XWSMc7PY /7QUihqaZVohQgig8br/oF3YprOnTdbApwc7CIKMtpqzljM95Ntka9xH2t8Y0chNF4+7 SEVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j22-20020aa7c0d6000000b00523b4d7af90si11190720edp.565.2023.08.16.21.07.06; Wed, 16 Aug 2023 21:07:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244112AbjHPKpR (ORCPT + 99 others); Wed, 16 Aug 2023 06:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244048AbjHPKpB (ORCPT ); Wed, 16 Aug 2023 06:45:01 -0400 Received: from andre.telenet-ops.be (andre.telenet-ops.be [IPv6:2a02:1800:120:4::f00:15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05D3E2D5F for ; Wed, 16 Aug 2023 03:44:42 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:5d0c:f209:12a7:4ce5]) by andre.telenet-ops.be with bizsmtp id aAkg2A00U45ualL01AkgCW; Wed, 16 Aug 2023 12:44:41 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1qWE0w-000os0-EB; Wed, 16 Aug 2023 12:44:40 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1qWDAw-006761-RX; Wed, 16 Aug 2023 11:50:50 +0200 From: Geert Uytterhoeven To: Laurent Pinchart , Kieran Bingham , David Airlie , Daniel Vetter , Thomas Zimmermann , Magnus Damm Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v3 24/41] drm: renesas: shmobile: Use media bus formats in platform data Date: Wed, 16 Aug 2023 11:50:31 +0200 Message-Id: <24f997286075a71b85d1d148b69f4303cfe7e2c9.1692178020.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace the custom shmob_drm_interface enumeration values with standard media bus formats. This simplifies driver handling of bus formats and prepares for DT support. Signed-off-by: Geert Uytterhoeven --- v3: - No changes, v2: - Keep table instead of replacing it by a switch() statement, - Fix shmob_drm_interface_data.bus_fmt comment. --- .../gpu/drm/renesas/shmobile/shmob_drm_drv.c | 37 +++++++++++-------- include/linux/platform_data/shmob_drm.h | 13 +------ 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c index c9ac8a86a7c39097..08b254f0f2874786 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -34,25 +35,31 @@ static int shmob_drm_init_interface(struct shmob_drm_device *sdev) { - static const u32 ldmt1r[] = { - [SHMOB_DRM_IFACE_RGB8] = LDMT1R_MIFTYP_RGB8, - [SHMOB_DRM_IFACE_RGB9] = LDMT1R_MIFTYP_RGB9, - [SHMOB_DRM_IFACE_RGB12A] = LDMT1R_MIFTYP_RGB12A, - [SHMOB_DRM_IFACE_RGB12B] = LDMT1R_MIFTYP_RGB12B, - [SHMOB_DRM_IFACE_RGB16] = LDMT1R_MIFTYP_RGB16, - [SHMOB_DRM_IFACE_RGB18] = LDMT1R_MIFTYP_RGB18, - [SHMOB_DRM_IFACE_RGB24] = LDMT1R_MIFTYP_RGB24, - [SHMOB_DRM_IFACE_YUV422] = LDMT1R_MIFTYP_YCBCR, + static const struct { + u32 fmt; + u32 ldmt1r; + } bus_fmts[] = { + { MEDIA_BUS_FMT_RGB888_3X8, LDMT1R_MIFTYP_RGB8 }, + { MEDIA_BUS_FMT_RGB666_2X9_BE, LDMT1R_MIFTYP_RGB9 }, + { MEDIA_BUS_FMT_RGB888_2X12_BE, LDMT1R_MIFTYP_RGB12A }, + { MEDIA_BUS_FMT_RGB444_1X12, LDMT1R_MIFTYP_RGB12B }, + { MEDIA_BUS_FMT_RGB565_1X16, LDMT1R_MIFTYP_RGB16 }, + { MEDIA_BUS_FMT_RGB666_1X18, LDMT1R_MIFTYP_RGB18 }, + { MEDIA_BUS_FMT_RGB888_1X24, LDMT1R_MIFTYP_RGB24 }, + { MEDIA_BUS_FMT_UYVY8_1X16, LDMT1R_MIFTYP_YCBCR }, }; + unsigned int i; - if (sdev->pdata->iface.interface >= ARRAY_SIZE(ldmt1r)) { - dev_err(sdev->dev, "invalid interface type %u\n", - sdev->pdata->iface.interface); - return -EINVAL; + for (i = 0; i < ARRAY_SIZE(bus_fmts); i++) { + if (bus_fmts[i].fmt == sdev->pdata->iface.bus_fmt) { + sdev->ldmt1r = bus_fmts[i].ldmt1r; + return 0; + } } - sdev->ldmt1r = ldmt1r[sdev->pdata->iface.interface]; - return 0; + dev_err(sdev->dev, "unsupported bus format 0x%x\n", + sdev->pdata->iface.bus_fmt); + return -EINVAL; } static int shmob_drm_setup_clocks(struct shmob_drm_device *sdev, diff --git a/include/linux/platform_data/shmob_drm.h b/include/linux/platform_data/shmob_drm.h index f3cb19ff9f818aca..6c19d4fbbe39586b 100644 --- a/include/linux/platform_data/shmob_drm.h +++ b/include/linux/platform_data/shmob_drm.h @@ -18,17 +18,6 @@ enum shmob_drm_clk_source { SHMOB_DRM_CLK_EXTERNAL, }; -enum shmob_drm_interface { - SHMOB_DRM_IFACE_RGB8, /* 24bpp, 8:8:8 */ - SHMOB_DRM_IFACE_RGB9, /* 18bpp, 9:9 */ - SHMOB_DRM_IFACE_RGB12A, /* 24bpp, 12:12 */ - SHMOB_DRM_IFACE_RGB12B, /* 12bpp */ - SHMOB_DRM_IFACE_RGB16, /* 16bpp */ - SHMOB_DRM_IFACE_RGB18, /* 18bpp */ - SHMOB_DRM_IFACE_RGB24, /* 24bpp */ - SHMOB_DRM_IFACE_YUV422, /* 16bpp */ -}; - struct shmob_drm_panel_data { unsigned int width_mm; /* Panel width in mm */ unsigned int height_mm; /* Panel height in mm */ @@ -36,7 +25,7 @@ struct shmob_drm_panel_data { }; struct shmob_drm_interface_data { - enum shmob_drm_interface interface; + unsigned int bus_fmt; /* MEDIA_BUS_FMT_* */ unsigned int clk_div; }; -- 2.34.1