Skip to contentSkip to conversation

drm/meson: add support for MIPI DSI Display

PATCH Superseded Neil Armstrong 4 participants 17 messages Jan 7, 2022 – Jan 12, 2022

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover drm/meson: add support for MIPI DSI Display

The Amlogic G12A, G12B & SM1 SoCs embeds a Synopsys DW-MIPI-DSI transceiver (ver 1.21a), with a custom glue managing the IP resets, clock and data input similar to the DW-HDMI glue on the same Amlogic SoCs.

This adds support for the glue managing the transceiver, mimicing the init flow provided by Amlogic to setup the ENCL encoder, the glue, the transceiver, the digital D-PHY and the Analog PHY in the proper way.

The DW-MIPI-DSI transceiver + D-PHY are clocked by the GP0 PLL, and the ENCL encoder + VIU pixel reader by the VCLK2 clock using the HDMI PLL.

The DW-MIPI-DSI transceiver gets this pixel stream as input clocked with the VCLK2 clock.

An optional "MEAS" clock can be enabled to measure the delay between each vsync feeding the DW-MIPI-DSI transceiver.

This patchset is based on an earlier attempt at [1] for the AXG SoCs, but:
- the AXG has a single clock source for both transceiver + pixel, which makes it an exception instead of a rule, it's simpler to add support for G12A then add AXG on it
- previous glue code was a single monolitic code mixing encoders & bridges, this version is aligned on the previous cleanup done on HDMI & CVBS bridges architecture at [2]
- since the only output of AXG is DSI, AXG VPU support is post-poned until we implement single-clock DSI support specific case on top of this.

[1] https://lore.kernel.org/r/[email protected]
[2] https://lore.kernel.org/r/[email protected]

Neil Armstrong (6):
dt-bindings: display: add Amlogic MIPI DSI Host Controller bindings
dt-bindings: display: meson-vpu: add third DPI output port drm/meson: venc: add ENCL encoder setup for MIPI-DSI output drm/meson: vclk: add DSI clock config
drm/meson: add DSI encoder
drm/meson: add support for MIPI-DSI transceiver

 .../display/amlogic,meson-dw-mipi-dsi.yaml    | 118 ++++++
 .../bindings/display/amlogic,meson-vpu.yaml   |   5 +
 drivers/gpu/drm/meson/Kconfig                 |   7 +
 drivers/gpu/drm/meson/Makefile                |   3 +-
 drivers/gpu/drm/meson/meson_drv.c             |   7 +
 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c     | 383 ++++++++++++++++++
 drivers/gpu/drm/meson/meson_dw_mipi_dsi.h     | 115 ++++++
 drivers/gpu/drm/meson/meson_encoder_dsi.c     | 159 ++++++++
 drivers/gpu/drm/meson/meson_encoder_dsi.h     |  12 +
 drivers/gpu/drm/meson/meson_vclk.c            |  47 +++
 drivers/gpu/drm/meson/meson_vclk.h            |   1 +
 drivers/gpu/drm/meson/meson_venc.c            | 230 ++++++++++-
 drivers/gpu/drm/meson/meson_venc.h            |   6 +
 drivers/gpu/drm/meson/meson_vpp.h             |   2 +
 14 files changed, 1092 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml
 create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
 create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.h
 create mode 100644 drivers/gpu/drm/meson/meson_encoder_dsi.c
 create mode 100644 drivers/gpu/drm/meson/meson_encoder_dsi.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/6 dt-bindings: display: add Amlogic MIPI DSI Host Controller bindings

The Amlogic G12A, G12B & SM1 SoCs embeds a Synopsys DW-MIPI-DSI transceiver (ver 1.21a), with a custom glue managing the IP resets, clock and data input similar to the DW-HDMI Glue on the same Amlogic SoCs.

---
 .../display/amlogic,meson-dw-mipi-dsi.yaml    | 118 ++++++++++++++++++
 1 file changed, 118 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml
Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml new file +118 -0
new file mode 100644
index 000000000000..f3070783d606
@@ -0,0 +1,118 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2020 BayLibre, SAS
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/display/amlogic,meson-dw-mipi-dsi.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Amlogic specific extensions to the Synopsys Designware MIPI DSI Host Controller
+
+maintainers:
+  - Neil Armstrong <[email protected]>
+
+description: |
+  The Amlogic Meson Synopsys Designware Integration is composed of
+  - A Synopsys DesignWare MIPI DSI Host Controller IP
+  - A TOP control block controlling the Clocks & Resets of the IP
+
+allOf:
+  - $ref: dsi-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - amlogic,meson-g12a-dw-mipi-dsi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    minItems: 2
+
+  clock-names:
+    minItems: 2
+    items:
+      - const: pclk
+      - const: px_clk
+      - const: meas_clk
+
+  resets:
+    minItems: 1
+
+  reset-names:
+    items:
+      - const: top
+
+  phys:
+    minItems: 1
+
+  phy-names:
+    items:
+      - const: dphy
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
+        description: Input node to receive pixel data.
+
+      port@1:
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
+        description: DSI output node to panel.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - phys
+  - phy-names
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    dsi@7000 {
+          compatible = "amlogic,meson-g12a-dw-mipi-dsi";
+          reg = <0x6000 0x400>;
+          resets = <&reset_top>;
+          reset-names = "top";
+          clocks = <&clk_pclk>, <&clk_px>;
+          clock-names = "pclk", "px_clk";
+          phys = <&mipi_dphy>;
+          phy-names = "dphy";
+
+          ports {
+              #address-cells = <1>;
+              #size-cells = <0>;
+
+              /* VPU VENC Input */
+              mipi_dsi_venc_port: port@0 {
+                  reg = <0>;
+
+                  mipi_dsi_in: endpoint {
+                       remote-endpoint = <&dpi_out>;
+                  };
+              };
+
+              /* DSI Output */
+              mipi_dsi_panel_port: port@1 {
+                  reg = <1>;
+
+                  mipi_out_panel: endpoint {
+                      remote-endpoint = <&mipi_in_panel>;
+                  };
+              };
+          };
+    };
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] dt-bindings: display: add Amlogic MIPI DSI Host Controller bindings

Quoted 64 lines · Neil Armstrong

The Amlogic G12A, G12B & SM1 SoCs embeds a Synopsys DW-MIPI-DSI transceiver (ver 1.21a), with a custom glue managing the IP resets, clock and data input similar to the DW-HDMI Glue on the same Amlogic SoCs.

---
 .../display/amlogic,meson-dw-mipi-dsi.yaml    | 118 ++++++++++++++++++
 1 file changed, 118 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml
Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml new file +48 -0
new file mode 100644
index 000000000000..f3070783d606
@@ -0,0 +1,118 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2020 BayLibre, SAS
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/display/amlogic,meson-dw-mipi-dsi.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Amlogic specific extensions to the Synopsys Designware MIPI DSI Host Controller
+
+maintainers:
+  - Neil Armstrong <[email protected]>
+
+description: |
+  The Amlogic Meson Synopsys Designware Integration is composed of
+  - A Synopsys DesignWare MIPI DSI Host Controller IP
+  - A TOP control block controlling the Clocks & Resets of the IP
+
+allOf:
+  - $ref: dsi-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - amlogic,meson-g12a-dw-mipi-dsi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    minItems: 2
+
+  clock-names:
+    minItems: 2
+    items:
+      - const: pclk
+      - const: px_clk
+      - const: meas_clk
+
+  resets:
+    minItems: 1
+
+  reset-names:
+    items:
+      - const: top
+
+  phys:
+    minItems: 1
+

Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml line 58

Quoted 10 lines
Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml new file +10 -0
+  phy-names:
+    items:
+      - const: dphy
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/$defs/port-base

/schemas/graph.yaml#/properties/port

Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml line 59

Quoted 1 line
Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml new file +1 -0
+        unevaluatedProperties: false

And this can be dropped.

Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml line 64

Quoted 5 lines
Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml new file +5 -0
+        description: Input node to receive pixel data.
+
+      port@1:
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false

Same here.

With that,

Quoted 58 lines
Documentation/devicetree/bindings/display/amlogic,meson-dw-mipi-dsi.yaml new file +54 -0
+        description: DSI output node to panel.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - phys
+  - phy-names
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    dsi@7000 {
+          compatible = "amlogic,meson-g12a-dw-mipi-dsi";
+          reg = <0x6000 0x400>;
+          resets = <&reset_top>;
+          reset-names = "top";
+          clocks = <&clk_pclk>, <&clk_px>;
+          clock-names = "pclk", "px_clk";
+          phys = <&mipi_dphy>;
+          phy-names = "dphy";
+
+          ports {
+              #address-cells = <1>;
+              #size-cells = <0>;
+
+              /* VPU VENC Input */
+              mipi_dsi_venc_port: port@0 {
+                  reg = <0>;
+
+                  mipi_dsi_in: endpoint {
+                       remote-endpoint = <&dpi_out>;
+                  };
+              };
+
+              /* DSI Output */
+              mipi_dsi_panel_port: port@1 {
+                  reg = <1>;
+
+                  mipi_out_panel: endpoint {
+                      remote-endpoint = <&mipi_in_panel>;
+                  };
+              };
+          };
+    };
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/6 dt-bindings: display: meson-vpu: add third DPI output port

In reply to Neil Armstrong

Add third port corresponding to the ENCL DPI encoder used to connect to DSI or LVDS transceivers.

---
 .../devicetree/bindings/display/amlogic,meson-vpu.yaml       | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml +5 -0
index 851cb0781217..525a01a38568 100644
@@ -92,6 +92,11 @@ properties:
     description:
       A port node pointing to the HDMI-TX port node.
 
+  port@2:
+    $ref: /schemas/graph.yaml#/properties/port
+    description:
+      A port node pointing to the DPI port node (e.g. DSI or LVDS transceiver).
+
   "#address-cells":
     const: 1
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 2/6
#5 lore raw

Re: [PATCH 2/6] dt-bindings: display: meson-vpu: add third DPI output port

In reply to Neil Armstrong
Quoted 8 lines · Neil Armstrong

Add third port corresponding to the ENCL DPI encoder used to connect to DSI or LVDS transceivers.

---
 .../devicetree/bindings/display/amlogic,meson-vpu.yaml       | 5 +++++
 1 file changed, 5 insertions(+)
#6 lore raw

PATCH 3/6 drm/meson: venc: add ENCL encoder setup for MIPI-DSI output

In reply to Neil Armstrong

This adds supports for the ENCL encoder connected to a MIPI-DSI transceiver on the Amlogic AXG SoCs.

---
 drivers/gpu/drm/meson/meson_venc.c | 230 ++++++++++++++++++++++++++++-
 drivers/gpu/drm/meson/meson_venc.h |   6 +
 drivers/gpu/drm/meson/meson_vpp.h  |   2 +
 3 files changed, 236 insertions(+), 2 deletions(-)
drivers/gpu/drm/meson/meson_venc.c +228 -2
index 3c55ed003359..b430dc06aa34 100644
@@ -6,6 +6,7 @@
  */
 
 #include <linux/export.h>
+#include <linux/iopoll.h>
 
 #include <drm/drm_modes.h>
 
@@ -1557,6 +1558,224 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
 }
 EXPORT_SYMBOL_GPL(meson_venc_hdmi_mode_set);
 
+static unsigned short meson_encl_gamma_table[256] = {
+	0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
+	64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124,
+	128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188,
+	192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, 252,
+	256, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 308, 312, 316,
+	320, 324, 328, 332, 336, 340, 344, 348, 352, 356, 360, 364, 368, 372, 376, 380,
+	384, 388, 392, 396, 400, 404, 408, 412, 416, 420, 424, 428, 432, 436, 440, 444,
+	448, 452, 456, 460, 464, 468, 472, 476, 480, 484, 488, 492, 496, 500, 504, 508,
+	512, 516, 520, 524, 528, 532, 536, 540, 544, 548, 552, 556, 560, 564, 568, 572,
+	576, 580, 584, 588, 592, 596, 600, 604, 608, 612, 616, 620, 624, 628, 632, 636,
+	640, 644, 648, 652, 656, 660, 664, 668, 672, 676, 680, 684, 688, 692, 696, 700,
+	704, 708, 712, 716, 720, 724, 728, 732, 736, 740, 744, 748, 752, 756, 760, 764,
+	768, 772, 776, 780, 784, 788, 792, 796, 800, 804, 808, 812, 816, 820, 824, 828,
+	832, 836, 840, 844, 848, 852, 856, 860, 864, 868, 872, 876, 880, 884, 888, 892,
+	896, 900, 904, 908, 912, 916, 920, 924, 928, 932, 936, 940, 944, 948, 952, 956,
+	960, 964, 968, 972, 976, 980, 984, 988, 992, 996, 1000, 1004, 1008, 1012, 1016, 1020,
+};
+
+#define GAMMA_VCOM_POL    7     /* RW */
+#define GAMMA_RVS_OUT     6     /* RW */
+#define ADR_RDY           5     /* Read Only */
+#define WR_RDY            4     /* Read Only */
+#define RD_RDY            3     /* Read Only */
+#define GAMMA_TR          2     /* RW */
+#define GAMMA_SET         1     /* RW */
+#define GAMMA_EN          0     /* RW */
+
+#define H_RD              12
+#define H_AUTO_INC        11
+#define H_SEL_R           10
+#define H_SEL_G           9
+#define H_SEL_B           8
+#define HADR_MSB          7            /* 7:0 */
+#define HADR              0            /* 7:0 */
+
+#define GAMMA_RETRY       1000
+
+static void meson_encl_set_gamma_table(struct meson_drm *priv, u16 *data,
+				       u32 rgb_mask)
+{
+	int i, ret;
+	u32 reg;
+
+	writel_bits_relaxed(BIT(GAMMA_EN), 0,
+			    priv->io_base + _REG(L_GAMMA_CNTL_PORT));
+
+	ret = readl_relaxed_poll_timeout(priv->io_base +
+						_REG(L_GAMMA_CNTL_PORT),
+					 reg, reg & BIT(ADR_RDY), 10, 10000);
+	if (ret)
+		pr_warn("%s: GAMMA ADR_RDY timeout\n", __func__);
+
+	writel_relaxed(BIT(H_AUTO_INC) |
+		       BIT(rgb_mask) |
+		       (0 << HADR),
+		       priv->io_base + _REG(L_GAMMA_ADDR_PORT));
+
+	for (i = 0; i < 256; i++) {
+		ret = readl_relaxed_poll_timeout(priv->io_base +
+							_REG(L_GAMMA_CNTL_PORT),
+						 reg, reg & BIT(WR_RDY),
+						 10, 10000);
+		if (ret)
+			pr_warn_once("%s: GAMMA WR_RDY timeout\n", __func__);
+
+		writel_relaxed(data[i],
+			       priv->io_base + _REG(L_GAMMA_DATA_PORT));
+	}
+
+	ret = readl_relaxed_poll_timeout(priv->io_base +
+						_REG(L_GAMMA_CNTL_PORT),
+					 reg, reg & BIT(ADR_RDY), 10, 10000);
+	if (ret)
+		pr_warn("%s: GAMMA ADR_RDY timeout\n", __func__);
+
+	writel_relaxed(BIT(H_AUTO_INC) |
+		       BIT(rgb_mask) |
+		       (0x23 << HADR),
+		       priv->io_base + _REG(L_GAMMA_ADDR_PORT));
+}
+
+void meson_encl_load_gamma(struct meson_drm *priv)
+{
+	meson_encl_set_gamma_table(priv, meson_encl_gamma_table, H_SEL_R);
+	meson_encl_set_gamma_table(priv, meson_encl_gamma_table, H_SEL_G);
+	meson_encl_set_gamma_table(priv, meson_encl_gamma_table, H_SEL_B);
+
+	writel_bits_relaxed(BIT(GAMMA_EN), BIT(GAMMA_EN),
+			    priv->io_base + _REG(L_GAMMA_CNTL_PORT));
+}
+
+void meson_venc_mipi_dsi_mode_set(struct meson_drm *priv,
+				  const struct drm_display_mode *mode)
+{
+	unsigned int max_pxcnt;
+	unsigned int max_lncnt;
+	unsigned int havon_begin;
+	unsigned int havon_end;
+	unsigned int vavon_bline;
+	unsigned int vavon_eline;
+	unsigned int hso_begin;
+	unsigned int hso_end;
+	unsigned int vso_begin;
+	unsigned int vso_end;
+	unsigned int vso_bline;
+	unsigned int vso_eline;
+
+	max_pxcnt = mode->htotal - 1;
+	max_lncnt = mode->vtotal - 1;
+	havon_begin = mode->htotal - mode->hsync_start;
+	havon_end = havon_begin + mode->hdisplay - 1;
+	vavon_bline = mode->vtotal - mode->vsync_start;
+	vavon_eline = vavon_bline + mode->vdisplay - 1;
+	hso_begin = 0;
+	hso_end = mode->hsync_end - mode->hsync_start;
+	vso_begin = 0;
+	vso_end = 0;
+	vso_bline = 0;
+	vso_eline = mode->vsync_end - mode->vsync_start;
+
+	meson_vpp_setup_mux(priv, MESON_VIU_VPP_MUX_ENCL);
+
+	writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN));
+
+	writel_relaxed(0x8000, priv->io_base + _REG(ENCL_VIDEO_MODE));
+	writel_relaxed(0x0418, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));
+
+	writel_relaxed(0x1000, priv->io_base + _REG(ENCL_VIDEO_FILT_CTRL));
+	writel_relaxed(max_pxcnt, priv->io_base + _REG(ENCL_VIDEO_MAX_PXCNT));
+	writel_relaxed(max_lncnt, priv->io_base + _REG(ENCL_VIDEO_MAX_LNCNT));
+	writel_relaxed(havon_begin, priv->io_base + _REG(ENCL_VIDEO_HAVON_BEGIN));
+	writel_relaxed(havon_end, priv->io_base + _REG(ENCL_VIDEO_HAVON_END));
+	writel_relaxed(vavon_bline, priv->io_base + _REG(ENCL_VIDEO_VAVON_BLINE));
+	writel_relaxed(vavon_eline, priv->io_base + _REG(ENCL_VIDEO_VAVON_ELINE));
+
+	writel_relaxed(hso_begin, priv->io_base + _REG(ENCL_VIDEO_HSO_BEGIN));
+	writel_relaxed(hso_end, priv->io_base + _REG(ENCL_VIDEO_HSO_END));
+	writel_relaxed(vso_begin, priv->io_base + _REG(ENCL_VIDEO_VSO_BEGIN));
+	writel_relaxed(vso_end, priv->io_base + _REG(ENCL_VIDEO_VSO_END));
+	writel_relaxed(vso_bline, priv->io_base + _REG(ENCL_VIDEO_VSO_BLINE));
+	writel_relaxed(vso_eline, priv->io_base + _REG(ENCL_VIDEO_VSO_ELINE));
+	writel_relaxed(3, priv->io_base + _REG(ENCL_VIDEO_RGBIN_CTRL));
+
+	/* default black pattern */
+	writel_relaxed(0, priv->io_base + _REG(ENCL_TST_MDSEL));
+	writel_relaxed(0, priv->io_base + _REG(ENCL_TST_Y));
+	writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CB));
+	writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CR));
+	writel_relaxed(1, priv->io_base + _REG(ENCL_TST_EN));
+	writel_bits_relaxed(BIT(3), 0, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));
+
+	writel_relaxed(1, priv->io_base + _REG(ENCL_VIDEO_EN));
+
+	writel_relaxed(0, priv->io_base + _REG(L_RGB_BASE_ADDR));
+	writel_relaxed(0x400, priv->io_base + _REG(L_RGB_COEFF_ADDR));
+	writel_relaxed(0x400, priv->io_base + _REG(L_DITH_CNTL_ADDR));
+
+	/* DE signal for TTL */
+	writel_relaxed(havon_begin, priv->io_base + _REG(L_OEH_HS_ADDR));
+	writel_relaxed(havon_end + 1, priv->io_base + _REG(L_OEH_HE_ADDR));
+	writel_relaxed(vavon_bline, priv->io_base + _REG(L_OEH_VS_ADDR));
+	writel_relaxed(vavon_eline, priv->io_base + _REG(L_OEH_VE_ADDR));
+
+	/* DE signal for TTL */
+	writel_relaxed(havon_begin, priv->io_base + _REG(L_OEV1_HS_ADDR));
+	writel_relaxed(havon_end + 1, priv->io_base + _REG(L_OEV1_HE_ADDR));
+	writel_relaxed(vavon_bline, priv->io_base + _REG(L_OEV1_VS_ADDR));
+	writel_relaxed(vavon_eline, priv->io_base + _REG(L_OEV1_VE_ADDR));
+
+	/* Hsync signal for TTL */
+	if (mode->flags & DRM_MODE_FLAG_PHSYNC) {
+		writel_relaxed(hso_end, priv->io_base + _REG(L_STH1_HS_ADDR));
+		writel_relaxed(hso_begin, priv->io_base + _REG(L_STH1_HE_ADDR));
+	} else {
+		writel_relaxed(hso_begin, priv->io_base + _REG(L_STH1_HS_ADDR));
+		writel_relaxed(hso_end, priv->io_base + _REG(L_STH1_HE_ADDR));
+	}
+	writel_relaxed(0, priv->io_base + _REG(L_STH1_VS_ADDR));
+	writel_relaxed(max_lncnt, priv->io_base + _REG(L_STH1_VE_ADDR));
+
+	/* Vsync signal for TTL */
+	writel_relaxed(vso_begin, priv->io_base + _REG(L_STV1_HS_ADDR));
+	writel_relaxed(vso_end, priv->io_base + _REG(L_STV1_HE_ADDR));
+	if (mode->flags & DRM_MODE_FLAG_PVSYNC) {
+		writel_relaxed(vso_eline, priv->io_base + _REG(L_STV1_VS_ADDR));
+		writel_relaxed(vso_bline, priv->io_base + _REG(L_STV1_VE_ADDR));
+	} else {
+		writel_relaxed(vso_bline, priv->io_base + _REG(L_STV1_VS_ADDR));
+		writel_relaxed(vso_eline, priv->io_base + _REG(L_STV1_VE_ADDR));
+	}
+
+	/* DE signal */
+	writel_relaxed(havon_begin, priv->io_base + _REG(L_DE_HS_ADDR));
+	writel_relaxed(havon_end + 1, priv->io_base + _REG(L_DE_HE_ADDR));
+	writel_relaxed(vavon_bline, priv->io_base + _REG(L_DE_VS_ADDR));
+	writel_relaxed(vavon_eline, priv->io_base + _REG(L_DE_VE_ADDR));
+
+	/* Hsync signal */
+	writel_relaxed(hso_begin, priv->io_base + _REG(L_HSYNC_HS_ADDR));
+	writel_relaxed(hso_end, priv->io_base + _REG(L_HSYNC_HE_ADDR));
+	writel_relaxed(0, priv->io_base + _REG(L_HSYNC_VS_ADDR));
+	writel_relaxed(max_lncnt, priv->io_base + _REG(L_HSYNC_VE_ADDR));
+
+	/* Vsync signal */
+	writel_relaxed(vso_begin, priv->io_base + _REG(L_VSYNC_HS_ADDR));
+	writel_relaxed(vso_end, priv->io_base + _REG(L_VSYNC_HE_ADDR));
+	writel_relaxed(vso_bline, priv->io_base + _REG(L_VSYNC_VS_ADDR));
+	writel_relaxed(vso_eline, priv->io_base + _REG(L_VSYNC_VE_ADDR));
+
+	writel_relaxed(0, priv->io_base + _REG(L_INV_CNT_ADDR));
+	writel_relaxed(BIT(4) | BIT(5),
+		       priv->io_base + _REG(L_TCON_MISC_SEL_ADDR));
+
+	priv->venc.current_mode = MESON_VENC_MODE_MIPI_DSI;
+}
+EXPORT_SYMBOL_GPL(meson_venc_mipi_dsi_mode_set);
+
 void meson_venci_cvbs_mode_set(struct meson_drm *priv,
 			       struct meson_cvbs_enci_mode *mode)
 {
@@ -1747,8 +1966,15 @@ unsigned int meson_venci_get_field(struct meson_drm *priv)
 
 void meson_venc_enable_vsync(struct meson_drm *priv)
 {
-	writel_relaxed(VENC_INTCTRL_ENCI_LNRST_INT_EN,
-		       priv->io_base + _REG(VENC_INTCTRL));
+	switch (priv->venc.current_mode) {
+	case MESON_VENC_MODE_MIPI_DSI:
+		writel_relaxed(0x200,
+			       priv->io_base + _REG(VENC_INTCTRL));
+		break;
+	default:
+		writel_relaxed(VENC_INTCTRL_ENCI_LNRST_INT_EN,
+			       priv->io_base + _REG(VENC_INTCTRL));
+	}
 	regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), BIT(25));
 }
 
drivers/gpu/drm/meson/meson_venc.h +6 -0
index 9138255ffc9e..0f59adb1c6db 100644
@@ -21,6 +21,7 @@ enum {
 	MESON_VENC_MODE_CVBS_PAL,
 	MESON_VENC_MODE_CVBS_NTSC,
 	MESON_VENC_MODE_HDMI,
+	MESON_VENC_MODE_MIPI_DSI,
 };
 
 struct meson_cvbs_enci_mode {
@@ -47,6 +48,9 @@ struct meson_cvbs_enci_mode {
 	unsigned int analog_sync_adj;
 };
 
+/* LCD Encoder gamma setup */
+void meson_encl_load_gamma(struct meson_drm *priv);
+
 /* HDMI Clock parameters */
 enum drm_mode_status
 meson_venc_hdmi_supported_mode(const struct drm_display_mode *mode);
@@ -63,6 +67,8 @@ void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic,
 			      unsigned int ycrcb_map,
 			      bool yuv420_mode,
 			      const struct drm_display_mode *mode);
+void meson_venc_mipi_dsi_mode_set(struct meson_drm *priv,
+				  const struct drm_display_mode *mode);
 unsigned int meson_venci_get_field(struct meson_drm *priv);
 
 void meson_venc_enable_vsync(struct meson_drm *priv);
drivers/gpu/drm/meson/meson_vpp.h +2 -0
index afc9553ed8d3..b790042a1650 100644
@@ -12,6 +12,8 @@
 struct drm_rect;
 struct meson_drm;
 
+/* Mux VIU/VPP to ENCL */
+#define MESON_VIU_VPP_MUX_ENCL	0x0
 /* Mux VIU/VPP to ENCI */
 #define MESON_VIU_VPP_MUX_ENCI	0x5
 /* Mux VIU/VPP to ENCP */
Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH 3/6] drm/meson: venc: add ENCL encoder setup for MIPI-DSI output

Hi Neil,

Quoted 3 lines · Neil Armstrong

This adds supports for the ENCL encoder connected to a MIPI-DSI transceiver on the Amlogic AXG SoCs.

Should this be "AXG and newer SoCs" or is this really AXG specific?

[...]

Quoted 4 lines
drivers/gpu/drm/meson/meson_venc.c +4 -0
+#define GAMMA_VCOM_POL    7     /* RW */
+#define GAMMA_RVS_OUT     6     /* RW */
+#define ADR_RDY           5     /* Read Only */
+#define WR_RDY            4     /* Read Only */

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1593

Quoted 10 lines
drivers/gpu/drm/meson/meson_venc.c +10 -0
+#define RD_RDY            3     /* Read Only */
+#define GAMMA_TR          2     /* RW */
+#define GAMMA_SET         1     /* RW */
+#define GAMMA_EN          0     /* RW */
+
+#define H_RD              12
+#define H_AUTO_INC        11
+#define H_SEL_R           10
+#define H_SEL_G           9
+#define H_SEL_B           8

I think all values above can be wrapped in the BIT() macro, then you don't need that below.

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1595

Quoted 2 lines
drivers/gpu/drm/meson/meson_venc.c +2 -0
+#define HADR_MSB          7            /* 7:0 */
+#define HADR              0            /* 7:0 */

Here GENMASK(7, 0) can be used for HADR

Also I think prefixing all macros above with their register name (L_GAMMA_CNTL_PORT_ or L_GAMMA_ADDR_PORT_) will make the code easier to read.

[...]

Quoted 1 line

+ writel_relaxed(0x8000, priv->io_base + _REG(ENCL_VIDEO_MODE));

The public S905 datasheet calls 0x8000 ENCL_PX_LN_CNT_SHADOW_EN

Quoted 1 line

+ writel_relaxed(0x0418, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));

According to the public S905 datasheet this is:
- BIT(3): ENCL_VIDEO_MODE_ADV_VFIFO_EN
- BIT(4): ENCL_VIDEO_MODE_ADV_GAIN_HDTV
- BIT(10): ENCL_SEL_GAMMA_RGB_IN

Quoted 1 line

+ writel_relaxed(0x1000, priv->io_base + _REG(ENCL_VIDEO_FILT_CTRL));

I don't know the exact name but the 32-bit vendor kernel sources have a comment [0] saying that 0x1000 is "bypass filter"
But maybe we can simply call it ENCL_VIDEO_FILT_CTRL_BYPASS_FILTER

[...]

Quoted 1 line

+ writel_relaxed(3, priv->io_base + _REG(ENCL_VIDEO_RGBIN_CTRL));

The public S905 datasheet says:
- BIT(0): USE RGB data from VIU, furthermore a comment in the 3.10 kernel sources make this more clear: bit[0] 1:RGB, 0:YUV
- BIT(1): CFG_VIDEO_RGBIN_ZBLK

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1711

Quoted 7 lines
drivers/gpu/drm/meson/meson_venc.c +7 -0
+       /* default black pattern */
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_MDSEL));
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_Y));
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CB));
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CR));
+       writel_relaxed(1, priv->io_base + _REG(ENCL_TST_EN));
+       writel_bits_relaxed(BIT(3), 0, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));

same as above: ENCL_VIDEO_MODE_ADV_VFIFO_EN

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1716

Quoted 5 lines
drivers/gpu/drm/meson/meson_venc.c +5 -0
+
+       writel_relaxed(1, priv->io_base + _REG(ENCL_VIDEO_EN));
+
+       writel_relaxed(0, priv->io_base + _REG(L_RGB_BASE_ADDR));
+       writel_relaxed(0x400, priv->io_base + _REG(L_RGB_COEFF_ADDR));

note to self: L_RGB_COEFF_ADDR seems to contain some "magic" value, there's no further info in the 3.10 kernel sources or datasheet

Quoted 1 line

+ writel_relaxed(0x400, priv->io_base + _REG(L_DITH_CNTL_ADDR));

According to the public S905 datasheet BIT(10) is DITH10_EN (10-bits Dithering to 8 Bits Enable).
I am not sure if this would belong to the selected video mode/bit depth. I'll let other reviewers decide if this is relevant or not because I don't know.

[...]

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1773

Quoted 3 lines
drivers/gpu/drm/meson/meson_venc.c +3 -0
+       writel_relaxed(0, priv->io_base + _REG(L_INV_CNT_ADDR));
+       writel_relaxed(BIT(4) | BIT(5),
+                      priv->io_base + _REG(L_TCON_MISC_SEL_ADDR));

the public S905 datasheet states:
- BIT(4): STV1_SEL (STV1 is frame Signal)
- BIT(5): STV2_SEL (STV2 is frame Signal)
This doesn't seem helpful to me though, but maybe you can still create preprocessor macros for this (for consistency)?

[...]

drivers/gpu/drm/meson/meson_venc.c unsigned int meson_venci_get_field(struct meson_drm *priv) · line 1972

Quoted 4 lines
drivers/gpu/drm/meson/meson_venc.c +4 -0
+       switch (priv->venc.current_mode) {
+       case MESON_VENC_MODE_MIPI_DSI:
+               writel_relaxed(0x200,
+                              priv->io_base + _REG(VENC_INTCTRL));

the public S905 datasheet documents this as:
- BIT(9): ENCP_LNRST_INT_EN (Progressive encoder filed change interrupt enable) Please add a preprocessor macro to make it consistent with VENC_INTCTRL_ENCI_LNRST_INT_EN which already exists and is used below.

Best regards,
Martin

#8 lore raw

Re: [PATCH 3/6] drm/meson: venc: add ENCL encoder setup for MIPI-DSI output

Quoted 6 lines · Martin Blumenstingl

Hi Neil,

Quoted 3 lines · Neil Armstrong

This adds supports for the ENCL encoder connected to a MIPI-DSI transceiver on the Amlogic AXG SoCs> Should this be "AXG and newer SoCs" or is this really AXG specific?

Yup should be, thanks for noting

Quoted 18 lines

[...]

Quoted 4 lines
drivers/gpu/drm/meson/meson_venc.c +4 -0
+#define GAMMA_VCOM_POL    7     /* RW */
+#define GAMMA_RVS_OUT     6     /* RW */
+#define ADR_RDY           5     /* Read Only */
+#define WR_RDY            4     /* Read Only */

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1593

Quoted 10 lines
drivers/gpu/drm/meson/meson_venc.c +10 -0
+#define RD_RDY            3     /* Read Only */
+#define GAMMA_TR          2     /* RW */
+#define GAMMA_SET         1     /* RW */
+#define GAMMA_EN          0     /* RW */
+
+#define H_RD              12
+#define H_AUTO_INC        11
+#define H_SEL_R           10
+#define H_SEL_G           9
+#define H_SEL_B           8

I think all values above can be wrapped in the BIT() macro, then you don't need that below.

yep

Quoted 5 lines

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1595

Quoted 3 lines
drivers/gpu/drm/meson/meson_venc.c +2 -0
+#define HADR_MSB          7            /* 7:0 */
+#define HADR              0            /* 7:0 */

Here GENMASK(7, 0) can be used for HADR

Quoted 7 lines

Also I think prefixing all macros above with their register name (L_GAMMA_CNTL_PORT_ or L_GAMMA_ADDR_PORT_) will make the code easier to read.

[...]

Quoted 1 line

+ writel_relaxed(0x8000, priv->io_base + _REG(ENCL_VIDEO_MODE));

The public S905 datasheet calls 0x8000 ENCL_PX_LN_CNT_SHADOW_EN

Thanks for searching !

Quoted 11 lines
Quoted 2 lines

+ writel_relaxed(0x0418, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));

According to the public S905 datasheet this is:
- BIT(3): ENCL_VIDEO_MODE_ADV_VFIFO_EN
- BIT(4): ENCL_VIDEO_MODE_ADV_GAIN_HDTV
- BIT(10): ENCL_SEL_GAMMA_RGB_IN

Quoted 1 line

+ writel_relaxed(0x1000, priv->io_base + _REG(ENCL_VIDEO_FILT_CTRL));

I don't know the exact name but the 32-bit vendor kernel sources have a comment [0] saying that 0x1000 is "bypass filter"
But maybe we can simply call it ENCL_VIDEO_FILT_CTRL_BYPASS_FILTER

Yep

Quoted 25 lines

[...]

Quoted 1 line

+ writel_relaxed(3, priv->io_base + _REG(ENCL_VIDEO_RGBIN_CTRL));

The public S905 datasheet says:
- BIT(0): USE RGB data from VIU, furthermore a comment in the 3.10 kernel sources make this more clear: bit[0] 1:RGB, 0:YUV
- BIT(1): CFG_VIDEO_RGBIN_ZBLK

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1711

Quoted 7 lines
drivers/gpu/drm/meson/meson_venc.c +7 -0
+       /* default black pattern */
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_MDSEL));
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_Y));
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CB));
+       writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CR));
+       writel_relaxed(1, priv->io_base + _REG(ENCL_TST_EN));
+       writel_bits_relaxed(BIT(3), 0, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));

same as above: ENCL_VIDEO_MODE_ADV_VFIFO_EN

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1716

Quoted 5 lines
drivers/gpu/drm/meson/meson_venc.c +5 -0
+
+       writel_relaxed(1, priv->io_base + _REG(ENCL_VIDEO_EN));
+
+       writel_relaxed(0, priv->io_base + _REG(L_RGB_BASE_ADDR));
+       writel_relaxed(0x400, priv->io_base + _REG(L_RGB_COEFF_ADDR));

note to self: L_RGB_COEFF_ADDR seems to contain some "magic" value, there's no further info in the 3.10 kernel sources or datasheet

Quoted 5 lines
Quoted 1 line

+ writel_relaxed(0x400, priv->io_base + _REG(L_DITH_CNTL_ADDR));

According to the public S905 datasheet BIT(10) is DITH10_EN (10-bits Dithering to 8 Bits Enable).
I am not sure if this would belong to the selected video mode/bit depth. I'll let other reviewers decide if this is relevant or not because I don't know.

it would probably for pre-GXL when the pipeline was 8bit, would probably need to add a comment if someone wants to us DPI/LVDS on pre-GXL.

Quoted 10 lines

[...]

drivers/gpu/drm/meson/meson_venc.c void meson_venc_hdmi_mode_set(struct meson_drm *priv, int vic, · line 1773

Quoted 3 lines
drivers/gpu/drm/meson/meson_venc.c +3 -0
+       writel_relaxed(0, priv->io_base + _REG(L_INV_CNT_ADDR));
+       writel_relaxed(BIT(4) | BIT(5),
+                      priv->io_base + _REG(L_TCON_MISC_SEL_ADDR));

the public S905 datasheet states:
- BIT(4): STV1_SEL (STV1 is frame Signal)
- BIT(5): STV2_SEL (STV2 is frame Signal)
This doesn't seem helpful to me though, but maybe you can still create preprocessor macros for this (for consistency)?

yep

Quoted 10 lines

[...]

drivers/gpu/drm/meson/meson_venc.c unsigned int meson_venci_get_field(struct meson_drm *priv) · line 1972

Quoted 4 lines
drivers/gpu/drm/meson/meson_venc.c +4 -0
+       switch (priv->venc.current_mode) {
+       case MESON_VENC_MODE_MIPI_DSI:
+               writel_relaxed(0x200,
+                              priv->io_base + _REG(VENC_INTCTRL));

the public S905 datasheet documents this as:
- BIT(9): ENCP_LNRST_INT_EN (Progressive encoder filed change interrupt enable) Please add a preprocessor macro to make it consistent with VENC_INTCTRL_ENCI_LNRST_INT_EN which already exists and is used below.

Yep

Thanks for the review :-)

Neil

Quoted 5 lines

Best regards,
Martin

#9 lore raw

PATCH 4/6 drm/meson: vclk: add DSI clock config

In reply to Neil Armstrong

The DSI path used the ENCL pixel encoder, thus this adds a clock config using the HDMI PLL in order to feed the ENCL encoder via the VCLK2 path and the CTS_ENCL clock output.

---
 drivers/gpu/drm/meson/meson_vclk.c | 47 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/meson/meson_vclk.h |  1 +
 2 files changed, 48 insertions(+)
drivers/gpu/drm/meson/meson_vclk.c +47 -0
index 2a82119eb58e..5e4d982be1c8 100644
@@ -55,6 +55,8 @@
 #define VCLK2_DIV_MASK		0xff
 #define VCLK2_DIV_EN		BIT(16)
 #define VCLK2_DIV_RESET		BIT(17)
+#define CTS_ENCL_SEL_MASK	(0xf << 12)
+#define CTS_ENCL_SEL_SHIFT	12
 #define CTS_VDAC_SEL_MASK	(0xf << 28)
 #define CTS_VDAC_SEL_SHIFT	28
 #define HHI_VIID_CLK_CNTL	0x12c /* 0x4b offset in data sheet */
@@ -83,6 +85,7 @@
 #define VCLK_DIV12_EN		BIT(4)
 #define HHI_VID_CLK_CNTL2	0x194 /* 0x65 offset in data sheet */
 #define CTS_ENCI_EN		BIT(0)
+#define CTS_ENCL_EN		BIT(3)
 #define CTS_ENCP_EN		BIT(2)
 #define CTS_VDAC_EN		BIT(4)
 #define HDMI_TX_PIXEL_EN	BIT(5)
@@ -1024,6 +1027,47 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
 	regmap_update_bits(priv->hhi, HHI_VID_CLK_CNTL, VCLK_EN, VCLK_EN);
 }
 
+static void meson_dsi_clock_config(struct meson_drm *priv, unsigned int freq)
+{
+	meson_hdmi_pll_generic_set(priv, freq * 10);
+
+	/* Setup vid_pll divider value /5 */
+	meson_vid_pll_set(priv, VID_PLL_DIV_5);
+
+	/* Disable VCLK2 */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_CNTL, VCLK2_EN, 0);
+
+	/* Setup the VCLK2 divider value /2 */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_DIV, VCLK2_DIV_MASK, 2 - 1);
+
+	/* select vid_pll for vclk2 */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_CNTL,
+			   VCLK2_SEL_MASK, (0 << VCLK2_SEL_SHIFT));
+
+	/* enable vclk2 gate */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_CNTL, VCLK2_EN, VCLK2_EN);
+
+	/* select vclk2_div1 for encl */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_DIV,
+			   CTS_ENCL_SEL_MASK, (8 << CTS_ENCL_SEL_SHIFT));
+
+	/* release vclk2_div_reset and enable vclk2_div */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_DIV, VCLK2_DIV_EN | VCLK2_DIV_RESET,
+			   VCLK2_DIV_EN);
+
+	/* enable vclk2_div1 gate */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_CNTL, VCLK2_DIV1_EN, VCLK2_DIV1_EN);
+
+	/* reset vclk2 */
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_CNTL, VCLK2_SOFT_RESET, VCLK2_SOFT_RESET);
+	regmap_update_bits(priv->hhi, HHI_VIID_CLK_CNTL, VCLK2_SOFT_RESET, 0);
+
+	/* enable encl_clk */
+	regmap_update_bits(priv->hhi, HHI_VID_CLK_CNTL2, CTS_ENCL_EN, CTS_ENCL_EN);
+
+	usleep_range(10000, 11000);
+}
+
 void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
 		      unsigned int phy_freq, unsigned int vclk_freq,
 		      unsigned int venc_freq, unsigned int dac_freq,
@@ -1050,6 +1094,9 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
 		meson_vclk_set(priv, phy_freq, 0, 0, 0,
 			       VID_PLL_DIV_5, 2, 1, 1, false, false);
 		return;
+	} else if (target == MESON_VCLK_TARGET_DSI) {
+		meson_dsi_clock_config(priv, phy_freq);
+		return;
 	}
 
 	hdmi_tx_div = vclk_freq / dac_freq;
drivers/gpu/drm/meson/meson_vclk.h +1 -0
index 60617aaf18dd..1152b3af8d2e 100644
@@ -17,6 +17,7 @@ enum {
 	MESON_VCLK_TARGET_CVBS = 0,
 	MESON_VCLK_TARGET_HDMI = 1,
 	MESON_VCLK_TARGET_DMT = 2,
+	MESON_VCLK_TARGET_DSI = 3,
 };
 
 /* 27MHz is the CVBS Pixel Clock */
Signature · 1 line
2.25.1
#10 lore raw

PATCH 5/6 drm/meson: add DSI encoder

In reply to Neil Armstrong

This adds an encoder bridge designed to drive a MIPI-DSI display by using the ENCL encoder through the internal MIPI DSI transceiver connected to the output of the ENCL pixel encoder.

---
 drivers/gpu/drm/meson/Makefile            |   2 +-
 drivers/gpu/drm/meson/meson_drv.c         |   7 +
 drivers/gpu/drm/meson/meson_encoder_dsi.c | 159 ++++++++++++++++++++++
 drivers/gpu/drm/meson/meson_encoder_dsi.h |  12 ++
 4 files changed, 179 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/meson/meson_encoder_dsi.c
 create mode 100644 drivers/gpu/drm/meson/meson_encoder_dsi.h
drivers/gpu/drm/meson/Makefile +1 -1
index 3afa31bdc950..833e18c20603 100644
@@ -2,7 +2,7 @@
 meson-drm-y := meson_drv.o meson_plane.o meson_crtc.o meson_encoder_cvbs.o
 meson-drm-y += meson_viu.o meson_vpp.o meson_venc.o meson_vclk.o meson_overlay.o
 meson-drm-y += meson_rdma.o meson_osd_afbcd.o
-meson-drm-y += meson_encoder_hdmi.o
+meson-drm-y += meson_encoder_hdmi.o meson_encoder_dsi.o
 
 obj-$(CONFIG_DRM_MESON) += meson-drm.o
 obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o
drivers/gpu/drm/meson/meson_drv.c +7 -0
index 80f1d439841a..ff278a2b9e6e 100644
@@ -33,6 +33,7 @@
 #include "meson_registers.h"
 #include "meson_encoder_cvbs.h"
 #include "meson_encoder_hdmi.h"
+#include "meson_encoder_dsi.h"
 #include "meson_viu.h"
 #include "meson_vpp.h"
 #include "meson_rdma.h"
@@ -323,6 +324,12 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 	if (ret)
 		goto free_drm;
 
+	if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) {
+		ret = meson_encoder_dsi_init(priv);
+		if (ret)
+			goto free_drm;
+	}
+
 	ret = meson_plane_create(priv);
 	if (ret)
 		goto free_drm;
drivers/gpu/drm/meson/meson_encoder_dsi.c new file +159 -0

159 lines not on this page · raw message

drivers/gpu/drm/meson/meson_encoder_dsi.h new file +12 -0
new file mode 100644
index 000000000000..0f4b641eb633
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2021 BayLibre, SAS
+ * Author: Neil Armstrong <[email protected]>
+ */
+
+#ifndef __MESON_ENCODER_DSI_H
+#define __MESON_ENCODER_DSI_H
+
+int meson_encoder_dsi_init(struct meson_drm *priv);
+
+#endif /* __MESON_ENCODER_DSI_H */
Signature · 1 line
2.25.1
#11 lore raw

Re: [PATCH 5/6] drm/meson: add DSI encoder

Hi Neil,

On Fri, Jan 7, 2022 at 3:57 PM Neil Armstrong <[email protected]> wrote:

[...]

Quoted 1 line

+ writel_bits_relaxed(BIT(3), BIT(3), priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));

see my comment on patch #3 from this series for BIT(3)

Best regards,
Martin

#12 lore raw

Re: [PATCH 5/6] drm/meson: add DSI encoder

Quoted 8 lines · Martin Blumenstingl

Hi Neil,

On Fri, Jan 7, 2022 at 3:57 PM Neil Armstrong <[email protected]> wrote:

[...]

Quoted 1 line

+ writel_bits_relaxed(BIT(3), BIT(3), priv->io_base + _REG(ENCL_VIDEO_MODE_ADV));

see my comment on patch #3 from this series for BIT(3)

Yep, thanks,

Neil

Quoted 4 lines

Best regards,
Martin

#13 lore raw

Re: [PATCH 5/6] drm/meson: add DSI encoder

In reply to Neil Armstrong
I love your patch! Perhaps something to improve:

Hi Neil,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on drm-intel/for-linux-next drm-tip/drm-tip drm-exynos/exynos-drm-next next-20220107] [cannot apply to tegra-drm/drm/tegra/for-next airlied/drm-next v5.16-rc8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Neil-Armstrong/drm-meson-add-support-for-MIPI-DSI-Display/20220107-225717
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: arm-randconfig-r002-20220107 (https://download.01.org/0day-ci/archive/20220109/202201090255.SV1mvcAL-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f3a344d2125fa37e59bae1b0874442c650a19607)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/ceb473650c47d3914419f8795fba12fbc9947710
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Neil-Armstrong/drm-meson-add-support-for-MIPI-DSI-Display/20220107-225717 git checkout ceb473650c47d3914419f8795fba12fbc9947710
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/drm/meson/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/meson/meson_encoder_dsi.c:121:69: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
                   dev_dbg(priv->dev, "Failed to find DSI transceiver bridge: %d\n", ret);
                                                                                     ^~~
   include/linux/dev_printk.h:155:39: note: expanded from macro 'dev_dbg'
           dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                ^~~~~~~~~~~
   include/linux/dynamic_debug.h:167:19: note: expanded from macro 'dynamic_dev_dbg'
                              dev, fmt, ##__VA_ARGS__)
                                          ^~~~~~~~~~~
   include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic_func_call'
           __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
                                                                 ^~~~~~~~~~~
   include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynamic_func_call'
                   func(&id, ##__VA_ARGS__);               \
                               ^~~~~~~~~~~
   drivers/gpu/drm/meson/meson_encoder_dsi.c:106:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0

1 warning generated.

vim +/ret +121 drivers/gpu/drm/meson/meson_encoder_dsi.c

101
102 int meson_encoder_dsi_init(struct meson_drm *priv)
103 {
104 struct meson_encoder_dsi *meson_encoder_dsi;
105 struct device_node *remote;
106 int ret;
107
108 meson_encoder_dsi = devm_kzalloc(priv->dev, sizeof(*meson_encoder_dsi), GFP_KERNEL);
109 if (!meson_encoder_dsi)
110 return -ENOMEM;
111
112 /* DSI Transceiver Bridge */
113 remote = of_graph_get_remote_node(priv->dev->of_node, 2, 0);
114 if (!remote) {
115 dev_err(priv->dev, "DSI transceiver device is disabled");
116 return 0;
117 }
118
119 meson_encoder_dsi->next_bridge = of_drm_find_bridge(remote);
120 if (!meson_encoder_dsi->next_bridge) {

 > 121			dev_dbg(priv->dev, "Failed to find DSI transceiver bridge: %d\n", ret);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#14 lore raw

PATCH 6/6 drm/meson: add support for MIPI-DSI transceiver

In reply to Neil Armstrong

The Amlogic G12A/G12B/SM1 SoCs embeds a Synopsys DW-MIPI-DSI transceiver (ver 1.21a), with a custom glue managing the IP resets, clock and data input similar to the DW-HDMI Glue on other Amlogic SoCs.

This adds support for the Glue managing the transceiver, mimicing the init flow provided by Amlogic to setup the ENCL encoder, the glue, the transceiver, the digital D-PHY and the Analog PHY in the proper way.

An optional "MEAS" clock can be enabled to measure the delay between each vsync feeding the DW-MIPI-DSI transceiver.

---
 drivers/gpu/drm/meson/Kconfig             |   7 +
 drivers/gpu/drm/meson/Makefile            |   1 +
 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 383 ++++++++++++++++++++++
 drivers/gpu/drm/meson/meson_dw_mipi_dsi.h | 115 +++++++
 4 files changed, 506 insertions(+)
 create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
 create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.h
drivers/gpu/drm/meson/Kconfig +7 -0
index 6c70fc3214af..71a1364b51e1 100644
@@ -17,3 +17,10 @@ config DRM_MESON_DW_HDMI
 	default y if DRM_MESON
 	select DRM_DW_HDMI
 	imply DRM_DW_HDMI_I2S_AUDIO
+
+config DRM_MESON_DW_MIPI_DSI
+	tristate "MIPI DSI Synopsys Controller support for Amlogic Meson Display"
+	depends on DRM_MESON
+	default y if DRM_MESON
+	select DRM_DW_MIPI_DSI
+	select GENERIC_PHY_MIPI_DPHY
drivers/gpu/drm/meson/Makefile +1 -0
index 833e18c20603..43071bdbd4b9 100644
@@ -6,3 +6,4 @@ meson-drm-y += meson_encoder_hdmi.o meson_encoder_dsi.o
 
 obj-$(CONFIG_DRM_MESON) += meson-drm.o
 obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o
+obj-$(CONFIG_DRM_MESON_DW_MIPI_DSI) += meson_dw_mipi_dsi.o
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +383 -0

383 lines not on this page · raw message

drivers/gpu/drm/meson/meson_dw_mipi_dsi.h new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.25.1
#15 lore raw

Re: [PATCH 6/6] drm/meson: add support for MIPI-DSI transceiver

Hi Neil,

some high-level comments from me below.

On Fri, Jan 7, 2022 at 3:58 PM Neil Armstrong <[email protected]> wrote:
[...]

Quoted 5 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +5 -0
+/*  MIPI DSI Relative REGISTERs Definitions */
+/* For MIPI_DSI_TOP_CNTL */
+#define BIT_DPI_COLOR_MODE        20
+#define BIT_IN_COLOR_MODE         16
+#define BIT_CHROMA_SUBSAMPLE      14

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 71

Quoted 10 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +10 -0
+#define BIT_COMP2_SEL             12
+#define BIT_COMP1_SEL             10
+#define BIT_COMP0_SEL              8
+#define BIT_DE_POL                 6
+#define BIT_HSYNC_POL              5
+#define BIT_VSYNC_POL              4
+#define BIT_DPICOLORM              3
+#define BIT_DPISHUTDN              2
+#define BIT_EDPITE_INTR_PULSE      1
+#define BIT_ERR_INTR_PULSE         0

Why not use BIT() and GENMASK() for these and prefixing them with MIPI_DSI_TOP_CNTL_?
That would make them consistent with other parts of the meson sub-driver.

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 92

Quoted 4 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +4 -0
+static void meson_dw_mipi_dsi_hw_init(struct meson_dw_mipi_dsi *mipi_dsi)
+{
+       writel_relaxed((1 << 4) | (1 << 5) | (0 << 6),
+                      mipi_dsi->base + MIPI_DSI_TOP_CNTL);

please use the macros from above

Quoted 2 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +2 -0
+       writel_bits_relaxed(0xf, 0xf, mipi_dsi->base + MIPI_DSI_TOP_SW_RESET);
+       writel_bits_relaxed(0xf, 0, mipi_dsi->base + MIPI_DSI_TOP_SW_RESET);

[...]

Quoted 1 line

+ phy_power_on(mipi_dsi->phy);

Please propagate the error code here.
Also shouldn't this go to a new dw_mipi_dsi_phy_power_on() as the PHY driver uses the updated settings from phy_configure only in it's .power_on callback?

[...]

Quoted 1 line

+ phy_configure(mipi_dsi->phy, &mipi_dsi->phy_opts);

please propagate the error code here as the PHY driver has some explicit code to return an error in it's .phy_configure callback

[...]

Quoted 1 line

+ phy_init(mipi_dsi->phy);

please propagate the error code here

[...]

Quoted 1 line

+ phy_exit(mipi_dsi->phy);

please propagate the error code here

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 285

Quoted 2 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +2 -0
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       mipi_dsi->base = devm_ioremap_resource(&pdev->dev, res);

other parts of the meson DRM driver have been converted to use devm_platform_ioremap_resource()
I suggest updating this as well to simplify the code here

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 293

Quoted 5 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +5 -0
+       mipi_dsi->phy = devm_phy_get(&pdev->dev, "dphy");
+       if (IS_ERR(mipi_dsi->phy)) {
+               ret = PTR_ERR(mipi_dsi->phy);
+               dev_err(&pdev->dev, "failed to get mipi dphy: %d\n", ret);
+               return ret;

you can simplify this with:
return dev_err_probe(&pdev->dev, PTR_ERR(mipi_dsi->phy, "failed to
get mipi dphy\n");

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 299

Quoted 4 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +4 -0
+       mipi_dsi->px_clk = devm_clk_get(&pdev->dev, "px_clk");
+       if (IS_ERR(mipi_dsi->px_clk)) {
+               dev_err(&pdev->dev, "Unable to get PLL clk\n");
+               return PTR_ERR(mipi_dsi->px_clk);

you can simplify this with:
return dev_err_probe(&pdev->dev, PTR_ERR(mipi_dsi->px_clk, "Unable
to get PLL clk\n");
Also should it say s/PLL clk/px clock/?

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 313

Quoted 8 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +8 -0
+       top_rst = devm_reset_control_get_exclusive(&pdev->dev, "top");
+       if (IS_ERR(top_rst)) {
+               ret = PTR_ERR(top_rst);
+
+               if (ret != -EPROBE_DEFER)
+                       dev_err(&pdev->dev, "Unable to get reset control: %d\n", ret);
+
+               return ret;

you can simplify this with:
return dev_err_probe(&pdev->dev, PTR_ERR(top_rst, "Unable to get
reset control\n");

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 340

Quoted 6 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +6 -0
+       mipi_dsi->dmd = dw_mipi_dsi_probe(pdev, &mipi_dsi->pdata);
+       if (IS_ERR(mipi_dsi->dmd)) {
+               ret = PTR_ERR(mipi_dsi->dmd);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(&pdev->dev,
+                               "Failed to probe dw_mipi_dsi: %d\n", ret);

you can simplify this with:
dev_err_probe(&pdev->dev, ret, "Failed to probe dw_mipi_dsi\n");

Best regards,
Martin

#16 lore raw

Re: [PATCH 6/6] drm/meson: add support for MIPI-DSI transceiver

Quoted 16 lines · Martin Blumenstingl

Hi Neil,

some high-level comments from me below.

On Fri, Jan 7, 2022 at 3:58 PM Neil Armstrong <[email protected]> wrote:
[...]

Quoted 10 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +10 -0
+/*  MIPI DSI Relative REGISTERs Definitions */
+/* For MIPI_DSI_TOP_CNTL */
+#define BIT_DPI_COLOR_MODE        20
+#define BIT_IN_COLOR_MODE         16
+#define BIT_CHROMA_SUBSAMPLE      14
+#define BIT_COMP2_SEL             12
+#define BIT_COMP1_SEL             10
+#define BIT_COMP0_SEL              8
+#define BIT_DE_POL                 6
+#define BIT_HSYNC_POL              5
Quoted 8 lines

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 71

Quoted 5 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +5 -0
+#define BIT_VSYNC_POL              4
+#define BIT_DPICOLORM              3
+#define BIT_DPISHUTDN              2
+#define BIT_EDPITE_INTR_PULSE      1
+#define BIT_ERR_INTR_PULSE         0

Why not use BIT() and GENMASK() for these and prefixing them with MIPI_DSI_TOP_CNTL_?
That would make them consistent with other parts of the meson sub-driver.

Yeah it was a lousy copy-paste from vendor driver, and I was lazy, but I'll fix this.

Quoted 11 lines

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 92

Quoted 4 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +4 -0
+static void meson_dw_mipi_dsi_hw_init(struct meson_dw_mipi_dsi *mipi_dsi)
+{
+       writel_relaxed((1 << 4) | (1 << 5) | (0 << 6),
+                      mipi_dsi->base + MIPI_DSI_TOP_CNTL);

please use the macros from above

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 95

Quoted 2 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +2 -0
+       writel_bits_relaxed(0xf, 0xf, mipi_dsi->base + MIPI_DSI_TOP_SW_RESET);
+       writel_bits_relaxed(0xf, 0, mipi_dsi->base + MIPI_DSI_TOP_SW_RESET);
Quoted 6 lines

[...]

Quoted 1 line

+ phy_power_on(mipi_dsi->phy);

Please propagate the error code here.
Also shouldn't this go to a new dw_mipi_dsi_phy_power_on() as the PHY driver uses the updated settings from phy_configure only in it's .power_on callback?

Good point, let me check that.

Quoted 6 lines

[...]

Quoted 1 line

+ phy_configure(mipi_dsi->phy, &mipi_dsi->phy_opts);

please propagate the error code here as the PHY driver has some explicit code to return an error in it's .phy_configure callback

Quoted 7 lines

[...]

Quoted 1 line

+ phy_init(mipi_dsi->phy);

please propagate the error code here

[...]

Quoted 1 line

+ phy_exit(mipi_dsi->phy);

please propagate the error code here

ok for the 3

Quoted 7 lines

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 285

Quoted 2 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +2 -0
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       mipi_dsi->base = devm_ioremap_resource(&pdev->dev, res);

other parts of the meson DRM driver have been converted to use devm_platform_ioremap_resource()
I suggest updating this as well to simplify the code here

Yep, again lazyness

Quoted 35 lines

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 293

Quoted 5 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +5 -0
+       mipi_dsi->phy = devm_phy_get(&pdev->dev, "dphy");
+       if (IS_ERR(mipi_dsi->phy)) {
+               ret = PTR_ERR(mipi_dsi->phy);
+               dev_err(&pdev->dev, "failed to get mipi dphy: %d\n", ret);
+               return ret;

you can simplify this with:
return dev_err_probe(&pdev->dev, PTR_ERR(mipi_dsi->phy, "failed to
get mipi dphy\n");

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 299

Quoted 4 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +4 -0
+       mipi_dsi->px_clk = devm_clk_get(&pdev->dev, "px_clk");
+       if (IS_ERR(mipi_dsi->px_clk)) {
+               dev_err(&pdev->dev, "Unable to get PLL clk\n");
+               return PTR_ERR(mipi_dsi->px_clk);

you can simplify this with:
return dev_err_probe(&pdev->dev, PTR_ERR(mipi_dsi->px_clk, "Unable
to get PLL clk\n");
Also should it say s/PLL clk/px clock/?

[...]

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 313

Quoted 8 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +8 -0
+       top_rst = devm_reset_control_get_exclusive(&pdev->dev, "top");
+       if (IS_ERR(top_rst)) {
+               ret = PTR_ERR(top_rst);
+
+               if (ret != -EPROBE_DEFER)
+                       dev_err(&pdev->dev, "Unable to get reset control: %d\n", ret);
+
+               return ret;

you can simplify this with:
return dev_err_probe(&pdev->dev, PTR_ERR(top_rst, "Unable to get
reset control\n");

[...]

Quoted 9 lines

drivers/gpu/drm/meson/meson_dw_mipi_dsi.c line 340

Quoted 6 lines
drivers/gpu/drm/meson/meson_dw_mipi_dsi.c new file +6 -0
+       mipi_dsi->dmd = dw_mipi_dsi_probe(pdev, &mipi_dsi->pdata);
+       if (IS_ERR(mipi_dsi->dmd)) {
+               ret = PTR_ERR(mipi_dsi->dmd);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(&pdev->dev,
+                               "Failed to probe dw_mipi_dsi: %d\n", ret);

you can simplify this with:
dev_err_probe(&pdev->dev, ret, "Failed to probe dw_mipi_dsi\n");

Again 4 lazyness effects, will fix !

Thanks,
Neil

Quoted 4 lines

Best regards,
Martin