From patchwork Fri May 15 13:12:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11551481 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 5B0451391 for ; Fri, 15 May 2020 13:12:31 +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 45EC9206D4 for ; Fri, 15 May 2020 13:12:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45EC9206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org 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 30FF96EC2D; Fri, 15 May 2020 13:12:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id D3D196E187 for ; Fri, 15 May 2020 13:12:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 52834FB02; Fri, 15 May 2020 15:12:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id f2J9qBn8ahqL; Fri, 15 May 2020 15:12:16 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 686394458A; Fri, 15 May 2020 15:12:15 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andrzej Hajda , Sam Ravnborg , Anson Huang , Leonard Crestez , Lucas Stach , Peng Fan , Robert Chiras , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 1/6] dt-bindings: display/bridge: Add binding for input mux bridge Date: Fri, 15 May 2020 15:12:10 +0200 Message-Id: <14a44a664f40584ffa25c1764aab5ebf97809c71.1589548223.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The bridge allows to select the input source via a mux controller. Signed-off-by: Guido Günther --- .../display/bridge/mux-input-bridge.yaml | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/mux-input-bridge.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/mux-input-bridge.yaml b/Documentation/devicetree/bindings/display/bridge/mux-input-bridge.yaml new file mode 100644 index 000000000000..4029cf63ee5c --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/mux-input-bridge.yaml @@ -0,0 +1,123 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/mux-input-bridge.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: DRM input source selection via multiplexer + +maintainers: + - Guido Gúnther + +description: | + The input multiplexer bridge allows to select an input source + via an associated mux controller. + +properties: + compatible: + const: mux-input-bridge + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + default-input: + description: The default input to use + + mux-controls: + description: + mux controller node to use for operating the input mux + + ports: + type: object + properties: + '#address-cells': + const: 1 + '#size-cells': + const: 0 + + patternProperties: + "^port@[0-9]+": + type: object + description: + At least three nodes containing endpoints connecting to the + pixel data inputs and outputs. The last port is always the + output port. + + properties: + reg: + maxItems: 1 + + endpoint: + description: sub-node describing the input + type: object + + required: + - reg + + additionalProperties: false + + required: + - port@0 + - port@1 + - port@2 + + additionalProperties: false + +required: + - '#address-cells' + - '#size-cells' + - mux-controls + - ports + +additionalProperties: false + +examples: + - | + #include + + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + + mux-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; + }; + + mipi-mux { + compatible = "mux-input-bridge"; + default-input = <0>; + mux-controls = <&mux 0>; + #address-cells = <1>; + #size-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + dpi_mux_from_lcdif: endpoint { + remote-endpoint = <&lcdif_dpi_out>; + }; + }; + + port@1 { + reg = <1>; + + dpi_mux_from_dccss: endpoint { + remote-endpoint = <&dcss_dpi_out>; + }; + }; + + port@2 { + reg = <2>; + + dpi_mux_out: endpoint { + remote-endpoint = <&nwl_dpi_in>; + }; + }; + }; + }; From patchwork Fri May 15 13:12:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11551485 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 102CC1391 for ; Fri, 15 May 2020 13:12:36 +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 EF06D206D4 for ; Fri, 15 May 2020 13:12:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF06D206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org 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 1AC9F6EC99; Fri, 15 May 2020 13:12:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8743E6EC2D for ; Fri, 15 May 2020 13:12:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id E9585FB04; Fri, 15 May 2020 15:12:22 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ud4qQG39xKE9; Fri, 15 May 2020 15:12:19 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 6D3FB445A8; Fri, 15 May 2020 15:12:15 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andrzej Hajda , Sam Ravnborg , Anson Huang , Leonard Crestez , Lucas Stach , Peng Fan , Robert Chiras , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/6] drm/bridge: Add mux-input bridge Date: Fri, 15 May 2020 15:12:11 +0200 Message-Id: <1d4a97de9acea438f156092dfd1434eb160bf861.1589548223.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This bridge allows to select the input source via a mux controller. The input source is determined via DT but it could become rutime selectable in the future. Signed-off-by: Guido Günther --- drivers/gpu/drm/bridge/Kconfig | 9 ++ drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/mux-input.c | 238 +++++++++++++++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 drivers/gpu/drm/bridge/mux-input.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 04f876e985de..3886c0f41bdd 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -206,6 +206,15 @@ config DRM_TI_TPD12S015 Texas Instruments TPD12S015 HDMI level shifter and ESD protection driver. +config DRM_MUX_INPUT + tristate "Bridge to select a video input source" + depends on OF + depends on DRM_BRIDGE + select MULTIPLEXER + help + Select this option if you want to select the input source to + a DRM bridge or panel via a separate mux chip. + source "drivers/gpu/drm/bridge/analogix/Kconfig" source "drivers/gpu/drm/bridge/adv7511/Kconfig" diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index d63d4b7e4347..9f3370ce7e07 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o +obj-$(CONFIG_DRM_MUX_INPUT) += mux-input.o obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o diff --git a/drivers/gpu/drm/bridge/mux-input.c b/drivers/gpu/drm/bridge/mux-input.c new file mode 100644 index 000000000000..24961d41ac30 --- /dev/null +++ b/drivers/gpu/drm/bridge/mux-input.c @@ -0,0 +1,238 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2020 Purism SPC + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define DRV_NAME "mux-input-bridge" + +struct mux_input { + struct drm_bridge bridge; + struct drm_bridge *out; + struct device *dev; + struct mux_control *mux; + unsigned int n_inputs; + unsigned int input; + struct drm_bridge_timings timings; +}; + +static inline struct mux_input *bridge_to_mux_input(struct drm_bridge *bridge) +{ + return container_of(bridge, struct mux_input, bridge); +} + +static void mux_input_bridge_disable(struct drm_bridge *bridge) +{ + struct mux_input *mux_input = bridge_to_mux_input(bridge); + + pm_runtime_put(mux_input->dev); +} + +static void mux_input_bridge_pre_enable(struct drm_bridge *bridge) +{ + struct mux_input *mux_input = bridge_to_mux_input(bridge); + + pm_runtime_get(mux_input->dev); +} + +static int mux_input_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct mux_input *mux_input = bridge_to_mux_input(bridge); + struct drm_bridge *panel_bridge; + struct drm_panel *panel; + struct device *dev; + struct device_node *remote; + int ret; + + /* Only attach to the selected input */ + remote = of_graph_get_remote_node(mux_input->dev->of_node, + mux_input->input, + 0); + if (!remote) + return -EINVAL; + + if (bridge->dev) { + dev = bridge->dev->dev; + if (dev->of_node != remote) { + DRM_DEV_DEBUG(mux_input->dev, + "Not attaching to endpoint %s", + dev->of_node->name); + return -EINVAL; + } + } + of_node_put(remote); + + ret = drm_of_find_panel_or_bridge(mux_input->dev->of_node, + mux_input->n_inputs - 1, 0, &panel, + &panel_bridge); + if (ret) + return ret; + + if (panel) { + panel_bridge = drm_panel_bridge_add(panel); + if (IS_ERR(panel_bridge)) + return PTR_ERR(panel_bridge); + } + mux_input->out = panel_bridge; + + if (!mux_input->out) + return -EPROBE_DEFER; + + /* Bubble downstream bridge timings upwards */ + memcpy(&mux_input->timings, mux_input->out->timings, + sizeof(mux_input->timings)); + mux_input->bridge.timings = &mux_input->timings; + return drm_bridge_attach(bridge->encoder, mux_input->out, bridge, + flags); +} + +static void mux_input_bridge_detach(struct drm_bridge *bridge) +{ struct mux_input *mux_input = bridge_to_mux_input(bridge); + + drm_of_panel_bridge_remove(mux_input->dev->of_node, + mux_input->n_inputs - 1, 0); +} + +static const struct drm_bridge_funcs mux_input_bridge_funcs = { + .pre_enable = mux_input_bridge_pre_enable, + .disable = mux_input_bridge_disable, + .attach = mux_input_bridge_attach, + .detach = mux_input_bridge_detach, +}; + +static int mux_input_select_input(struct mux_input *mux_input) +{ + int ret; + + DRM_DEV_DEBUG(mux_input->dev, "Using input %d as pixel source\n", + mux_input->input); + ret = mux_control_try_select(mux_input->mux, mux_input->input); + if (ret < 0) { + DRM_DEV_ERROR(mux_input->dev, "Failed to select input: %d\n", + ret); + } + + return ret; +} + +static int mux_input_deselect_input(struct mux_input *mux_input) +{ + int ret; + + ret = mux_control_deselect(mux_input->mux); + if (ret < 0) { + DRM_DEV_ERROR(mux_input->dev, "Failed to deselect input: %d\n", + ret); + } + + return ret; +} + +static const struct of_device_id mux_input_dt_ids[] = { + { .compatible = "mux-input-bridge", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mux_input_dt_ids); + +static int mux_input_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; + struct device_node *ep; + struct mux_input *mux_input; + int ret; + + mux_input = devm_kzalloc(dev, sizeof(*mux_input), GFP_KERNEL); + if (!mux_input) + return -ENOMEM; + + mux_input->dev = dev; + + /* + * The largest numbered port is the output port. It determines + * total number of ports. + */ + for_each_endpoint_of_node(np, ep) { + struct of_endpoint endpoint; + + of_graph_parse_endpoint(ep, &endpoint); + mux_input->n_inputs = max(mux_input->n_inputs, + endpoint.port + 1); + } + + if (mux_input->n_inputs < 2) { + DRM_DEV_ERROR(dev, "Not enough ports %d\n", + mux_input->n_inputs); + return -EINVAL; + } + + if (device_property_read_u32(dev, "default-input", + &mux_input->input)) + mux_input->input = 0; + + if (mux_input->input > mux_input->n_inputs - 2) { + DRM_DEV_ERROR(dev, "Invalid default port %d\n", + mux_input->input); + return -EINVAL; + } + + mux_input->mux = devm_mux_control_get(dev, NULL); + if (IS_ERR(mux_input->mux)) { + ret = PTR_ERR(mux_input->mux); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(dev, "Failed to get mux: %d\n", ret); + return ret; + } + + mux_input->bridge.driver_private = mux_input; + mux_input->bridge.funcs = &mux_input_bridge_funcs; + mux_input->bridge.of_node = dev->of_node; + + dev_set_drvdata(dev, mux_input); + pm_runtime_enable(dev); + + ret = mux_input_select_input(mux_input); + if (ret < 0) { + pm_runtime_disable(&pdev->dev); + return ret; + } + + drm_bridge_add(&mux_input->bridge); + return 0; +} + +static int mux_input_remove(struct platform_device *pdev) +{ + struct mux_input *mux_input = platform_get_drvdata(pdev); + + mux_input_deselect_input(mux_input); + drm_bridge_remove(&mux_input->bridge); + pm_runtime_disable(&pdev->dev); + return 0; +} + +static struct platform_driver mux_input_driver = { + .probe = mux_input_probe, + .remove = mux_input_remove, + .driver = { + .of_match_table = mux_input_dt_ids, + .name = DRV_NAME, + }, +}; + +module_platform_driver(mux_input_driver); + +MODULE_AUTHOR("Purism SPC"); +MODULE_DESCRIPTION("Mux input bridge"); +MODULE_LICENSE("GPL"); From patchwork Fri May 15 13:12:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11551479 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 C1A4E139A for ; Fri, 15 May 2020 13:12:28 +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 ABF9B20759 for ; Fri, 15 May 2020 13:12:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABF9B20759 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org 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 D02746EC96; Fri, 15 May 2020 13:12:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id F1D696EC96 for ; Fri, 15 May 2020 13:12:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 76D87FB03; Fri, 15 May 2020 15:12:20 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g8I1dDNq2x7s; Fri, 15 May 2020 15:12:18 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 78087445AA; Fri, 15 May 2020 15:12:15 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andrzej Hajda , Sam Ravnborg , Anson Huang , Leonard Crestez , Lucas Stach , Peng Fan , Robert Chiras , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 3/6] dt-bindings: display/bridge/nwl-dsi: Drop mux handling Date: Fri, 15 May 2020 15:12:12 +0200 Message-Id: <9884c56219e9bdbeec179c27ea2b734dbb5f1289.1589548223.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" No need to encode the SoC specifics in the bridge driver. For the imx8mq we can use the mux-input-bridge. Signed-off-by: Guido Günther --- .../devicetree/bindings/display/bridge/nwl-dsi.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/nwl-dsi.yaml b/Documentation/devicetree/bindings/display/bridge/nwl-dsi.yaml index 8aff2d68fc33..d2c2d4e19a25 100644 --- a/Documentation/devicetree/bindings/display/bridge/nwl-dsi.yaml +++ b/Documentation/devicetree/bindings/display/bridge/nwl-dsi.yaml @@ -46,10 +46,6 @@ properties: - const: phy_ref - const: lcdif - mux-controls: - description: - mux controller node to use for operating the input mux - phys: maxItems: 1 description: @@ -151,7 +147,6 @@ required: - clocks - compatible - interrupts - - mux-controls - phy-names - phys - ports @@ -180,7 +175,6 @@ examples: <&clk IMX8MQ_CLK_LCDIF_PIXEL>; clock-names = "core", "rx_esc", "tx_esc", "phy_ref", "lcdif"; interrupts = ; - mux-controls = <&mux 0>; power-domains = <&pgc_mipi>; resets = <&src IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N>, <&src IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N>, From patchwork Fri May 15 13:12:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11551483 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 0F39E139A for ; Fri, 15 May 2020 13:12:34 +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 EDE7B206D4 for ; Fri, 15 May 2020 13:12:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EDE7B206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org 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 52C526EC98; Fri, 15 May 2020 13:12:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id C04476EC98 for ; Fri, 15 May 2020 13:12:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 0CC7DFB05; Fri, 15 May 2020 15:12:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id brG_Y9P4LUL8; Fri, 15 May 2020 15:12:20 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 86BB7445AB; Fri, 15 May 2020 15:12:15 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andrzej Hajda , Sam Ravnborg , Anson Huang , Leonard Crestez , Lucas Stach , Peng Fan , Robert Chiras , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 4/6] drm/bridge/nwl-dsi: Drop mux handling Date: Fri, 15 May 2020 15:12:13 +0200 Message-Id: <951688795f969ebcbf9fb3c38065ccce6f488235.1589548223.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This will be handled via the mux-input-bridge. Signed-off-by: Guido Günther --- drivers/gpu/drm/bridge/Kconfig | 1 - drivers/gpu/drm/bridge/nwl-dsi.c | 61 -------------------------------- 2 files changed, 62 deletions(-) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 3886c0f41bdd..11444f841e35 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -78,7 +78,6 @@ config DRM_NWL_MIPI_DSI select DRM_PANEL_BRIDGE select GENERIC_PHY_MIPI_DPHY select MFD_SYSCON - select MULTIPLEXER select REGMAP_MMIO help This enables the Northwest Logic MIPI DSI Host controller as diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c index b14d725bf609..8839f333f39c 100644 --- a/drivers/gpu/drm/bridge/nwl-dsi.c +++ b/drivers/gpu/drm/bridge/nwl-dsi.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -44,9 +43,6 @@ enum transfer_direction { DSI_PACKET_RECEIVE, }; -#define NWL_DSI_ENDPOINT_LCDIF 0 -#define NWL_DSI_ENDPOINT_DCSS 1 - struct nwl_dsi_plat_clk_config { const char *id; struct clk *clk; @@ -94,7 +90,6 @@ struct nwl_dsi { struct reset_control *rst_esc; struct reset_control *rst_dpi; struct reset_control *rst_pclk; - struct mux_control *mux; /* DSI clocks */ struct clk *phy_ref_clk; @@ -1018,14 +1013,6 @@ static int nwl_dsi_parse_dt(struct nwl_dsi *dsi) } dsi->tx_esc_clk = clk; - dsi->mux = devm_mux_control_get(dsi->dev, NULL); - if (IS_ERR(dsi->mux)) { - ret = PTR_ERR(dsi->mux); - if (ret != -EPROBE_DEFER) - DRM_DEV_ERROR(dsi->dev, "Failed to get mux: %d\n", ret); - return ret; - } - base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) return PTR_ERR(base); @@ -1073,47 +1060,6 @@ static int nwl_dsi_parse_dt(struct nwl_dsi *dsi) return 0; } -static int nwl_dsi_select_input(struct nwl_dsi *dsi) -{ - struct device_node *remote; - u32 use_dcss = 1; - int ret; - - remote = of_graph_get_remote_node(dsi->dev->of_node, 0, - NWL_DSI_ENDPOINT_LCDIF); - if (remote) { - use_dcss = 0; - } else { - remote = of_graph_get_remote_node(dsi->dev->of_node, 0, - NWL_DSI_ENDPOINT_DCSS); - if (!remote) { - DRM_DEV_ERROR(dsi->dev, - "No valid input endpoint found\n"); - return -EINVAL; - } - } - - DRM_DEV_INFO(dsi->dev, "Using %s as input source\n", - (use_dcss) ? "DCSS" : "LCDIF"); - ret = mux_control_try_select(dsi->mux, use_dcss); - if (ret < 0) - DRM_DEV_ERROR(dsi->dev, "Failed to select input: %d\n", ret); - - of_node_put(remote); - return ret; -} - -static int nwl_dsi_deselect_input(struct nwl_dsi *dsi) -{ - int ret; - - ret = mux_control_deselect(dsi->mux); - if (ret < 0) - DRM_DEV_ERROR(dsi->dev, "Failed to deselect input: %d\n", ret); - - return ret; -} - static const struct drm_bridge_timings nwl_dsi_timings = { .input_bus_flags = DRM_BUS_FLAG_DE_LOW, }; @@ -1175,12 +1121,6 @@ static int nwl_dsi_probe(struct platform_device *pdev) dev_set_drvdata(dev, dsi); pm_runtime_enable(dev); - ret = nwl_dsi_select_input(dsi); - if (ret < 0) { - mipi_dsi_host_unregister(&dsi->dsi_host); - return ret; - } - drm_bridge_add(&dsi->bridge); return 0; } @@ -1189,7 +1129,6 @@ static int nwl_dsi_remove(struct platform_device *pdev) { struct nwl_dsi *dsi = platform_get_drvdata(pdev); - nwl_dsi_deselect_input(dsi); mipi_dsi_host_unregister(&dsi->dsi_host); drm_bridge_remove(&dsi->bridge); pm_runtime_disable(&pdev->dev); From patchwork Fri May 15 13:12:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11551491 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 994211391 for ; Fri, 15 May 2020 13:12:39 +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 83E9820767 for ; Fri, 15 May 2020 13:12:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83E9820767 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org 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 2D52E6EC9B; Fri, 15 May 2020 13:12:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC9C66EC2D for ; Fri, 15 May 2020 13:12:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 34B2AFB06; Fri, 15 May 2020 15:12:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0-lLz--REorz; Fri, 15 May 2020 15:12:23 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 8E898445A9; Fri, 15 May 2020 15:12:15 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andrzej Hajda , Sam Ravnborg , Anson Huang , Leonard Crestez , Lucas Stach , Peng Fan , Robert Chiras , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 5/6] arm64: dts: imx8mq: Add NWL dsi controller Date: Fri, 15 May 2020 15:12:14 +0200 Message-Id: <6f915d10ead271a1c155628efbc909d5eb9f4102.1589548223.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a node for the Northwestlogic MIPI DSI IP core, "disabled" by default. Signed-off-by: Guido Günther --- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi index 0142f06ead12..6bbbf44e6be0 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -889,6 +889,37 @@ sec_jr2: jr@3000 { }; }; + mipi_dsi: mipi-dsi@30a00000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,imx8mq-nwl-dsi"; + reg = <0x30a00000 0x300>; + clocks = <&clk IMX8MQ_CLK_DSI_CORE>, + <&clk IMX8MQ_CLK_DSI_AHB>, + <&clk IMX8MQ_CLK_DSI_IPG_DIV>, + <&clk IMX8MQ_CLK_DSI_PHY_REF>, + <&clk IMX8MQ_CLK_LCDIF_PIXEL>; + clock-names = "core", "rx_esc", "tx_esc", "phy_ref", "lcdif"; + assigned-clocks = <&clk IMX8MQ_CLK_DSI_AHB>, + <&clk IMX8MQ_CLK_DSI_CORE>, + <&clk IMX8MQ_CLK_DSI_IPG_DIV>; + assigned-clock-parents = <&clk IMX8MQ_SYS1_PLL_80M>, + <&clk IMX8MQ_SYS1_PLL_266M>; + assigned-clock-rates = <80000000>, + <266000000>, + <20000000>; + interrupts = ; + resets = <&src IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N>, + <&src IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N>, + <&src IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N>, + <&src IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N>; + reset-names = "byte", "dpi", "esc", "pclk"; + phys = <&dphy>; + phy-names = "dphy"; + power-domains = <&pgc_mipi>; + status = "disabled"; + }; + dphy: dphy@30a00300 { compatible = "fsl,imx8mq-mipi-dphy"; reg = <0x30a00300 0x100>; From patchwork Fri May 15 13:12:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Guido_G=C3=BCnther?= X-Patchwork-Id: 11551487 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 E7DB1139A for ; Fri, 15 May 2020 13:12:37 +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 D29DB20709 for ; Fri, 15 May 2020 13:12:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D29DB20709 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sigxcpu.org 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 399BF6EC9A; Fri, 15 May 2020 13:12:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from honk.sigxcpu.org (honk.sigxcpu.org [24.134.29.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D7AB6EC9A for ; Fri, 15 May 2020 13:12:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id BA145FB03; Fri, 15 May 2020 15:12:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7VPSUBShava6; Fri, 15 May 2020 15:12:26 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 98055445AC; Fri, 15 May 2020 15:12:15 +0200 (CEST) From: =?utf-8?q?Guido_G=C3=BCnther?= To: Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Andrzej Hajda , Sam Ravnborg , Anson Huang , Leonard Crestez , Lucas Stach , Peng Fan , Robert Chiras , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 6/6] arm64: dts: imx8mq-librem5-devkit: Enable MIPI DSI panel Date: Fri, 15 May 2020 15:12:15 +0200 Message-Id: <7f91beb1ce51a88dbe43e69c8af35b8684c0ac4c.1589548223.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Enable MIPI LCD panel output by adding nodes for the NWL DSI host controller, the mux-input-bridge, the Rocktech panel and the eLCDIF display controller. Signed-off-by: Guido Günther --- .../dts/freescale/imx8mq-librem5-devkit.dts | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts index 7fc31c71a626..d98f9b8dede8 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts +++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts @@ -841,6 +841,87 @@ MX8MQ_IOMUXC_NAND_DATA03_GPIO3_IO9 0x19 /* WWAN_RESET */ }; }; +&lcdif { + status = "okay"; + + port@0 { + lcdif_dpi_out: endpoint { + remote-endpoint = <&dpi_mux_from_lcdif>; + }; + }; +}; + +&iomuxc_gpr { + mipi_mux: mipi-mux { + compatible = "mux-input-bridge"; + mux-controls = <&mux 0>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + default-input = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + dpi_mux_from_lcdif: endpoint { + remote-endpoint = <&lcdif_dpi_out>; + }; + }; + + port@1 { /* dcss */ + reg = <1>; + }; + + port@2 { + reg = <2>; + dpi_mux_out: endpoint { + remote-endpoint = <&nwl_dpi_in>; + }; + + }; + }; + }; +}; + +&mipi_dsi { + status = "okay"; + panel@0 { + compatible = "rocktech,jh057n00900"; + reg = <0>; + backlight = <&backlight_dsi>; + reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>; + vcc-supply = <®_2v8_p>; + iovcc-supply = <®_1v8_p>; + port@0 { + panel_in: endpoint { + remote-endpoint = <&nwl_dsi_out>; + }; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + nwl_dpi_in: endpoint { + remote-endpoint = <&dpi_mux_out>; + }; + }; + port@1 { + reg = <1>; + nwl_dsi_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + }; +}; + &pgc_gpu { power-supply = <&buck3_reg>; };