From patchwork Tue Feb 22 08:47:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Krummenacher X-Patchwork-Id: 12754660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71580C433F5 for ; Tue, 22 Feb 2022 08:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=3LPTILO1aKMIIxcGNLzt1jtE+1J+SFmOg1I6yqANt2I=; b=M4o0G1bMWNdMB2 6ilCSaQmgOwnuLq6Qk67BmEk3gLB3QPeVzRyzmMY4lKIRCggFXDjDK0wWIYlpqiAPngNHwkb07jSO qnkjooEVo3ruCJdWPoIMSWwUPwgPsNYOtf7xm16NvLI5tjCQPd3ByPdXZXXXF+vN7+7Z367mk5NvL UYiBIJPy8QrBTyfeJU3Mo2yYCag3ZINoDjeuqm7Z7T+0hD0m6j2yb1cVdtfOB3ApkxKngsiIUlgpV LXoFjXii19Vu/3JR5MqHcKT/rvdOZ6Qc1OcmhaT9R8AKjSTQYm3sFst7pECeSt95QRWg+BQsbD0wn dqXnD+r2NIv57zTVGrzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMQpu-008aNG-OH; Tue, 22 Feb 2022 08:47:54 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMQpq-008aLT-3o for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 08:47:51 +0000 Received: by mail-wm1-x32c.google.com with SMTP id y5so576568wmi.0 for ; Tue, 22 Feb 2022 00:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UA23N42q/lRoQ03s/G51RuYi88oEfXR7cAXj33qu0L4=; b=QhojUfQRth8kFmKIYEISF2TmE7MQkUt3yWjyXHIu4C5TmXpgwVKIADdh6tXITaGCph xebvCFHaGT6+RUZ7vYkvxZdYrCt7UluX7kZwIRudM2nxGyIaQ1wQQiOutbtxj+QDHiAT kEj4FJ74AFUnrI6nzIYtOe/1EC69MrQdxTLKCeDBQeR1/UuRhK7AYLf4erpSWWIZqJKD OPThzFv+T1btYPEtM743lGWWHAa5KZnaFNHjKoHh55Qcygr6CdEhHH56WYrmkmX3E/AZ oMcv9xnR338eHew35wtUQl6OO+vDCQqhlRtk7iK6wCh+nDVZnt02v1ZxrgjGg2VZvQ30 0pcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UA23N42q/lRoQ03s/G51RuYi88oEfXR7cAXj33qu0L4=; b=Wwy2mtVod/K3qvYCNfAEAAe7KsOP4gvlGt5kKhEe4jx9TMKvQ0ROBfqBk9EYmqDnTP auY3x7rXXkKqnbnQbvxtwtNcB2g4wliLYXagyinWfMNn4MZgUBhJUuXoNZDj2TUGVrW3 cRy4ZyI7s+4TMFXoq5lA/X9kXcTq9G0oruN2xJUOWopD2ybUfGCxRf8VewyRWLpc4gup xILZeHl0pTlZyIFtCH1TLmSHZ/P5QON/utCq/mNKZOayuz9UdXms2sqGK3gY5AG3Dfaa ZjR1y3HsUB2sKgEgLGgC9bcdEuOFWde1aAwxOJURZdyUhL7l9iHpiRESRLVDS9jOTD5Y ioUg== X-Gm-Message-State: AOAM5337AfgjT5V4hDaCvgN4UEKSQPnnEDEk24t2NAsCd7f6BrAsU44I 1YdaFf1xqgaSnUfu/5WdU4k= X-Google-Smtp-Source: ABdhPJwVEJ5ythwuNO7BkCRHp8zihw31svxZXWmQ+RmQO7NmQ5pyT7zvV1X64X9bJfEJ9+OwHlw7tQ== X-Received: by 2002:a05:600c:35c4:b0:37c:debf:6f2d with SMTP id r4-20020a05600c35c400b0037cdebf6f2dmr2343135wmq.142.1645519668271; Tue, 22 Feb 2022 00:47:48 -0800 (PST) Received: from linuxdev2.toradex.int (31-10-206-124.static.upc.ch. [31.10.206.124]) by smtp.gmail.com with ESMTPSA id t30sm1037919wra.19.2022.02.22.00.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 00:47:47 -0800 (PST) From: Max Krummenacher X-Google-Original-From: Max Krummenacher To: dri-devel@lists.freedesktop.org Cc: Sascha Hauer , Philipp Zabel , Laurent Pinchart , Maxime Ripard , Fabio Estevam , linux-arm-kernel@lists.infradead.org, DenysDrozdov , David Airlie , Christoph Niedermaier , Pengutronix Kernel Team , Sam Ravnborg , Shawn Guo , Daniel Vetter , Marek Vasut , NXP Linux Team , Max Krummenacher Subject: [RFC PATCH] drm/panel: simple: panel-dpi: use bus-format to set bpc and bus_format Date: Tue, 22 Feb 2022 09:47:23 +0100 Message-Id: <20220222084723.14310-1-max.krummenacher@toradex.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220222_004750_180293_18508DB7 X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the new property bus-format to set the enum bus_format and bpc. Completes: commit 4a1d0dbc8332 ("drm/panel: simple: add panel-dpi support") Signed-off-by: Max Krummenacher --- drivers/gpu/drm/panel/panel-simple.c | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) Relates to the discussion: https://lore.kernel.org/all/20220201110717.3585-1-cniedermaier@dh-electronics.com/ Max diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index c5f133667a2d..5c07260de71c 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -453,6 +453,7 @@ static int panel_dpi_probe(struct device *dev, struct panel_desc *desc; unsigned int bus_flags; struct videomode vm; + const char *format = ""; int ret; np = dev->of_node; @@ -477,6 +478,37 @@ static int panel_dpi_probe(struct device *dev, of_property_read_u32(np, "width-mm", &desc->size.width); of_property_read_u32(np, "height-mm", &desc->size.height); + of_property_read_string(np, "bus-format", &format); + if (!strcmp(format, "BGR888_1X24")) { + desc->bpc = 8; + desc->bus_format = MEDIA_BUS_FMT_BGR888_1X24; + } else if (!strcmp(format, "GBR888_1X24")) { + desc->bpc = 8; + desc->bus_format = MEDIA_BUS_FMT_GBR888_1X24; + } else if (!strcmp(format, "RBG888_1X24")) { + desc->bpc = 8; + desc->bus_format = MEDIA_BUS_FMT_RBG888_1X24; + } else if (!strcmp(format, "RGB444_1X12")) { + desc->bpc = 6; + desc->bus_format = MEDIA_BUS_FMT_RGB444_1X12; + } else if (!strcmp(format, "RGB565_1X16")) { + desc->bpc = 6; + desc->bus_format = MEDIA_BUS_FMT_RGB565_1X16; + } else if (!strcmp(format, "RGB666_1X18")) { + desc->bpc = 6; + desc->bus_format = MEDIA_BUS_FMT_RGB666_1X18; + } else if (!strcmp(format, "RGB666_1X24_CPADHI")) { + desc->bpc = 6; + desc->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI; + } else if (!strcmp(format, "RGB888_1X24")) { + desc->bpc = 8; + desc->bus_format = MEDIA_BUS_FMT_RGB888_1X24; + } else { + dev_err(dev, "%pOF: missing or unknown bus-format property\n", + np); + return -EINVAL; + } + /* Extract bus_flags from display_timing */ bus_flags = 0; vm.flags = timing->flags;