From patchwork Sat Aug 22 16:32:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11732253 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9651F1510 for ; Mon, 24 Aug 2020 06:56:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 752BB2067C for ; Mon, 24 Aug 2020 06:56:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="ikS9LtxX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 752BB2067C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=crapouillou.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F4986EC7A; Mon, 24 Aug 2020 06:55:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from crapouillou.net (crapouillou.net [89.234.176.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD8D36E49D for ; Sat, 22 Aug 2020 16:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1598113986; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OpSFEylgpgBKh2P6uwfTBIT/WcJC6e5Uy+yuu1dkY14=; b=ikS9LtxXMYk4VZ/d4VFVzK/DGbochn/rlwxY2WcP3BfuhmvW113EUnZ23LGqlDNwLIF8H7 kNwhaZ9PHllpr4B7eA8ZcuNLmOuxOElZW3TG90zmU/QdtKnzOSKGCozbJypCrD3i6pc1wC 1RhWxZ1UoY2SKyVmyQTEF2CevnWTfJw= From: Paul Cercueil To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Noralf Tronnes , Laurent Pinchart , Linus Walleij Subject: [PATCH v2 1/6] dt-bindings: display: Document NewVision NV3052C DT node Date: Sat, 22 Aug 2020 18:32:45 +0200 Message-Id: <20200822163250.63664-2-paul@crapouillou.net> In-Reply-To: <20200822163250.63664-1-paul@crapouillou.net> References: <20200822163250.63664-1-paul@crapouillou.net> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 24 Aug 2020 06:55:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Cercueil , devicetree@vger.kernel.org, od@zcrc.me, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add documentation for the Device Tree node for LCD panels based on the NewVision NV3052C controller. v2: - Support backlight property - Add *-supply properties for the 5 different power supplies. Either they must all be present, or 'power-supply' must be present. - Reword description to avoid confusion about 'driver' - Use 4-space indent in example Signed-off-by: Paul Cercueil Reviewed-by: Rob Herring Reviewed-by: Linus Walleij --- .../display/panel/newvision,nv3052c.yaml | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml diff --git a/Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml b/Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml new file mode 100644 index 000000000000..0468ddeaff2d --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/newvision,nv3052c.yaml @@ -0,0 +1,100 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/newvision,nv3052c.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NewVision NV3052C TFT LCD panel driver with SPI control bus + +maintainers: + - Paul Cercueil + +description: | + This is a IC driver for TFT panels, accepting a variety of input + streams that get adapted and scaled to the panel. + + The panel must obey the rules for a SPI slave device as specified in + spi/spi-controller.yaml + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + items: + - enum: + - leadtek,ltk035c5444t-spi + + - const: newvision,nv3052c + + reg: + maxItems: 1 + + reset-gpios: true + power-supply: true + backlight: true + port: true + + vci-supply: + description: + Power supply for analog circuits (VCI=2.5V to 6V) + + vddam-supply: + description: + Power Supply for MIPI regulator circuits (VDDAM=1.75V to 6V) + + iovcc-supply: + description: | + External Power Supply for IO pads and other logic circuits + (IOVCC=1.65 to 3.6V) + + pprech-supply: + description: + Pre-charge power for source (can be connected to IOVCC or VCI) + + vpp-supply: + description: + Input power for NV memory programming (8.0V ~ 8.5V, typical=8.25V) + +required: + - compatible + - reg + +oneOf: + - required: + - power-supply + - required: + - vci-supply + - vddam-supply + - iovcc-supply + - pprech-supply + - vpp-supply + +unevaluatedProperties: false + +examples: + - | + #include + spi { + #address-cells = <1>; + #size-cells = <0>; + + display@0 { + compatible = "leadtek,ltk035c5444t-spi", "newvision,nv3052c"; + reg = <0>; + + spi-max-frequency = <15000000>; + spi-3wire; + reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>; + backlight = <&backlight>; + power-supply = <&vcc>; + + port { + panel_input: endpoint { + remote-endpoint = <&panel_output>; + }; + }; + }; + }; + +... From patchwork Sat Aug 22 16:32:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11732241 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EB1C1510 for ; Mon, 24 Aug 2020 06:56:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D2022067C for ; Mon, 24 Aug 2020 06:56:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="NCRk5hkR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D2022067C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=crapouillou.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E9B26EC69; Mon, 24 Aug 2020 06:55:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from crapouillou.net (crapouillou.net [89.234.176.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 392A66E49F for ; Sat, 22 Aug 2020 16:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1598113988; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WfNRbEJZEnZc9fPSpxagPZ7k9KHz4hXzsq1mWzAp208=; b=NCRk5hkRilgxRq0Rsghrw0pYFe2GgMPQ2b2bd1C6qDeg+dSdFiccudS0g0qjqoNNhwbtvb xb4kaVhnlY5WGyFh49dh/nBrC0fRzIqthhwkKDb2vppclFoywaFOhl9WeIZFMIc1bAr5Wc bicCCERlHhxA7tGgYAo7+CgjtSwlvnI= From: Paul Cercueil To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Noralf Tronnes , Laurent Pinchart , Linus Walleij Subject: [PATCH v2 2/6] drm: dsi: Let host and device specify supported bus Date: Sat, 22 Aug 2020 18:32:46 +0200 Message-Id: <20200822163250.63664-3-paul@crapouillou.net> In-Reply-To: <20200822163250.63664-1-paul@crapouillou.net> References: <20200822163250.63664-1-paul@crapouillou.net> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 24 Aug 2020 06:55:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Cercueil , devicetree@vger.kernel.org, od@zcrc.me, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current MIPI DSI framework can very well be used to support MIPI DBI panels. In order to add support for the various bus types supported by DBI, the DRM panel drivers should specify the bus type they will use, and the DSI host drivers should specify the bus types they are compatible with. The DSI host driver can then use the information provided by the DBI/DSI device driver, such as the bus type and the number of lanes, to configure its hardware properly. v2: - Remove the WARN_ON_ONCE() if (dbi->bus_types == 0), because it will trigger for every panel out there. Just default to MIPI_DCS_BUS_TYPE_DSI if the bitmask is not populated. - Create a 'enum mipi_dcs_bus_type' instead of macros - Rename values to avoid confusion about SPI modes Signed-off-by: Paul Cercueil --- drivers/gpu/drm/drm_mipi_dsi.c | 9 +++++++++ include/drm/drm_mipi_dsi.h | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 5dd475e82995..a3cbea8019cc 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -281,6 +281,9 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host) { struct device_node *node; + if (!host->bus_types) + host->bus_types = MIPI_DCS_BUS_TYPE_DSI; + for_each_available_child_of_node(host->dev->of_node, node) { /* skip nodes without reg property */ if (!of_find_property(node, "reg", NULL)) @@ -323,6 +326,12 @@ int mipi_dsi_attach(struct mipi_dsi_device *dsi) { const struct mipi_dsi_host_ops *ops = dsi->host->ops; + if (!dsi->bus_type) + dsi->bus_type = MIPI_DCS_BUS_TYPE_DSI; + + if (!(dsi->bus_type & dsi->host->bus_types)) + return -EINVAL; + if (!ops || !ops->attach) return -ENOSYS; diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 360e6377e84b..802644c4c0c4 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -63,6 +63,27 @@ struct mipi_dsi_packet { int mipi_dsi_create_packet(struct mipi_dsi_packet *packet, const struct mipi_dsi_msg *msg); +/** + * enum mipi_dcs_bus_type - MIPI DCS bus types + * @MIPI_DCS_BUS_TYPE_DSI: MIPI DSI + * @MIPI_DCS_BUS_TYPE_DBI_SPI_C1: DBI with SPI carrier, 9 bits per word, with + * the data/command information in the 9th (MSB) bit + * @MIPI_DCS_BUS_TYPE_DBI_SPI_C2: DBI with SPI carrier, 16 bits per word, with + * the data/command information in the 9th bit, and 7 MSB bits of padding + * @MIPI_DCS_BUS_TYPE_DBI_SPI_C3: DBI with SPI carrier, 8 bits per word, with + * the data/command information carried by a separate GPIO + * @MIPI_DCS_BUS_TYPE_DBI_M6800: Motorola 6800 type parallel bus + * @MIPI_DCS_BUS_TYPE_DBI_I8080: Intel 8080 type parallel bus + */ +enum mipi_dcs_bus_type { + MIPI_DCS_BUS_TYPE_DSI = BIT(0), + MIPI_DCS_BUS_TYPE_DBI_SPI_C1 = BIT(1), + MIPI_DCS_BUS_TYPE_DBI_SPI_C2 = BIT(2), + MIPI_DCS_BUS_TYPE_DBI_SPI_C3 = BIT(3), + MIPI_DCS_BUS_TYPE_DBI_M6800 = BIT(4), + MIPI_DCS_BUS_TYPE_DBI_I8080 = BIT(5), +}; + /** * struct mipi_dsi_host_ops - DSI bus operations * @attach: attach DSI device to DSI host @@ -94,11 +115,13 @@ struct mipi_dsi_host_ops { * struct mipi_dsi_host - DSI host device * @dev: driver model device node for this DSI host * @ops: DSI host operations + * @bus_types: Bitmask of supported MIPI bus types (enum mipi_dcs_bus_type) * @list: list management */ struct mipi_dsi_host { struct device *dev; const struct mipi_dsi_host_ops *ops; + unsigned int bus_types; struct list_head list; }; @@ -162,6 +185,7 @@ struct mipi_dsi_device_info { * @host: DSI host for this peripheral * @dev: driver model device node for this peripheral * @name: DSI peripheral chip type + * @bus_type: MIPI bus type * @channel: virtual channel assigned to the peripheral * @format: pixel format for video mode * @lanes: number of active data lanes @@ -178,6 +202,7 @@ struct mipi_dsi_device { struct device dev; char name[DSI_DEV_NAME_SIZE]; + enum mipi_dcs_bus_type bus_type; unsigned int channel; unsigned int lanes; enum mipi_dsi_pixel_format format; From patchwork Sat Aug 22 16:32:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 11732233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DF971510 for ; Mon, 24 Aug 2020 06:55:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F02172067C for ; Mon, 24 Aug 2020 06:55:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="Ep+wl6yA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F02172067C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=crapouillou.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8549B6EC63; Mon, 24 Aug 2020 06:55:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from crapouillou.net (crapouillou.net [89.234.176.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 534D16E49D for ; Sat, 22 Aug 2020 16:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1598113990; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VOADsf+zkaa1JPcnuwuK9JFkqtkUN121yhXN3FKMvOY=; b=Ep+wl6yA0yE8XujoZQ6btOAQ279oBjOy45Ow/JBcHJtGy5ZXQHk1rDrRbfBxqe5B1V3Y7X UIarEkz8KvQXNQBOHnV5IqTdgWr+47DruOJek+25sNNWrGEQQfrw0iUoi8k4EihXyPgVmO KCPinisdWvjOh/ix6gwIUVhWYNRGyT8= From: Paul Cercueil To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Noralf Tronnes , Laurent Pinchart , Linus Walleij Subject: [PATCH v2 3/6] drm: Add SPI DBI host driver Date: Sat, 22 Aug 2020 18:32:47 +0200 Message-Id: <20200822163250.63664-4-paul@crapouillou.net> In-Reply-To: <20200822163250.63664-1-paul@crapouillou.net> References: <20200822163250.63664-1-paul@crapouillou.net> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 24 Aug 2020 06:55:41 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Cercueil , devicetree@vger.kernel.org, od@zcrc.me, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This driver will register a DBI host driver for panels connected over SPI. DBI types c1 and c3 are supported. C1 is a SPI protocol with 9 bits per word, with the data/command information in the 9th (MSB) bit. C3 is a SPI protocol with 8 bits per word, with the data/command information carried by a separate GPIO. v2: - Move ouside of drivers/gpu/drm/bridge/ - The client drivers should now use module_mipi_dbi_spi_driver(). This ensures that the panel drivers can probe from the DSI/DBI bus, as well as from the SPI bus, using a shared OF match table. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/Kconfig | 8 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_mipi_dbi_spi.c | 247 +++++++++++++++++++++++++++++ include/drm/drm_mipi_dbi_spi.h | 42 +++++ 4 files changed, 298 insertions(+) create mode 100644 drivers/gpu/drm/drm_mipi_dbi_spi.c create mode 100644 include/drm/drm_mipi_dbi_spi.h diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 147d61b9674e..932c7bcaeff0 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -32,6 +32,14 @@ config DRM_MIPI_DSI bool depends on DRM +config DRM_MIPI_DBI_SPI + tristate "SPI host support for MIPI DBI" + depends on DRM && OF && SPI + select DRM_MIPI_DSI + select DRM_MIPI_DBI + help + Enable this option to support DBI panels connected over SPI. + config DRM_DP_AUX_CHARDEV bool "DRM DP AUX Interface" depends on DRM diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 2f31579f91d4..8c60448a3ee5 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -60,6 +60,7 @@ obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/ obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o +obj-$(CONFIG_DRM_MIPI_DBI_SPI) += drm_mipi_dbi_spi.o obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o obj-y += arm/ obj-$(CONFIG_DRM_TTM) += ttm/ diff --git a/drivers/gpu/drm/drm_mipi_dbi_spi.c b/drivers/gpu/drm/drm_mipi_dbi_spi.c new file mode 100644 index 000000000000..a7eaf3125a17 --- /dev/null +++ b/drivers/gpu/drm/drm_mipi_dbi_spi.c @@ -0,0 +1,247 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * MIPI Display Bus Interface (DBI) SPI support + * + * Copyright 2016 Noralf Trønnes + * Copyright 2020 Paul Cercueil + */ + +#include +#include +#include + +#include +#include + +#include