From patchwork Thu Aug 15 11:04:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095535 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75EF913A0 for ; Thu, 15 Aug 2019 11:04:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63771288BD for ; Thu, 15 Aug 2019 11:04:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57689288BE; Thu, 15 Aug 2019 11:04:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5AD1288BF for ; Thu, 15 Aug 2019 11:04:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731526AbfHOLEy (ORCPT ); Thu, 15 Aug 2019 07:04:54 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:53536 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727814AbfHOLEy (ORCPT ); Thu, 15 Aug 2019 07:04:54 -0400 X-IronPort-AV: E=Sophos;i="5.64,389,1559487600"; d="scan'208";a="23867451" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 15 Aug 2019 20:04:52 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 1016441773E8; Thu, 15 Aug 2019 20:04:46 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , Thierry Reding , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Cc: Fabrizio Castro , Sam Ravnborg , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org, Kieran Bingham , Jacopo Mondi Subject: [PATCH v2 1/9] dt-bindings: panel: lvds: Add dual-link LVDS display support Date: Thu, 15 Aug 2019 12:04:25 +0100 Message-Id: <1565867073-24746-2-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Dual-link LVDS displays have two ports, therefore document this with the bindings. Signed-off-by: Fabrizio Castro --- v1->v2: * Reworked the description of the ports property * lvds0_panel_in in the example has been renamed to panel_in0 * lvds1_panel_in in the example has been renamed to panel_in1 Laurent, in linux-next they are now working with: Documentation/devicetree/bindings/display/panel/lvds.yaml What should I do here? Thanks, Fab .../bindings/display/panel/panel-lvds.txt | 95 ++++++++++++++++------ 1 file changed, 71 insertions(+), 24 deletions(-) diff --git a/Documentation/devicetree/bindings/display/panel/panel-lvds.txt b/Documentation/devicetree/bindings/display/panel/panel-lvds.txt index 250850a..5231243 100644 --- a/Documentation/devicetree/bindings/display/panel/panel-lvds.txt +++ b/Documentation/devicetree/bindings/display/panel/panel-lvds.txt @@ -41,7 +41,12 @@ Required nodes: - panel-timing: See panel-common.txt. - ports: See panel-common.txt. These bindings require a single port subnode - corresponding to the panel LVDS input. + (for a single link panel) corresponding to the panel LVDS input, or two port + subnodes (for a dual link panel) corresponding to the panel LVDS inputs. + Dual-link LVDS panels expect even pixels (0, 2, 4, etc.) and odd pixels (1, 3, + 5, etc.) on different input ports, it's up to the panel-specific bindings to + specify what port is expecting even pixels, and what port is expecting odd + pixels. LVDS data mappings are defined as follows. @@ -92,30 +97,72 @@ CTL3: 0 Example ------- -panel { - compatible = "mitsubishi,aa121td01", "panel-lvds"; - - width-mm = <261>; - height-mm = <163>; - - data-mapping = "jeida-24"; - - panel-timing { - /* 1280x800 @60Hz */ - clock-frequency = <71000000>; - hactive = <1280>; - vactive = <800>; - hsync-len = <70>; - hfront-porch = <20>; - hback-porch = <70>; - vsync-len = <5>; - vfront-porch = <3>; - vback-porch = <15>; +Single port: + panel { + compatible = "mitsubishi,aa121td01", "panel-lvds"; + + width-mm = <261>; + height-mm = <163>; + + data-mapping = "jeida-24"; + + panel-timing { + /* 1280x800 @60Hz */ + clock-frequency = <71000000>; + hactive = <1280>; + vactive = <800>; + hsync-len = <70>; + hfront-porch = <20>; + hback-porch = <70>; + vsync-len = <5>; + vfront-porch = <3>; + vback-porch = <15>; + }; + + port { + panel_in: endpoint { + remote-endpoint = <&lvds_encoder>; + }; + }; }; - port { - panel_in: endpoint { - remote-endpoint = <&lvds_encoder>; +Two ports: + panel { + compatible = "advantech,idk-2121wr", "panel-lvds"; + + width-mm = <476>; + height-mm = <268>; + + data-mapping = "vesa-24"; + + panel-timing { + clock-frequency = <148500000>; + hactive = <1920>; + vactive = <1080>; + hsync-len = <44>; + hfront-porch = <88>; + hback-porch = <148>; + vfront-porch = <4>; + vback-porch = <36>; + vsync-len = <5>; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + panel_in0: endpoint { + remote-endpoint = <&lvds0_out>; + }; + }; + + port@1 { + reg = <1>; + panel_in1: endpoint { + remote-endpoint = <&lvds1_out>; + }; + }; }; }; -}; From patchwork Thu Aug 15 11:04:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095537 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E95D1399 for ; Thu, 15 Aug 2019 11:05:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D62228585 for ; Thu, 15 Aug 2019 11:05:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01921288C7; Thu, 15 Aug 2019 11:05:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C00028585 for ; Thu, 15 Aug 2019 11:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731243AbfHOLFB (ORCPT ); Thu, 15 Aug 2019 07:05:01 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:43006 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727814AbfHOLFA (ORCPT ); Thu, 15 Aug 2019 07:05:00 -0400 X-IronPort-AV: E=Sophos;i="5.64,388,1559487600"; d="scan'208";a="24088287" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Aug 2019 20:04:58 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D6FE741773C3; Thu, 15 Aug 2019 20:04:52 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , Thierry Reding , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland Cc: Fabrizio Castro , Sam Ravnborg , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org, Kieran Bingham , Jacopo Mondi Subject: [PATCH v2 2/9] dt-bindings: display: Add bindings for Advantech IDK-2121WR Date: Thu, 15 Aug 2019 12:04:26 +0100 Message-Id: <1565867073-24746-3-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This panel is handled through the generic lvds-panel bindings, so only needs its additional compatible specified. Some panel-specific documentation can be found here: https://buy.advantech.eu/Displays/Embedded-LCD-Kits-High-Brightness/model-IDK-2121WR-K2FHA2E.htm Signed-off-by: Fabrizio Castro --- v1->v2: * Reworked according to Laurent's feedback * Renamed lvds0_panel_in to panel_in0 * Renamed lvds1_panel_in to panel_in1 Laurent, Should this be a .yaml file already? Thanks, Fab .../display/panel/advantech,idk-2121wr.txt | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.txt diff --git a/Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.txt b/Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.txt new file mode 100644 index 0000000..6ee1d1b --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/advantech,idk-2121wr.txt @@ -0,0 +1,56 @@ +Advantech Co., Ltd. IDK-2121WR 21.5" LVDS panel +=============================================== + +Required properties: +- compatible: should be "advantech,idk-2121wr" followed by "panel-lvds" + +This binding is compatible with the lvds-panel binding, which is specified +in panel-lvds.txt in this directory. +The panel operates in dual-link mode and thus requires two port nodes, +the first port node expects odd pixels (1, 3, 5, etc.) and the second port +expects even pixels (0, 2, 4, etc.). + +Example +------- + + panel { + compatible = "advantech,idk-2121wr", "panel-lvds"; + + width-mm = <476>; + height-mm = <268>; + + data-mapping = "vesa-24"; + + panel-timing { + clock-frequency = <148500000>; + hactive = <1920>; + vactive = <1080>; + hsync-len = <44>; + hfront-porch = <88>; + hback-porch = <148>; + vfront-porch = <4>; + vback-porch = <36>; + vsync-len = <5>; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + /* Odd pixels */ + reg = <0>; + panel_in0: endpoint { + remote-endpoint = <&lvds0_out>; + }; + }; + + port@1 { + /* Even pixels */ + reg = <1>; + panel_in1: endpoint { + remote-endpoint = <&lvds1_out>; + }; + }; + }; + }; From patchwork Thu Aug 15 11:04:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095539 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1691E13A0 for ; Thu, 15 Aug 2019 11:05:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05705288C6 for ; Thu, 15 Aug 2019 11:05:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDBB1288C7; Thu, 15 Aug 2019 11:05:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 198AE288D2 for ; Thu, 15 Aug 2019 11:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731550AbfHOLFG (ORCPT ); Thu, 15 Aug 2019 07:05:06 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:7003 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727814AbfHOLFG (ORCPT ); Thu, 15 Aug 2019 07:05:06 -0400 X-IronPort-AV: E=Sophos;i="5.64,389,1559487600"; d="scan'208";a="23867467" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 15 Aug 2019 20:05:04 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A006641773C3; Thu, 15 Aug 2019 20:04:58 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , Andrzej Hajda , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Sean Paul Cc: Fabrizio Castro , Laurent Pinchart , Eric Anholt , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org, Kieran Bingham , Jacopo Mondi Subject: [PATCH v2 3/9] drm: Rename drm_bridge_timings to drm_timings Date: Thu, 15 Aug 2019 12:04:27 +0100 Message-Id: <1565867073-24746-4-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The information represented by drm_bridge_timings is also needed by panels, therefore rename drm_bridge_timings to drm_timings. Signed-off-by: Fabrizio Castro Link: https://www.spinics.net/lists/linux-renesas-soc/msg43271.html --- v1->v2: * new patch I have copied the license from include/drm/drm_bridge.h as that's where the struct originally came from. What's the right SPDX license to use in this case? drivers/gpu/drm/bridge/dumb-vga-dac.c | 6 ++-- drivers/gpu/drm/bridge/sii902x.c | 2 +- drivers/gpu/drm/bridge/thc63lvd1024.c | 2 +- drivers/gpu/drm/bridge/ti-tfp410.c | 6 ++-- drivers/gpu/drm/pl111/pl111_display.c | 2 +- include/drm/drm_bridge.h | 40 ++--------------------- include/drm/drm_timings.h | 60 +++++++++++++++++++++++++++++++++++ 7 files changed, 71 insertions(+), 47 deletions(-) create mode 100644 include/drm/drm_timings.h diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index d32885b..bb1d928 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c @@ -228,7 +228,7 @@ static int dumb_vga_remove(struct platform_device *pdev) * NOTE: the ADV7123EP seems to have other timings and need a new timings * set if used. */ -static const struct drm_bridge_timings default_dac_timings = { +static const struct drm_timings default_dac_timings = { /* Timing specifications, datasheet page 7 */ .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE, .setup_time_ps = 500, @@ -239,7 +239,7 @@ static const struct drm_bridge_timings default_dac_timings = { * Information taken from the THS8134, THS8134A, THS8134B datasheet named * "SLVS205D", dated May 1990, revised March 2000. */ -static const struct drm_bridge_timings ti_ths8134_dac_timings = { +static const struct drm_timings ti_ths8134_dac_timings = { /* From timing diagram, datasheet page 9 */ .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE, /* From datasheet, page 12 */ @@ -252,7 +252,7 @@ static const struct drm_bridge_timings ti_ths8134_dac_timings = { * Information taken from the THS8135 datasheet named "SLAS343B", dated * May 2001, revised April 2013. */ -static const struct drm_bridge_timings ti_ths8135_dac_timings = { +static const struct drm_timings ti_ths8135_dac_timings = { /* From timing diagram, datasheet page 14 */ .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE, /* From datasheet, page 16 */ diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index dd7aa46..0c63065 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -914,7 +914,7 @@ static int sii902x_i2c_bypass_deselect(struct i2c_mux_core *mux, u32 chan_id) return 0; } -static const struct drm_bridge_timings default_sii902x_timings = { +static const struct drm_timings default_sii902x_timings = { .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE | DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE | DRM_BUS_FLAG_DE_HIGH, diff --git a/drivers/gpu/drm/bridge/thc63lvd1024.c b/drivers/gpu/drm/bridge/thc63lvd1024.c index 3d74129b..9047a9e 100644 --- a/drivers/gpu/drm/bridge/thc63lvd1024.c +++ b/drivers/gpu/drm/bridge/thc63lvd1024.c @@ -34,7 +34,7 @@ struct thc63_dev { struct drm_bridge bridge; struct drm_bridge *next; - struct drm_bridge_timings timings; + struct drm_timings timings; }; static inline struct thc63_dev *to_thc63(struct drm_bridge *bridge) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index dbf35c7..c086b06c 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -32,7 +32,7 @@ struct tfp410 { struct delayed_work hpd_work; struct gpio_desc *powerdown; - struct drm_bridge_timings timings; + struct drm_timings timings; struct device *dev; }; @@ -190,7 +190,7 @@ static irqreturn_t tfp410_hpd_irq_thread(int irq, void *arg) return IRQ_HANDLED; } -static const struct drm_bridge_timings tfp410_default_timings = { +static const struct drm_timings tfp410_default_timings = { .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE | DRM_BUS_FLAG_DE_HIGH, .setup_time_ps = 1200, @@ -199,7 +199,7 @@ static const struct drm_bridge_timings tfp410_default_timings = { static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) { - struct drm_bridge_timings *timings = &dvi->timings; + struct drm_timings *timings = &dvi->timings; struct device_node *ep; u32 pclk_sample = 0; u32 bus_width = 24; diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 15d2755..c82b21f 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -188,7 +188,7 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, } if (bridge) { - const struct drm_bridge_timings *btimings = bridge->timings; + const struct drm_timings *btimings = bridge->timings; /* * Here is when things get really fun. Sometimes the bridge diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 7616f65..8270a38 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -27,9 +27,9 @@ #include #include #include +#include struct drm_bridge; -struct drm_bridge_timings; struct drm_panel; /** @@ -337,42 +337,6 @@ struct drm_bridge_funcs { }; /** - * struct drm_bridge_timings - timing information for the bridge - */ -struct drm_bridge_timings { - /** - * @input_bus_flags: - * - * Tells what additional settings for the pixel data on the bus - * this bridge requires (like pixel signal polarity). See also - * &drm_display_info->bus_flags. - */ - u32 input_bus_flags; - /** - * @setup_time_ps: - * - * Defines the time in picoseconds the input data lines must be - * stable before the clock edge. - */ - u32 setup_time_ps; - /** - * @hold_time_ps: - * - * Defines the time in picoseconds taken for the bridge to sample the - * input signal after the clock edge. - */ - u32 hold_time_ps; - /** - * @dual_link: - * - * True if the bus operates in dual-link mode. The exact meaning is - * dependent on the bus type. For LVDS buses, this indicates that even- - * and odd-numbered pixels are received on separate links. - */ - bool dual_link; -}; - -/** * struct drm_bridge - central DRM bridge control structure */ struct drm_bridge { @@ -393,7 +357,7 @@ struct drm_bridge { * * the timing specification for the bridge, if any (may be NULL) */ - const struct drm_bridge_timings *timings; + const struct drm_timings *timings; /** @funcs: control functions */ const struct drm_bridge_funcs *funcs; /** @driver_private: pointer to the bridge driver's internal context */ diff --git a/include/drm/drm_timings.h b/include/drm/drm_timings.h new file mode 100644 index 0000000..4af8814 --- /dev/null +++ b/include/drm/drm_timings.h @@ -0,0 +1,60 @@ +/* + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef __DRM_TIMINGS_H__ +#define __DRM_TIMINGS_H__ + +/** + * struct drm_timings - timing information + */ +struct drm_timings { + /** + * @input_bus_flags: + * + * Tells what additional settings for the pixel data on the bus + * are required (like pixel signal polarity). See also + * &drm_display_info->bus_flags. + */ + u32 input_bus_flags; + /** + * @setup_time_ps: + * + * Defines the time in picoseconds the input data lines must be + * stable before the clock edge. + */ + u32 setup_time_ps; + /** + * @hold_time_ps: + * + * Defines the time in picoseconds taken for the bridge to sample the + * input signal after the clock edge. + */ + u32 hold_time_ps; + /** + * @dual_link: + * + * True if the bus operates in dual-link mode. The exact meaning is + * dependent on the bus type. For LVDS buses, this indicates that even- + * and odd-numbered pixels are received on separate links. + */ + bool dual_link; +}; + +#endif /* __DRM_TIMINGS_H__ */ From patchwork Thu Aug 15 11:04:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095541 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A19E1399 for ; Thu, 15 Aug 2019 11:05:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 895D7288BE for ; Thu, 15 Aug 2019 11:05:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D073288BF; Thu, 15 Aug 2019 11:05:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 281BF288C3 for ; Thu, 15 Aug 2019 11:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731563AbfHOLFL (ORCPT ); Thu, 15 Aug 2019 07:05:11 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:24976 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727814AbfHOLFL (ORCPT ); Thu, 15 Aug 2019 07:05:11 -0400 X-IronPort-AV: E=Sophos;i="5.64,388,1559487600"; d="scan'208";a="24088303" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Aug 2019 20:05:09 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id B1BF1417763E; Thu, 15 Aug 2019 20:05:04 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter Cc: Fabrizio Castro , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org, Kieran Bingham , Jacopo Mondi Subject: [PATCH v2 4/9] drm/timings: Add link flags Date: Thu, 15 Aug 2019 12:04:28 +0100 Message-Id: <1565867073-24746-5-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need more information to describe dual-LVDS links, therefore introduce link_flags. Signed-off-by: Fabrizio Castro --- v1->v2: * new patch include/drm/drm_timings.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/drm/drm_timings.h b/include/drm/drm_timings.h index 4af8814..58fbf1b 100644 --- a/include/drm/drm_timings.h +++ b/include/drm/drm_timings.h @@ -1,4 +1,6 @@ /* + * Copyright (C) 2019 Renesas Electronics Corporation + * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that copyright @@ -21,6 +23,24 @@ #ifndef __DRM_TIMINGS_H__ #define __DRM_TIMINGS_H__ +#include + +/** + * enum drm_link_flags - link_flags for &drm_timings + * + * This enum defines the details of the link. + * + * @DRM_LINK_DUAL_LVDS_ODD_EVEN: Dual-LVDS link, with odd pixels (1,3,5, + * etc.) coming through the first port, and + * even pixels (0,2,4,etc.) coming through + * the second port. If not specified for a + * dual-LVDS panel, it is assumed that even + * pixels are coming through the first port + */ +enum drm_link_flags { + DRM_LINK_DUAL_LVDS_ODD_EVEN = BIT(0), +}; + /** * struct drm_timings - timing information */ @@ -55,6 +75,12 @@ struct drm_timings { * and odd-numbered pixels are received on separate links. */ bool dual_link; + /** + * @link_flags + * + * Provides detailed information about the link. + */ + enum drm_link_flags link_flags; }; #endif /* __DRM_TIMINGS_H__ */ From patchwork Thu Aug 15 11:04:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095543 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB3281399 for ; Thu, 15 Aug 2019 11:05:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B92FE212DB for ; Thu, 15 Aug 2019 11:05:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD6D2288CF; Thu, 15 Aug 2019 11:05:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63BD8288BF for ; Thu, 15 Aug 2019 11:05:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731333AbfHOLFR (ORCPT ); Thu, 15 Aug 2019 07:05:17 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:24976 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727814AbfHOLFQ (ORCPT ); Thu, 15 Aug 2019 07:05:16 -0400 X-IronPort-AV: E=Sophos;i="5.64,388,1559487600"; d="scan'208";a="24088309" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Aug 2019 20:05:15 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id F1625417763E; Thu, 15 Aug 2019 20:05:09 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Sean Paul , Thierry Reding , David Airlie , Daniel Vetter Cc: Fabrizio Castro , Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org, Kieran Bingham , Jacopo Mondi Subject: [PATCH v2 5/9] drm/panel: Add timings field to drm_panel Date: Thu, 15 Aug 2019 12:04:29 +0100 Message-Id: <1565867073-24746-6-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need to know if the panel supports dual-link, similarly to bridges, therefore add a reference to drm_timings in drm_panel. Signed-off-by: Fabrizio Castro --- v1->v2: * new patch include/drm/drm_panel.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 8c738c0..cd6ff07 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -26,6 +26,7 @@ #include #include +#include struct device_node; struct drm_connector; @@ -81,6 +82,7 @@ struct drm_panel_funcs { * struct drm_panel - DRM panel object * @drm: DRM device owning the panel * @connector: DRM connector that the panel is attached to + * @timings: timing information * @dev: parent device of the panel * @link: link from panel device (supplier) to DRM device (consumer) * @funcs: operations that can be performed on the panel @@ -89,6 +91,7 @@ struct drm_panel_funcs { struct drm_panel { struct drm_device *drm; struct drm_connector *connector; + const struct drm_timings *timings; struct device *dev; const struct drm_panel_funcs *funcs; From patchwork Thu Aug 15 11:04:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095545 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AD2E1399 for ; Thu, 15 Aug 2019 11:05:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AB7528585 for ; Thu, 15 Aug 2019 11:05:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F40D288BE; Thu, 15 Aug 2019 11:05:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD51328585 for ; Thu, 15 Aug 2019 11:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730775AbfHOLFU (ORCPT ); Thu, 15 Aug 2019 07:05:20 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:24976 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727814AbfHOLFU (ORCPT ); Thu, 15 Aug 2019 07:05:20 -0400 X-IronPort-AV: E=Sophos;i="5.64,388,1559487600"; d="scan'208";a="24088316" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Aug 2019 20:05:19 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id BB4DA41773C3; Thu, 15 Aug 2019 20:05:15 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , David Airlie , Daniel Vetter Cc: Fabrizio Castro , Kieran Bingham , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , Jacopo Mondi Subject: [PATCH v2 6/9] drm: rcar-du: lvds: Fix companion's mode Date: Thu, 15 Aug 2019 12:04:30 +0100 Message-Id: <1565867073-24746-7-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The companion encoder needs to be told to use the same mode as the primary encoder. Fixes: e9e8798ab7b8 ("drm: rcar-du: lvds: Add support for dual-link mode") Signed-off-by: Fabrizio Castro --- v1->v2: * reworked according to Laurent's feedback drivers/gpu/drm/rcar-du/rcar_lvds.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 3fe0b86..41d28f4 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -603,6 +603,11 @@ static void rcar_lvds_mode_set(struct drm_bridge *bridge, lvds->display_mode = *adjusted_mode; rcar_lvds_get_lvds_mode(lvds); + if (lvds->companion) { + struct rcar_lvds *companion_lvds = bridge_to_rcar_lvds( + lvds->companion); + companion_lvds->mode = lvds->mode; + } } static int rcar_lvds_attach(struct drm_bridge *bridge) From patchwork Thu Aug 15 11:04:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095547 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18DFA13A0 for ; Thu, 15 Aug 2019 11:05:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 090B128585 for ; Thu, 15 Aug 2019 11:05:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1937288C3; Thu, 15 Aug 2019 11:05:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6347228585 for ; Thu, 15 Aug 2019 11:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbfHOLFZ (ORCPT ); Thu, 15 Aug 2019 07:05:25 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:24976 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726008AbfHOLFY (ORCPT ); Thu, 15 Aug 2019 07:05:24 -0400 X-IronPort-AV: E=Sophos;i="5.64,388,1559487600"; d="scan'208";a="24088321" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Aug 2019 20:05:23 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D83E1417763E; Thu, 15 Aug 2019 20:05:19 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , David Airlie , Daniel Vetter Cc: Fabrizio Castro , Kieran Bingham , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , Jacopo Mondi Subject: [PATCH v2 7/9] drm: rcar-du: lvds: Add dual-LVDS panels support Date: Thu, 15 Aug 2019 12:04:31 +0100 Message-Id: <1565867073-24746-8-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for dual-LVDS panels. It's very important that we coordinate the efforts of both the primary encoder and the companion encoder to get the right picture on the panel, therefore this patch adds some code to work out if even and odd pixels need swapping. When the encoders are connected to a LVDS panel, the assumption is that by default the panel expects even pixels (0, 2, 4, etc.) on the first input port, and odd pixels (1, 3, 5, etc.) on the seconds port. When DRM_LINK_DUAL_LVDS_ODD_EVEN is found among the link flags, the display expects odd pixels on the first input port, and even pixels on the second port. As a result, the way the encoders are connected to the panel may trigger pixel (data) swapping. Signed-off-by: Fabrizio Castro --- v1->v2: * new patch, resulting from Laurent's feedback drivers/gpu/drm/rcar-du/rcar_lvds.c | 121 ++++++++++++++++++++++++------------ 1 file changed, 81 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 41d28f4..5c24884 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "rcar_lvds.h" #include "rcar_lvds_regs.h" @@ -69,6 +71,7 @@ struct rcar_lvds { struct drm_bridge *companion; bool dual_link; + bool stripe_swap_data; }; #define bridge_to_rcar_lvds(b) \ @@ -439,12 +442,20 @@ static void rcar_lvds_enable(struct drm_bridge *bridge) rcar_lvds_write(lvds, LVDCHCR, lvdhcr); if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK) { - /* - * Configure vertical stripe based on the mode of operation of - * the connected device. - */ - rcar_lvds_write(lvds, LVDSTRIPE, - lvds->dual_link ? LVDSTRIPE_ST_ON : 0); + u32 lvdstripe = 0; + + if (lvds->dual_link) + /* + * Configure vertical stripe based on the mode of + * operation of the connected device. + * + * ST_SWAP from LVD1STRIPE is reserved, do not set + * in the companion LVDS + */ + lvdstripe = LVDSTRIPE_ST_ON | + (lvds->companion && lvds->stripe_swap_data ? + LVDSTRIPE_ST_SWAP : 0); + rcar_lvds_write(lvds, LVDSTRIPE, lvdstripe); } /* @@ -706,13 +717,31 @@ static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds) return ret; } +static int rcar_lvds_get_remote_port_reg(struct device_node *np) +{ + struct device_node *endpoint_node, *remote_endpoint; + struct of_endpoint endpoint; + + endpoint_node = of_graph_get_endpoint_by_regs(np, 1, 0); + if (!endpoint_node) + return -ENODEV; + remote_endpoint = of_graph_get_remote_endpoint(endpoint_node); + if (!remote_endpoint) { + of_node_put(endpoint_node); + return -ENODEV; + } + of_graph_parse_endpoint(remote_endpoint, &endpoint); + of_node_put(endpoint_node); + of_node_put(remote_endpoint); + + return endpoint.port; +} + static int rcar_lvds_parse_dt(struct rcar_lvds *lvds) { struct device_node *local_output = NULL; - struct device_node *remote_input = NULL; struct device_node *remote = NULL; - struct device_node *node; - bool is_bridge = false; + const struct drm_timings *timings = NULL; int ret = 0; local_output = of_graph_get_endpoint_by_regs(lvds->dev->of_node, 1, 0); @@ -740,45 +769,57 @@ static int rcar_lvds_parse_dt(struct rcar_lvds *lvds) goto done; } - remote_input = of_graph_get_remote_endpoint(local_output); + ret = drm_of_find_panel_or_bridge(lvds->dev->of_node, 1, 0, + &lvds->panel, &lvds->next_bridge); + if (ret) { + ret = -EPROBE_DEFER; + goto done; + } + if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK) { + if (lvds->next_bridge) + timings = lvds->next_bridge->timings; + else + timings = lvds->panel->timings; + if (timings) + lvds->dual_link = timings->dual_link; + } - for_each_endpoint_of_node(remote, node) { - if (node != remote_input) { + if (lvds->dual_link) { + ret = rcar_lvds_parse_dt_companion(lvds); + if (lvds->companion && timings) { + int our_port, comp_port; + bool odd_even_flag = timings->link_flags & + DRM_LINK_DUAL_LVDS_ODD_EVEN; + our_port = rcar_lvds_get_remote_port_reg( + lvds->dev->of_node); + if (our_port < 0) { + ret = our_port; + goto done; + } + comp_port = rcar_lvds_get_remote_port_reg( + lvds->companion->of_node); + if (comp_port < 0) { + ret = comp_port; + goto done; + } /* - * We've found one endpoint other than the input, this - * must be a bridge. + * We need to match the port where we generate even + * pixels (0, 2, 4, etc.) to the port where the sink + * expects to receive even pixels, same thing for the + * odd pixels. Swap the generation of even and odd + * pixels if the connection requires it. + * By default (when DRM_LINK_DUAL_LVDS_ODD_EVEN is not + * specified) the sink expects even pixels on the + * first input port, and odd pixels on the second port. */ - is_bridge = true; - of_node_put(node); - break; + if (((comp_port - our_port > 0) && odd_even_flag) || + ((comp_port - our_port < 0) && !odd_even_flag)) + lvds->stripe_swap_data = true; } } - if (is_bridge) { - lvds->next_bridge = of_drm_find_bridge(remote); - if (!lvds->next_bridge) { - ret = -EPROBE_DEFER; - goto done; - } - - if (lvds->info->quirks & RCAR_LVDS_QUIRK_DUAL_LINK) - lvds->dual_link = lvds->next_bridge->timings - ? lvds->next_bridge->timings->dual_link - : false; - } else { - lvds->panel = of_drm_find_panel(remote); - if (IS_ERR(lvds->panel)) { - ret = PTR_ERR(lvds->panel); - goto done; - } - } - - if (lvds->dual_link) - ret = rcar_lvds_parse_dt_companion(lvds); - done: of_node_put(local_output); - of_node_put(remote_input); of_node_put(remote); /* From patchwork Thu Aug 15 11:04:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095549 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8EC11399 for ; Thu, 15 Aug 2019 11:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C77D4287A6 for ; Thu, 15 Aug 2019 11:05:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBD9B288BE; Thu, 15 Aug 2019 11:05:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FB86288D0 for ; Thu, 15 Aug 2019 11:05:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730559AbfHOLFa (ORCPT ); Thu, 15 Aug 2019 07:05:30 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:34169 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726008AbfHOLFa (ORCPT ); Thu, 15 Aug 2019 07:05:30 -0400 X-IronPort-AV: E=Sophos;i="5.64,389,1559487600"; d="scan'208";a="23867492" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 15 Aug 2019 20:05:28 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 07C40417763E; Thu, 15 Aug 2019 20:05:23 +0900 (JST) From: Fabrizio Castro To: Laurent Pinchart , Thierry Reding , David Airlie , Daniel Vetter Cc: Fabrizio Castro , Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Simon Horman , Geert Uytterhoeven , Chris Paterson , Biju Das , linux-renesas-soc@vger.kernel.org, Kieran Bingham , Jacopo Mondi Subject: [PATCH v2 8/9] drm/panel: lvds: Add support for the IDK-2121WR Date: Thu, 15 Aug 2019 12:04:32 +0100 Message-Id: <1565867073-24746-9-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The IDK-2121WR from Advantech is a dual-LVDS display. Signed-off-by: Fabrizio Castro --- v1->v2: * new patch drivers/gpu/drm/panel/panel-lvds.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 1ec57d0..2cd41757 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -22,6 +22,7 @@ #include #include +#include struct panel_lvds { struct drm_panel panel; @@ -259,6 +260,7 @@ static int panel_lvds_probe(struct platform_device *pdev) /* Register the panel. */ drm_panel_init(&lvds->panel); lvds->panel.dev = lvds->dev; + lvds->panel.timings = of_device_get_match_data(lvds->dev); lvds->panel.funcs = &panel_lvds_funcs; ret = drm_panel_add(&lvds->panel); @@ -287,7 +289,13 @@ static int panel_lvds_remove(struct platform_device *pdev) return 0; } +static const struct drm_timings advantech_idk_2121wr = { + .dual_link = true, + .link_flags = DRM_LINK_DUAL_LVDS_ODD_EVEN, +}; + static const struct of_device_id panel_lvds_of_table[] = { + { .compatible = "advantech,idk-2121wr", .data = &advantech_idk_2121wr}, { .compatible = "panel-lvds", }, { /* Sentinel */ }, }; From patchwork Thu Aug 15 11:04:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 11095551 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF21413A0 for ; Thu, 15 Aug 2019 11:05:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9054288B6 for ; Thu, 15 Aug 2019 11:05:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC7E5287A6; Thu, 15 Aug 2019 11:05:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C91B287A6 for ; Thu, 15 Aug 2019 11:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731593AbfHOLFe (ORCPT ); Thu, 15 Aug 2019 07:05:34 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:42457 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726008AbfHOLFe (ORCPT ); Thu, 15 Aug 2019 07:05:34 -0400 X-IronPort-AV: E=Sophos;i="5.64,388,1559487600"; d="scan'208";a="24088330" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Aug 2019 20:05:33 +0900 Received: from fabrizio-dev.ree.adwin.renesas.com (unknown [10.226.36.196]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id F4103417763E; Thu, 15 Aug 2019 20:05:28 +0900 (JST) From: Fabrizio Castro To: Geert Uytterhoeven , Laurent Pinchart , Rob Herring , Mark Rutland Cc: Fabrizio Castro , Simon Horman , Magnus Damm , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Chris Paterson , Biju Das , Kieran Bingham , Jacopo Mondi , xu_shunji@hoperun.com, ebiharaml@si-linux.co.jp Subject: [PATCH v2 9/9] arm64: dts: renesas: Add EK874 board with idk-2121wr display support Date: Thu, 15 Aug 2019 12:04:33 +0100 Message-Id: <1565867073-24746-10-git-send-email-fabrizio.castro@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> References: <1565867073-24746-1-git-send-email-fabrizio.castro@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The EK874 is advertised as compatible with panel IDK-2121WR from Advantech, however the panel isn't sold alongside the board. A new dts, adding everything that's required to get the panel to to work with the EK874, is the most convenient way to support the EK874 when it's connected to the IDK-2121WR. Signed-off-by: Fabrizio Castro --- v1->v2: * Added comment for lvds-connector-en-gpio * Renamed &lvds0_panel_in to panel_in0 * Renamed &lvds1_panel_in to panel_in1 Geert, at this point in time no other board uses this display, can we postpone the creation of the .dtsi file to when there'll be another user (if any)? Thanks, Fab arch/arm64/boot/dts/renesas/Makefile | 3 +- .../boot/dts/renesas/r8a774c0-ek874-idk-2121wr.dts | 116 +++++++++++++++++++++ 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/renesas/r8a774c0-ek874-idk-2121wr.dts diff --git a/arch/arm64/boot/dts/renesas/Makefile b/arch/arm64/boot/dts/renesas/Makefile index 42b74c2..ce48478 100644 --- a/arch/arm64/boot/dts/renesas/Makefile +++ b/arch/arm64/boot/dts/renesas/Makefile @@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_R8A774A1) += r8a774a1-hihope-rzg2m.dtb dtb-$(CONFIG_ARCH_R8A774A1) += r8a774a1-hihope-rzg2m-ex.dtb -dtb-$(CONFIG_ARCH_R8A774C0) += r8a774c0-cat874.dtb r8a774c0-ek874.dtb +dtb-$(CONFIG_ARCH_R8A774C0) += r8a774c0-cat874.dtb r8a774c0-ek874.dtb \ + r8a774c0-ek874-idk-2121wr.dtb dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-salvator-x.dtb r8a7795-h3ulcb.dtb dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-h3ulcb-kf.dtb dtb-$(CONFIG_ARCH_R8A7795) += r8a7795-salvator-xs.dtb diff --git a/arch/arm64/boot/dts/renesas/r8a774c0-ek874-idk-2121wr.dts b/arch/arm64/boot/dts/renesas/r8a774c0-ek874-idk-2121wr.dts new file mode 100644 index 0000000..df8a60b --- /dev/null +++ b/arch/arm64/boot/dts/renesas/r8a774c0-ek874-idk-2121wr.dts @@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the Silicon Linux RZ/G2E evaluation kit (EK874), + * connected to an Advantech IDK-2121WR 21.5" LVDS panel + * + * Copyright (C) 2019 Renesas Electronics Corp. + */ + +#include "r8a774c0-ek874.dts" + +/ { + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm5 0 50000>; + + brightness-levels = <0 4 8 16 32 64 128 255>; + default-brightness-level = <6>; + + power-supply = <®_12p0v>; + enable-gpios = <&gpio6 12 GPIO_ACTIVE_HIGH>; + }; + + panel-lvds { + compatible = "advantech,idk-2121wr", "panel-lvds"; + + width-mm = <476>; + height-mm = <268>; + + data-mapping = "vesa-24"; + + panel-timing { + clock-frequency = <148500000>; + hactive = <1920>; + vactive = <1080>; + hsync-len = <44>; + hfront-porch = <88>; + hback-porch = <148>; + vfront-porch = <4>; + vback-porch = <36>; + vsync-len = <5>; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + panel_in0: endpoint { + remote-endpoint = <&lvds0_out>; + }; + }; + + port@1 { + reg = <1>; + panel_in1: endpoint { + remote-endpoint = <&lvds1_out>; + }; + }; + }; + }; +}; + +&gpio0 { + /* + * When GP0_17 is low LVDS[01] are connected to the LVDS connector + * When GP0_17 is high LVDS[01] are connected to the LT8918L + */ + lvds-connector-en-gpio{ + gpio-hog; + gpios = <17 GPIO_ACTIVE_HIGH>; + output-low; + line-name = "lvds-connector-en-gpio"; + }; +}; + +&lvds0 { + renesas,swap-data; + + ports { + port@1 { + lvds0_out: endpoint { + remote-endpoint = <&panel_in0>; + }; + }; + }; +}; + +&lvds1 { + status = "okay"; + + clocks = <&cpg CPG_MOD 727>, <&x13_clk>, <&extal_clk>; + clock-names = "fck", "dclkin.0", "extal"; + + ports { + port@1 { + lvds1_out: endpoint { + remote-endpoint = <&panel_in1>; + }; + }; + }; +}; + +&pfc { + pwm5_pins: pwm5 { + groups = "pwm5_a"; + function = "pwm5"; + }; +}; + +&pwm5 { + pinctrl-0 = <&pwm5_pins>; + pinctrl-names = "default"; + + status = "okay"; +};