Skip to contentSkip to conversation

drm/rockchip: Add driver for the new DSI2 controller

PATCH Superseded Heiko Stuebner 8 participants 22 messages Dec 3, 2024 – Dec 10, 2024

Subsystems (6)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

v3 cover drm/rockchip: Add driver for the new DSI2 controller

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

As the manual states:
The Display Serial Interface 2 (DSI-2) is part of a group of communication protocols defined by the MIPI Alliance. The MIPI DSI-2 Host Controller is a digital core that implements all protocol functions defined in the MIPI DSI-2 Specification.

While the driver structure is very similar to the previous DSI controller, the programming model of the core is quite different, with a completely new register set.

Another notable difference is that the phy interface is variable now too in its width and some other settings.

changes in v3:
- remove double-empty line in bridge part (Neil)
- add bitfield.h to both bridge and glue for FIELD_PROP (reported by kernel test robot)
- add Neil's Reviewed-by to bridge part
- add Rob's Reviewed-by to binding

changes in v2:
- clean up includes (Diederik)
- fix Kconfig description (Diederik)
- constant naming (Diederik)
- binding fixes (paths, sorting, labels) (Rob)
- move to use regmap
- drop custom UPDATE macro and use FIELD_PREP instead
- use dev_err instead of DRM_DEV_ERROR

Heiko Stuebner (3):
drm/bridge/synopsys: Add MIPI DSI2 host controller bridge
dt-bindings: display: rockchip: Add schema for RK3588 DW DSI2
controller
drm/rockchip: Add MIPI DSI2 glue driver for RK3588

 .../rockchip/rockchip,rk3588-mipi-dsi2.yaml   |  119 ++
 drivers/gpu/drm/bridge/synopsys/Kconfig       |    6 +
 drivers/gpu/drm/bridge/synopsys/Makefile      |    1 +
 .../gpu/drm/bridge/synopsys/dw-mipi-dsi2.c    | 1030 +++++++++++++++++
 drivers/gpu/drm/rockchip/Kconfig              |   10 +
 drivers/gpu/drm/rockchip/Makefile             |    1 +
 .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  |  524 +++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |    2 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |    1 +
 include/drm/bridge/dw_mipi_dsi2.h             |   95 ++
 10 files changed, 1789 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml
 create mode 100644 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
 create mode 100644 drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
 create mode 100644 include/drm/bridge/dw_mipi_dsi2.h
Signature · 1 line
2.45.2
author maintainer
#1 lore raw

PATCH v3 1/3 drm/bridge/synopsys: Add MIPI DSI2 host controller bridge

From: Heiko Stuebner <[email protected]>

Add a Synopsys Designware MIPI DSI host DRM bridge driver for their DSI2 host controller, based on the Rockchip version from the driver rockchip/dw-mipi-dsi2.c in their vendor-kernel with phy & bridge APIs.

While the driver is heavily modelled after the previous IP, the register set of this DSI2 controller is completely different and there are also additional properties like the variable-width phy interface.

---
 drivers/gpu/drm/bridge/synopsys/Kconfig       |    6 +
 drivers/gpu/drm/bridge/synopsys/Makefile      |    1 +
 .../gpu/drm/bridge/synopsys/dw-mipi-dsi2.c    | 1030 +++++++++++++++++
 include/drm/bridge/dw_mipi_dsi2.h             |   95 ++
 4 files changed, 1132 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c
 create mode 100644 include/drm/bridge/dw_mipi_dsi2.h
drivers/gpu/drm/bridge/synopsys/Kconfig +6 -0
index ca416dab156d..f3ab2f985f8c 100644
@@ -59,3 +59,9 @@ config DRM_DW_MIPI_DSI
 	select DRM_KMS_HELPER
 	select DRM_MIPI_DSI
 	select DRM_PANEL_BRIDGE
+
+config DRM_DW_MIPI_DSI2
+	tristate
+	select DRM_KMS_HELPER
+	select DRM_MIPI_DSI
+	select DRM_PANEL_BRIDGE
drivers/gpu/drm/bridge/synopsys/Makefile +1 -0
index 9869d9651ed1..9dc376d220ad 100644
@@ -8,3 +8,4 @@ obj-$(CONFIG_DRM_DW_HDMI_CEC) += dw-hdmi-cec.o
 obj-$(CONFIG_DRM_DW_HDMI_QP) += dw-hdmi-qp.o
 
 obj-$(CONFIG_DRM_DW_MIPI_DSI) += dw-mipi-dsi.o
+obj-$(CONFIG_DRM_DW_MIPI_DSI2) += dw-mipi-dsi2.o
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c new file +1030 -0

1,030 lines not on this page · raw message

include/drm/bridge/dw_mipi_dsi2.h new file +95 -0

95 lines not on this page · raw message

Signature · 1 line
2.45.2
author maintainer
#2 lore raw

PATCH v3 2/3 dt-bindings: display: rockchip: Add schema for RK3588 DW DSI2 controller

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

The Display Serial Interface 2 (DSI-2) is part of a group of communication protocols defined by the MIPI Alliance. The RK3588 implements this specification in its two MIPI DSI-2 Host Controllers that are based on a new Synopsis IP.

---
 .../rockchip/rockchip,rk3588-mipi-dsi2.yaml   | 119 ++++++++++++++++++
 1 file changed, 119 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml new file +119 -0
new file mode 100644
index 000000000000..7c017e927223
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip specific extensions to the Synopsys Designware MIPI DSI2
+
+maintainers:
+  - Heiko Stuebner <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - rockchip,rk3588-mipi-dsi2
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: sys
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      This SoC uses GRF regs to switch between vopl/vopb.
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    const: dcphy
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    const: apb
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Input node to receive pixel data.
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: DSI output node to panel.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+  - rockchip,grf
+  - phys
+  - phy-names
+  - ports
+  - reg
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rockchip,rk3588-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/rk3588-power.h>
+    #include <dt-bindings/reset/rockchip,rk3588-cru.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      dsi@fde20000 {
+        compatible = "rockchip,rk3588-mipi-dsi2";
+        reg = <0x0 0xfde20000 0x0 0x10000>;
+        interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH 0>;
+        clocks = <&cru PCLK_DSIHOST0>, <&cru CLK_DSIHOST0>;
+        clock-names = "pclk", "sys";
+        resets = <&cru SRST_P_DSIHOST0>;
+        reset-names = "apb";
+        power-domains = <&power RK3588_PD_VOP>;
+        phys = <&mipidcphy0>;
+        phy-names = "dcphy";
+        rockchip,grf = <&vop_grf>;
+
+        ports {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          dsi0_in: port@0 {
+            reg = <0>;
+          };
+
+          dsi0_out: port@1 {
+            reg = <1>;
+          };
+        };
+      };
+    };
Signature · 1 line
2.45.2
#3 lore raw

Re: [PATCH v3 2/3] dt-bindings: display: rockchip: Add schema for RK3588 DW DSI2 controller

Hi Heiko,

Quoted 6 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

The Display Serial Interface 2 (DSI-2) is part of a group of communication protocols defined by the MIPI Alliance. The RK3588 implements this specification in its two MIPI DSI-2 Host Controllers that are based on a new Synopsis IP.

Synopsys ?

Quoted 123 lines
---
  .../rockchip/rockchip,rk3588-mipi-dsi2.yaml   | 119 ++++++++++++++++++
  1 file changed, 119 insertions(+)

create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml

Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml new file +109 -0
new file mode 100644
index 000000000000..7c017e927223
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip specific extensions to the Synopsys Designware MIPI DSI2
+
+maintainers:
+  - Heiko Stuebner <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - rockchip,rk3588-mipi-dsi2
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: sys
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      This SoC uses GRF regs to switch between vopl/vopb.
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    const: dcphy
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    const: apb
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Input node to receive pixel data.
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: DSI output node to panel.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+  - rockchip,grf
+  - phys
+  - phy-names
+  - ports
+  - reg
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rockchip,rk3588-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/rk3588-power.h>
+    #include <dt-bindings/reset/rockchip,rk3588-cru.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      dsi@fde20000 {
+        compatible = "rockchip,rk3588-mipi-dsi2";
+        reg = <0x0 0xfde20000 0x0 0x10000>;
+        interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH 0>;
+        clocks = <&cru PCLK_DSIHOST0>, <&cru CLK_DSIHOST0>;
+        clock-names = "pclk", "sys";
+        resets = <&cru SRST_P_DSIHOST0>;
+        reset-names = "apb";
+        power-domains = <&power RK3588_PD_VOP>;
+        phys = <&mipidcphy0>;
+        phy-names = "dcphy";
+        rockchip,grf = <&vop_grf>;
+
+        ports {
+          #address-cells = <1>;
+          #size-cells = <0>;

Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml line 119

Quoted 10 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml new file +10 -0
+          dsi0_in: port@0 {
+            reg = <0>;
+          };
+
+          dsi0_out: port@1 {
+            reg = <1>;
+          };
+        };
+      };
+    };

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#4 lore raw

Re: [PATCH v3 2/3] dt-bindings: display: rockchip: Add schema for RK3588 DW DSI2 controller

In reply to Heiko Stuebner

Hi Heiko,

Quoted 113 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

The Display Serial Interface 2 (DSI-2) is part of a group of communication protocols defined by the MIPI Alliance. The RK3588 implements this specification in its two MIPI DSI-2 Host Controllers that are based on a new Synopsis IP.

---
  .../rockchip/rockchip,rk3588-mipi-dsi2.yaml   | 119 ++++++++++++++++++
  1 file changed, 119 insertions(+)

create mode 100644 Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml

Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml new file +93 -0
new file mode 100644
index 000000000000..7c017e927223
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip specific extensions to the Synopsys Designware MIPI DSI2
+
+maintainers:
+  - Heiko Stuebner <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - rockchip,rk3588-mipi-dsi2
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: sys
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      This SoC uses GRF regs to switch between vopl/vopb.
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    const: dcphy
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    const: apb
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Input node to receive pixel data.
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: DSI output node to panel.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+  - rockchip,grf
+  - phys
+  - phy-names
+  - ports
+  - reg
+
+allOf:
+  - $ref: /schemas/display/dsi-controller.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rockchip,rk3588-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/rk3588-power.h>
+    #include <dt-bindings/reset/rockchip,rk3588-cru.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+

Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml line 103

Quoted 10 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml new file +10 -0
+      dsi@fde20000 {
+        compatible = "rockchip,rk3588-mipi-dsi2";
+        reg = <0x0 0xfde20000 0x0 0x10000>;
+        interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH 0>;
+        clocks = <&cru PCLK_DSIHOST0>, <&cru CLK_DSIHOST0>;
+        clock-names = "pclk", "sys";
+        resets = <&cru SRST_P_DSIHOST0>;
+        reset-names = "apb";
+        power-domains = <&power RK3588_PD_VOP>;
+        phys = <&mipidcphy0>;

Should it be phys = <&mipidcphy0 PHY_TYPE_DPHY>, as the #phy-cells = 1 on phy side ?

Quoted 16 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-mipi-dsi2.yaml new file +16 -0
+        phy-names = "dcphy";
+        rockchip,grf = <&vop_grf>;
+
+        ports {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          dsi0_in: port@0 {
+            reg = <0>;
+          };
+
+          dsi0_out: port@1 {
+            reg = <1>;
+          };
+        };
+      };
+    };
author maintainer
#5 lore raw

PATCH v3 3/3 drm/rockchip: Add MIPI DSI2 glue driver for RK3588

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This adds the glue code for the MIPI DSI2 bridge on Rockchip SoCs and enables its use on the RK3588.

Right now the DSI2 controller is always paired with a DC-phy based on a Samsung IP, so the interface values are set statically for now. This stays true for the upcoming RK3576 as well.

---
 drivers/gpu/drm/rockchip/Kconfig              |  10 +
 drivers/gpu/drm/rockchip/Makefile             |   1 +
 .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  | 524 ++++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |   2 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   1 +
 5 files changed, 538 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c
drivers/gpu/drm/rockchip/Kconfig +10 -0
index 448fadd4ba15..84af423b7f90 100644
@@ -10,6 +10,7 @@ config DRM_ROCKCHIP
 	select DRM_DW_HDMI if ROCKCHIP_DW_HDMI
 	select DRM_DW_HDMI_QP if ROCKCHIP_DW_HDMI_QP
 	select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI
+	select DRM_DW_MIPI_DSI2 if ROCKCHIP_DW_MIPI_DSI2
 	select GENERIC_PHY if ROCKCHIP_DW_MIPI_DSI
 	select GENERIC_PHY_MIPI_DPHY if ROCKCHIP_DW_MIPI_DSI
 	select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC
@@ -81,6 +82,15 @@ config ROCKCHIP_DW_MIPI_DSI
 	  enable MIPI DSI on RK3288 or RK3399 based SoC, you should
 	  select this option.
 
+config ROCKCHIP_DW_MIPI_DSI2
+	bool "Rockchip specific extensions for Synopsys DW MIPI DSI2"
+	select GENERIC_PHY_MIPI_DPHY
+	help
+	  This selects support for Rockchip SoC specific extensions
+	  for the Synopsys DesignWare dsi driver. If you want to
+	  enable MIPI DSI on RK3576 or RK3588 based SoC, you should
+	  select this option.
+
 config ROCKCHIP_INNO_HDMI
 	bool "Rockchip specific extensions for Innosilicon HDMI"
 	select DRM_DISPLAY_HDMI_HELPER
drivers/gpu/drm/rockchip/Makefile +1 -0
index 3eab662a5a1d..2b867cebbc12 100644
@@ -13,6 +13,7 @@ rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
 rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI_QP) += dw_hdmi_qp-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI2) += dw-mipi-dsi2-rockchip.o
 rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
 rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o
 rockchipdrm-$(CONFIG_ROCKCHIP_RGB) += rockchip_rgb.o
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +524 -0

524 lines not on this page · raw message

drivers/gpu/drm/rockchip/rockchip_drm_drv.c +2 -0
index ddf0be331c0a..5327ce035003 100644
@@ -511,6 +511,8 @@ static int __init rockchip_drm_init(void)
 				CONFIG_ROCKCHIP_DW_HDMI_QP);
 	ADD_ROCKCHIP_SUB_DRIVER(dw_mipi_dsi_rockchip_driver,
 				CONFIG_ROCKCHIP_DW_MIPI_DSI);
+	ADD_ROCKCHIP_SUB_DRIVER(dw_mipi_dsi2_rockchip_driver,
+				CONFIG_ROCKCHIP_DW_MIPI_DSI2);
 	ADD_ROCKCHIP_SUB_DRIVER(inno_hdmi_driver, CONFIG_ROCKCHIP_INNO_HDMI);
 	ADD_ROCKCHIP_SUB_DRIVER(rk3066_hdmi_driver,
 				CONFIG_ROCKCHIP_RK3066_HDMI);
drivers/gpu/drm/rockchip/rockchip_drm_drv.h +1 -0
index 24b4ce5ceaf1..9c9d38a06cdf 100644
@@ -90,6 +90,7 @@ extern struct platform_driver cdn_dp_driver;
 extern struct platform_driver dw_hdmi_rockchip_pltfm_driver;
 extern struct platform_driver dw_hdmi_qp_rockchip_pltfm_driver;
 extern struct platform_driver dw_mipi_dsi_rockchip_driver;
+extern struct platform_driver dw_mipi_dsi2_rockchip_driver;
 extern struct platform_driver inno_hdmi_driver;
 extern struct platform_driver rockchip_dp_driver;
 extern struct platform_driver rockchip_lvds_driver;
Signature · 1 line
2.45.2
#6 lore raw

Re: [PATCH v3 3/3] drm/rockchip: Add MIPI DSI2 glue driver for RK3588

Hi Heiko,

Quoted 66 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This adds the glue code for the MIPI DSI2 bridge on Rockchip SoCs and enables its use on the RK3588.

Right now the DSI2 controller is always paired with a DC-phy based on a Samsung IP, so the interface values are set statically for now. This stays true for the upcoming RK3576 as well.

---
  drivers/gpu/drm/rockchip/Kconfig              |  10 +
  drivers/gpu/drm/rockchip/Makefile             |   1 +
  .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  | 524 ++++++++++++++++++
  drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |   2 +
  drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   1 +
  5 files changed, 538 insertions(+)

create mode 100644 drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c

drivers/gpu/drm/rockchip/Kconfig +10 -0
index 448fadd4ba15..84af423b7f90 100644
@@ -10,6 +10,7 @@ config DRM_ROCKCHIP
  	select DRM_DW_HDMI if ROCKCHIP_DW_HDMI
  	select DRM_DW_HDMI_QP if ROCKCHIP_DW_HDMI_QP
  	select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI
+	select DRM_DW_MIPI_DSI2 if ROCKCHIP_DW_MIPI_DSI2
  	select GENERIC_PHY if ROCKCHIP_DW_MIPI_DSI
  	select GENERIC_PHY_MIPI_DPHY if ROCKCHIP_DW_MIPI_DSI
  	select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC
@@ -81,6 +82,15 @@ config ROCKCHIP_DW_MIPI_DSI
  	  enable MIPI DSI on RK3288 or RK3399 based SoC, you should
  	  select this option.
 
+config ROCKCHIP_DW_MIPI_DSI2
+	bool "Rockchip specific extensions for Synopsys DW MIPI DSI2"
+	select GENERIC_PHY_MIPI_DPHY
+	help
+	  This selects support for Rockchip SoC specific extensions
+	  for the Synopsys DesignWare dsi driver. If you want to
+	  enable MIPI DSI on RK3576 or RK3588 based SoC, you should
+	  select this option.
+
  config ROCKCHIP_INNO_HDMI
  	bool "Rockchip specific extensions for Innosilicon HDMI"
  	select DRM_DISPLAY_HDMI_HELPER
drivers/gpu/drm/rockchip/Makefile +1 -0
index 3eab662a5a1d..2b867cebbc12 100644
@@ -13,6 +13,7 @@ rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI_QP) += dw_hdmi_qp-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI2) += dw-mipi-dsi2-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
  rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o
  rockchipdrm-$(CONFIG_ROCKCHIP_RGB) += rockchip_rgb.o
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +0 -0
new file mode 100644
index 000000000000..55eed4001634

drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c line 3

Quoted 3 lines
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +3 -0
@@ -0,0 +1,524 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2024 Rockchip Electronics Co.Ltd

This should be:

Rockchip Electronics Co., Ltd.

This typo is from vendor kernel, we will correct all this kind of issue locally, and Andy is going to correct other files in drm for mainline kernel.

Thanks,
- Kever

#7 lore raw

Re: [PATCH v3 3/3] drm/rockchip: Add MIPI DSI2 glue driver for RK3588

If there's going to be another version (to fix this) ...

Quoted 37 lines · Kever Yang
Quoted 36 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This adds the glue code for the MIPI DSI2 bridge on Rockchip SoCs and enables its use on the RK3588.

Right now the DSI2 controller is always paired with a DC-phy based on a Samsung IP, so the interface values are set statically for now. This stays true for the upcoming RK3576 as well.

---
  drivers/gpu/drm/rockchip/Kconfig              |  10 +
  drivers/gpu/drm/rockchip/Makefile             |   1 +
  .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  | 524 ++++++++++++++++++
  drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |   2 +
  drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   1 +
  5 files changed, 538 insertions(+)

create mode 100644 drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c

drivers/gpu/drm/rockchip/Kconfig +1 -0
index 448fadd4ba15..84af423b7f90 100644
@@ -10,6 +10,7 @@ config DRM_ROCKCHIP
  	select DRM_DW_HDMI if ROCKCHIP_DW_HDMI
  	select DRM_DW_HDMI_QP if ROCKCHIP_DW_HDMI_QP
  	select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI
+	select DRM_DW_MIPI_DSI2 if ROCKCHIP_DW_MIPI_DSI2
  	select GENERIC_PHY if ROCKCHIP_DW_MIPI_DSI
  	select GENERIC_PHY_MIPI_DPHY if ROCKCHIP_DW_MIPI_DSI
  	select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC
@@ -81,6 +82,15 @@ config ROCKCHIP_DW_MIPI_DSI
  	  enable MIPI DSI on RK3288 or RK3399 based SoC, you should
  	  select this option.
 
Quoted 6 lines

drivers/gpu/drm/rockchip/Kconfig config ROCKCHIP_DW_MIPI_DSI · line 90

Quoted 6 lines
drivers/gpu/drm/rockchip/Kconfig +6 -0
+config ROCKCHIP_DW_MIPI_DSI2
+	bool "Rockchip specific extensions for Synopsys DW MIPI DSI2"
+	select GENERIC_PHY_MIPI_DPHY
+	help
+	  This selects support for Rockchip SoC specific extensions
+	  for the Synopsys DesignWare dsi driver. If you want to

... could you then also s/dsi/DSI/ ?

Cheers,
Diederik

Quoted 36 lines
Quoted 24 lines
drivers/gpu/drm/rockchip/Kconfig +3 -0
+	  enable MIPI DSI on RK3576 or RK3588 based SoC, you should
+	  select this option.
+
  config ROCKCHIP_INNO_HDMI
  	bool "Rockchip specific extensions for Innosilicon HDMI"
  	select DRM_DISPLAY_HDMI_HELPER
drivers/gpu/drm/rockchip/Makefile +1 -0
index 3eab662a5a1d..2b867cebbc12 100644
@@ -13,6 +13,7 @@ rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI_QP) += dw_hdmi_qp-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI2) += dw-mipi-dsi2-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
  rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o
  rockchipdrm-$(CONFIG_ROCKCHIP_RGB) += rockchip_rgb.o
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +0 -0
new file mode 100644
index 000000000000..55eed4001634

drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c line 3

Quoted 3 lines
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +3 -0
@@ -0,0 +1,524 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2024 Rockchip Electronics Co.Ltd

This should be:

Rockchip Electronics Co., Ltd.

This typo is from vendor kernel, we will correct all this kind of issue locally, and Andy is going to correct other files in drm for mainline kernel.

Thanks,
- Kever

#8 lore raw

Re: [PATCH v3 3/3] drm/rockchip: Add MIPI DSI2 glue driver for RK3588

In reply to Heiko Stuebner

Hi Heiko,

Quoted 33 lines · Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This adds the glue code for the MIPI DSI2 bridge on Rockchip SoCs and enables its use on the RK3588.

Right now the DSI2 controller is always paired with a DC-phy based on a Samsung IP, so the interface values are set statically for now. This stays true for the upcoming RK3576 as well.

---
  drivers/gpu/drm/rockchip/Kconfig              |  10 +
  drivers/gpu/drm/rockchip/Makefile             |   1 +
  .../gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c  | 524 ++++++++++++++++++
  drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |   2 +
  drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   1 +
  5 files changed, 538 insertions(+)

create mode 100644 drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c

drivers/gpu/drm/rockchip/Kconfig +1 -0
index 448fadd4ba15..84af423b7f90 100644
@@ -10,6 +10,7 @@ config DRM_ROCKCHIP
  	select DRM_DW_HDMI if ROCKCHIP_DW_HDMI
  	select DRM_DW_HDMI_QP if ROCKCHIP_DW_HDMI_QP
  	select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI
+	select DRM_DW_MIPI_DSI2 if ROCKCHIP_DW_MIPI_DSI2
  	select GENERIC_PHY if ROCKCHIP_DW_MIPI_DSI
  	select GENERIC_PHY_MIPI_DPHY if ROCKCHIP_DW_MIPI_DSI
  	select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC

drivers/gpu/drm/rockchip/Kconfig config ROCKCHIP_DW_MIPI_DSI · line 90

Quoted 9 lines
drivers/gpu/drm/rockchip/Kconfig +6 -0
@@ -81,6 +82,15 @@ config ROCKCHIP_DW_MIPI_DSI
  	  enable MIPI DSI on RK3288 or RK3399 based SoC, you should
  	  select this option.
 
+config ROCKCHIP_DW_MIPI_DSI2
+	bool "Rockchip specific extensions for Synopsys DW MIPI DSI2"
+	select GENERIC_PHY_MIPI_DPHY
+	help
+	  This selects support for Rockchip SoC specific extensions
+	  for the Synopsys DesignWare dsi driver. If you want to

Maybe we should emphasize dsi2 driver here ?

Quoted 45 lines
drivers/gpu/drm/rockchip/Kconfig +3 -0
+	  enable MIPI DSI on RK3576 or RK3588 based SoC, you should
+	  select this option.
+
  config ROCKCHIP_INNO_HDMI
  	bool "Rockchip specific extensions for Innosilicon HDMI"
  	select DRM_DISPLAY_HDMI_HELPER
drivers/gpu/drm/rockchip/Makefile +1 -0
index 3eab662a5a1d..2b867cebbc12 100644
@@ -13,6 +13,7 @@ rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI_QP) += dw_hdmi_qp-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi-rockchip.o
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI2) += dw-mipi-dsi2-rockchip.o
  rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o
  rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o
  rockchipdrm-$(CONFIG_ROCKCHIP_RGB) += rockchip_rgb.o
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +21 -0
new file mode 100644
index 000000000000..55eed4001634
@@ -0,0 +1,524 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2024 Rockchip Electronics Co.Ltd
+ * Author:
+ *      Guochun Huang <[email protected]>
+ *      Heiko Stuebner <[email protected]>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/clk.h>
+#include <linux/component.h>
+#include <linux/media-bus-format.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/pm_runtime.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include <linux/mfd/syscon.h>
+#include <linux/phy/phy.h>

drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c line 31

Quoted 10 lines
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +10 -0
+
+#include <drm/bridge/dw_mipi_dsi2.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_of.h>
+#include <drm/drm_simple_kms_helper.h>
+
+#include <uapi/linux/videodev2.h>
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"

It seems that we don't use anything from rockchip_drm_vop.h ?

Quoted 403 lines
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +403 -0
+
+#define PSEC_PER_SEC			1000000000000LL
+
+struct dsigrf_reg {
+	u16 offset;
+	u16 lsb;
+	u16 msb;
+};
+
+enum grf_reg_fields {
+	TXREQCLKHS_EN,
+	GATING_EN,
+	IPI_SHUTDN,
+	IPI_COLORM,
+	IPI_COLOR_DEPTH,
+	IPI_FORMAT,
+	MAX_FIELDS,
+};
+
+#define IPI_DEPTH_5_6_5_BITS		0x02
+#define IPI_DEPTH_6_BITS		0x03
+#define IPI_DEPTH_8_BITS		0x05
+#define IPI_DEPTH_10_BITS		0x06
+
+struct rockchip_dw_dsi2_chip_data {
+	u32 reg;
+	const struct dsigrf_reg *grf_regs;
+	unsigned long long max_bit_rate_per_lane;
+};
+
+struct dw_mipi_dsi2_rockchip {
+	struct device *dev;
+	struct rockchip_encoder encoder;
+	struct regmap *regmap;
+	struct clk *pclk;
+	struct clk *sys_clk;
+
+	unsigned int lane_mbps; /* per lane */
+	u32 format;
+
+	struct regmap *grf_regmap;
+	struct phy *phy;
+	union phy_configure_opts phy_opts;
+
+	struct dw_mipi_dsi2 *dmd;
+	struct dw_mipi_dsi2_plat_data pdata;
+	const struct rockchip_dw_dsi2_chip_data *cdata;
+};
+
+static inline struct dw_mipi_dsi2_rockchip *to_dsi2(struct drm_encoder *encoder)
+{
+	struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
+
+	return container_of(rkencoder, struct dw_mipi_dsi2_rockchip, encoder);
+}
+
+static void grf_field_write(struct dw_mipi_dsi2_rockchip *dsi2, enum grf_reg_fields index,
+			    unsigned int val)
+{
+	const struct dsigrf_reg *field = &dsi2->cdata->grf_regs[index];
+
+	if (!field)
+		return;
+
+	regmap_write(dsi2->grf_regmap, field->offset,
+		     (val << field->lsb) | (GENMASK(field->msb, field->lsb) << 16));
+}
+
+static int dw_mipi_dsi2_phy_init(void *priv_data)
+{
+	return 0;
+}
+
+static void dw_mipi_dsi2_phy_power_on(void *priv_data)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
+	int ret;
+
+	ret = phy_set_mode(dsi2->phy, PHY_MODE_MIPI_DPHY);
+	if (ret) {
+		dev_err(dsi2->dev, "Failed to set phy mode: %d\n", ret);
+		return;
+	}
+
+	phy_configure(dsi2->phy, &dsi2->phy_opts);
+	phy_power_on(dsi2->phy);
+}
+
+static void dw_mipi_dsi2_phy_power_off(void *priv_data)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
+
+	phy_power_off(dsi2->phy);
+}
+
+static int
+dw_mipi_dsi2_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
+			   unsigned long mode_flags, u32 lanes, u32 format,
+			   unsigned int *lane_mbps)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
+	u64 max_lane_rate, target_phyclk;
+	unsigned int lane_rate_kbps;
+	int bpp;
+
+	max_lane_rate = dsi2->cdata->max_bit_rate_per_lane;
+
+	dsi2->format = format;
+	bpp = mipi_dsi_pixel_format_to_bpp(format);
+	if (bpp < 0) {
+		dev_err(dsi2->dev, "failed to get bpp for pixel format %d\n", format);
+		return bpp;
+	}
+
+	lane_rate_kbps = mode->clock * bpp / lanes;
+
+	/*
+	 * Set BW a little larger only in video burst mode in
+	 * consideration of the protocol overhead and HS mode
+	 * switching to BLLP mode, take 1 / 0.9, since Mbps must
+	 * big than bandwidth of RGB
+	 */
+	if (mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
+		lane_rate_kbps = (lane_rate_kbps * 10) / 9;
+
+	if (lane_rate_kbps > max_lane_rate) {
+		dev_err(dsi2->dev, "DPHY clock frequency is out of range\n");
+		return -ERANGE;
+	}
+
+	dsi2->lane_mbps = lane_rate_kbps / 1000;
+	*lane_mbps = dsi2->lane_mbps;
+
+	if (dsi2->phy) {
+		target_phyclk = DIV_ROUND_CLOSEST_ULL(lane_rate_kbps * lanes * 1000, bpp);
+		phy_mipi_dphy_get_default_config(target_phyclk, bpp, lanes,
+						 &dsi2->phy_opts.mipi_dphy);
+	}
+
+	return 0;
+}
+
+static void dw_mipi_dsi2_phy_get_iface(void *priv_data, struct dw_mipi_dsi2_phy_iface *iface)
+{
+	/* PPI width is fixed to 16 bits in DCPHY */
+	iface->ppi_width = 16;
+	iface->phy_type = DW_MIPI_DSI2_DPHY;
+}
+
+static int
+dw_mipi_dsi2_phy_get_timing(void *priv_data, unsigned int lane_mbps,
+			    struct dw_mipi_dsi2_phy_timing *timing)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
+	struct phy_configure_opts_mipi_dphy *cfg = &dsi2->phy_opts.mipi_dphy;
+	unsigned long long tmp, ui;
+	unsigned long long hstx_clk;
+
+	hstx_clk = DIV_ROUND_CLOSEST_ULL(dsi2->lane_mbps * USEC_PER_SEC, 16);
+
+	ui = ALIGN(PSEC_PER_SEC, hstx_clk);
+	do_div(ui, hstx_clk);
+
+	/* PHY_LP2HS_TIME = (TLPX + THS-PREPARE + THS-ZERO) / Tphy_hstx_clk */
+	tmp = cfg->lpx + cfg->hs_prepare + cfg->hs_zero;
+	tmp = DIV_ROUND_CLOSEST_ULL(tmp << 16, ui);
+	timing->data_lp2hs = tmp;
+
+	/* PHY_HS2LP_TIME = (THS-TRAIL + THS-EXIT) / Tphy_hstx_clk */
+	tmp = cfg->hs_trail + cfg->hs_exit;
+	tmp = DIV_ROUND_CLOSEST_ULL(tmp << 16, ui);
+	timing->data_hs2lp = tmp;
+
+	return 0;
+}
+
+static const struct dw_mipi_dsi2_phy_ops dw_mipi_dsi2_rockchip_phy_ops = {
+	.init = dw_mipi_dsi2_phy_init,
+	.power_on = dw_mipi_dsi2_phy_power_on,
+	.power_off = dw_mipi_dsi2_phy_power_off,
+	.get_interface = dw_mipi_dsi2_phy_get_iface,
+	.get_lane_mbps = dw_mipi_dsi2_get_lane_mbps,
+	.get_timing = dw_mipi_dsi2_phy_get_timing,
+};
+
+static void dw_mipi_dsi2_encoder_atomic_enable(struct drm_encoder *encoder,
+					       struct drm_atomic_state *state)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = to_dsi2(encoder);
+	u32 color_depth;
+
+	switch (dsi2->format) {
+	case MIPI_DSI_FMT_RGB666:
+	case MIPI_DSI_FMT_RGB666_PACKED:
+		color_depth = IPI_DEPTH_6_BITS;
+		break;
+	case MIPI_DSI_FMT_RGB565:
+		color_depth = IPI_DEPTH_5_6_5_BITS;
+		break;
+	case MIPI_DSI_FMT_RGB888:
+		color_depth = IPI_DEPTH_8_BITS;
+		break;
+	default:
+		/* Should've been caught by atomic_check */
+		WARN_ON(1);
+		return;
+	}
+
+	grf_field_write(dsi2, IPI_COLOR_DEPTH, color_depth);
+}
+
+static int
+dw_mipi_dsi2_encoder_atomic_check(struct drm_encoder *encoder,
+				  struct drm_crtc_state *crtc_state,
+				  struct drm_connector_state *conn_state)
+{
+	struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
+	struct dw_mipi_dsi2_rockchip *dsi2 = to_dsi2(encoder);
+	struct drm_connector *connector = conn_state->connector;
+	struct drm_display_info *info = &connector->display_info;
+
+	switch (dsi2->format) {
+	case MIPI_DSI_FMT_RGB666:
+	case MIPI_DSI_FMT_RGB666_PACKED:
+		s->output_mode = ROCKCHIP_OUT_MODE_P666;
+		break;
+	case MIPI_DSI_FMT_RGB565:
+		s->output_mode = ROCKCHIP_OUT_MODE_P565;
+		break;
+	case MIPI_DSI_FMT_RGB888:
+		s->output_mode = ROCKCHIP_OUT_MODE_P888;
+		break;
+	default:
+		WARN_ON(1);
+		return -EINVAL;
+	}
+
+	if (info->num_bus_formats)
+		s->bus_format = info->bus_formats[0];
+	else
+		s->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
+
+	s->output_type = DRM_MODE_CONNECTOR_DSI;
+	s->bus_flags = info->bus_flags;
+	s->color_space = V4L2_COLORSPACE_DEFAULT;
+
+	return 0;
+}
+
+static const struct drm_encoder_helper_funcs
+dw_mipi_dsi2_encoder_helper_funcs = {
+	.atomic_enable = dw_mipi_dsi2_encoder_atomic_enable,
+	.atomic_check = dw_mipi_dsi2_encoder_atomic_check,
+};
+
+static int rockchip_dsi2_drm_create_encoder(struct dw_mipi_dsi2_rockchip *dsi2,
+					    struct drm_device *drm_dev)
+{
+	struct drm_encoder *encoder = &dsi2->encoder.encoder;
+	int ret;
+
+	encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
+							     dsi2->dev->of_node);
+
+	ret = drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_DSI);
+	if (ret) {
+		dev_err(dsi2->dev, "Failed to initialize encoder with drm\n");
+		return ret;
+	}
+
+	drm_encoder_helper_add(encoder, &dw_mipi_dsi2_encoder_helper_funcs);
+
+	return 0;
+}
+
+static int dw_mipi_dsi2_rockchip_bind(struct device *dev, struct device *master,
+				      void *data)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = dev_get_drvdata(dev);
+	struct drm_device *drm_dev = data;
+	int ret;
+
+	ret = rockchip_dsi2_drm_create_encoder(dsi2, drm_dev);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to create drm encoder\n");
+
+	rockchip_drm_encoder_set_crtc_endpoint_id(&dsi2->encoder,
+						  dev->of_node, 0, 0);
+
+	ret = dw_mipi_dsi2_bind(dsi2->dmd, &dsi2->encoder.encoder);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to bind\n");
+
+	return 0;
+}
+
+static void dw_mipi_dsi2_rockchip_unbind(struct device *dev, struct device *master,
+					 void *data)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = dev_get_drvdata(dev);
+
+	dw_mipi_dsi2_unbind(dsi2->dmd);
+}
+
+static const struct component_ops dw_mipi_dsi2_rockchip_ops = {
+	.bind	= dw_mipi_dsi2_rockchip_bind,
+	.unbind	= dw_mipi_dsi2_rockchip_unbind,
+};
+
+static int dw_mipi_dsi2_rockchip_host_attach(void *priv_data,
+					     struct mipi_dsi_device *device)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
+	int ret;
+
+	ret = component_add(dsi2->dev, &dw_mipi_dsi2_rockchip_ops);
+	if (ret)
+		return dev_err_probe(dsi2->dev, ret, "Failed to register component\n");
+
+	return 0;
+}
+
+static int dw_mipi_dsi2_rockchip_host_detach(void *priv_data,
+					     struct mipi_dsi_device *device)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = priv_data;
+
+	component_del(dsi2->dev, &dw_mipi_dsi2_rockchip_ops);
+
+	return 0;
+}
+
+static const struct dw_mipi_dsi2_host_ops dw_mipi_dsi2_rockchip_host_ops = {
+	.attach = dw_mipi_dsi2_rockchip_host_attach,
+	.detach = dw_mipi_dsi2_rockchip_host_detach,
+};
+
+static __maybe_unused int dw_mipi_dsi2_runtime_suspend(struct device *dev)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = dev_get_drvdata(dev);
+
+	clk_disable_unprepare(dsi2->pclk);
+	clk_disable_unprepare(dsi2->sys_clk);
+
+	return 0;
+}
+
+static __maybe_unused int dw_mipi_dsi2_runtime_resume(struct device *dev)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = dev_get_drvdata(dev);
+
+	clk_prepare_enable(dsi2->pclk);
+	clk_prepare_enable(dsi2->sys_clk);
+
+	return 0;
+}
+
+static const struct dev_pm_ops dw_mipi_dsi2_rockchip_pm_ops = {
+	SET_RUNTIME_PM_OPS(dw_mipi_dsi2_runtime_suspend,
+			   dw_mipi_dsi2_runtime_resume, NULL)
+};
+
+static const struct regmap_config dw_mipi_dsi2_rockchip_regmap_config = {
+	.name = "dsi2-host",
+	.reg_bits = 32,
+	.val_bits = 32,
+	.reg_stride = 4,
+	.fast_io = true,
+};
+
+static int dw_mipi_dsi2_rockchip_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	const struct rockchip_dw_dsi2_chip_data *cdata =
+						of_device_get_match_data(dev);
+	struct dw_mipi_dsi2_rockchip *dsi2;
+	struct resource *res;
+	void __iomem *base;
+	int i;
+
+	dsi2 = devm_kzalloc(dev, sizeof(*dsi2), GFP_KERNEL);
+	if (!dsi2)
+		return -ENOMEM;
+
+	base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(base))
+		return dev_err_probe(dev, PTR_ERR(base), "Unable to get dsi registers\n");
+
+	dsi2->regmap = devm_regmap_init_mmio(dev, base, &dw_mipi_dsi2_rockchip_regmap_config);
+	if (IS_ERR(dsi2->regmap))
+		return dev_err_probe(dev, PTR_ERR(dsi2->regmap), "failed to init register map\n");
+
+	i = 0;
+	while (cdata[i].reg) {
+		if (cdata[i].reg == res->start) {
+			dsi2->cdata = &cdata[i];
+			break;
+		}
+
+		i++;
+	}
+

drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c line 444

Quoted 10 lines
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +10 -0
+	if (!dsi2->cdata)
+		return dev_err_probe(dev, -EINVAL, "No dsi-config for %s node\n", np->name);
+
+	dsi2->pclk = devm_clk_get(dev, "pclk");
+	if (IS_ERR(dsi2->pclk))
+		return dev_err_probe(dev, PTR_ERR(dsi2->pclk), "Unable to get pclk\n");
+
+	dsi2->sys_clk = devm_clk_get(dev, "sys");
+	if (IS_ERR(dsi2->sys_clk))
+		return dev_err_probe(dev, PTR_ERR(dsi2->sys_clk), "Unable to get sys_clk\n");

Do we really need to get pclk and sys clk here? __dw_mipi_dsi2_probe will also do this .

Quoted 98 lines
drivers/gpu/drm/rockchip/dw-mipi-dsi2-rockchip.c new file +80 -0
+
+	dsi2->grf_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
+	if (IS_ERR(dsi2->grf_regmap))
+		return dev_err_probe(dsi2->dev, PTR_ERR(dsi2->grf_regmap), "Unable to get grf\n");
+
+	dsi2->phy = devm_phy_optional_get(dev, "dcphy");
+	if (IS_ERR(dsi2->phy))
+		return dev_err_probe(dev, PTR_ERR(dsi2->phy), "failed to get mipi phy\n");
+
+	dsi2->dev = dev;
+	dsi2->pdata.regmap = dsi2->regmap;
+	dsi2->pdata.max_data_lanes = 4;
+	dsi2->pdata.phy_ops = &dw_mipi_dsi2_rockchip_phy_ops;
+	dsi2->pdata.host_ops = &dw_mipi_dsi2_rockchip_host_ops;
+	dsi2->pdata.priv_data = dsi2;
+	platform_set_drvdata(pdev, dsi2);
+
+	dsi2->dmd = dw_mipi_dsi2_probe(pdev, &dsi2->pdata);
+	if (IS_ERR(dsi2->dmd))
+		return dev_err_probe(dev, PTR_ERR(dsi2->dmd), "Failed to probe dw_mipi_dsi2\n");
+
+	return 0;
+}
+
+static void dw_mipi_dsi2_rockchip_remove(struct platform_device *pdev)
+{
+	struct dw_mipi_dsi2_rockchip *dsi2 = platform_get_drvdata(pdev);
+
+	dw_mipi_dsi2_remove(dsi2->dmd);
+}
+
+static const struct dsigrf_reg rk3588_dsi0_grf_reg_fields[MAX_FIELDS] = {
+	[TXREQCLKHS_EN]		= { 0x0000, 11, 11 },
+	[GATING_EN]		= { 0x0000, 10, 10 },
+	[IPI_SHUTDN]		= { 0x0000,  9,  9 },
+	[IPI_COLORM]		= { 0x0000,  8,  8 },
+	[IPI_COLOR_DEPTH]	= { 0x0000,  4,  7 },
+	[IPI_FORMAT]		= { 0x0000,  0,  3 },
+};
+
+static const struct dsigrf_reg rk3588_dsi1_grf_reg_fields[MAX_FIELDS] = {
+	[TXREQCLKHS_EN]		= { 0x0004, 11, 11 },
+	[GATING_EN]		= { 0x0004, 10, 10 },
+	[IPI_SHUTDN]		= { 0x0004,  9,  9 },
+	[IPI_COLORM]		= { 0x0004,  8,  8 },
+	[IPI_COLOR_DEPTH]	= { 0x0004,  4,  7 },
+	[IPI_FORMAT]		= { 0x0004,  0,  3 },
+};
+
+static const struct rockchip_dw_dsi2_chip_data rk3588_chip_data[] = {
+	{
+		.reg = 0xfde20000,
+		.grf_regs = rk3588_dsi0_grf_reg_fields,
+		.max_bit_rate_per_lane = 4500000ULL,
+	},
+	{
+		.reg = 0xfde30000,
+		.grf_regs = rk3588_dsi1_grf_reg_fields,
+		.max_bit_rate_per_lane = 4500000ULL,
+	}
+};
+
+static const struct of_device_id dw_mipi_dsi2_rockchip_dt_ids[] = {
+	{
+		.compatible = "rockchip,rk3588-mipi-dsi2",
+		.data = &rk3588_chip_data,
+	},
+	{}
+};
+MODULE_DEVICE_TABLE(of, dw_mipi_dsi2_rockchip_dt_ids);
+
+struct platform_driver dw_mipi_dsi2_rockchip_driver = {
+	.probe	= dw_mipi_dsi2_rockchip_probe,
+	.remove = dw_mipi_dsi2_rockchip_remove,
+	.driver = {
+		.of_match_table = dw_mipi_dsi2_rockchip_dt_ids,
+		.pm = &dw_mipi_dsi2_rockchip_pm_ops,
+		.name = "dw-mipi-dsi2",
+	},
+};
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +2 -0
index ddf0be331c0a..5327ce035003 100644
@@ -511,6 +511,8 @@ static int __init rockchip_drm_init(void)
  				CONFIG_ROCKCHIP_DW_HDMI_QP);
  	ADD_ROCKCHIP_SUB_DRIVER(dw_mipi_dsi_rockchip_driver,
  				CONFIG_ROCKCHIP_DW_MIPI_DSI);
+	ADD_ROCKCHIP_SUB_DRIVER(dw_mipi_dsi2_rockchip_driver,
+				CONFIG_ROCKCHIP_DW_MIPI_DSI2);
  	ADD_ROCKCHIP_SUB_DRIVER(inno_hdmi_driver, CONFIG_ROCKCHIP_INNO_HDMI);
  	ADD_ROCKCHIP_SUB_DRIVER(rk3066_hdmi_driver,
  				CONFIG_ROCKCHIP_RK3066_HDMI);
drivers/gpu/drm/rockchip/rockchip_drm_drv.h +0 -0
index 24b4ce5ceaf1..9c9d38a06cdf 100644

drivers/gpu/drm/rockchip/rockchip_drm_drv.h extern struct platform_driver cdn_dp_driver; · line 96

Quoted 7 lines
drivers/gpu/drm/rockchip/rockchip_drm_drv.h +1 -0
@@ -90,6 +90,7 @@ extern struct platform_driver cdn_dp_driver;
  extern struct platform_driver dw_hdmi_rockchip_pltfm_driver;
  extern struct platform_driver dw_hdmi_qp_rockchip_pltfm_driver;
  extern struct platform_driver dw_mipi_dsi_rockchip_driver;
+extern struct platform_driver dw_mipi_dsi2_rockchip_driver;
  extern struct platform_driver inno_hdmi_driver;
  extern struct platform_driver rockchip_dp_driver;
  extern struct platform_driver rockchip_lvds_driver;

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

Tested-by on the v3 series
#9 lore raw
In reply to Heiko Stuebner

Hello Heiko,

Quoted 10 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

As the manual states:
The Display Serial Interface 2 (DSI-2) is part of a group of communication protocols defined by the MIPI Alliance. The MIPI DSI-2 Host Controller is a digital core that implements all protocol functions defined in the MIPI DSI-2 Specification.

Quoted 6 lines

While the driver structure is very similar to the previous DSI controller, the programming model of the core is quite different, with a completely new register set.

Another notable difference is that the phy interface is variable now too in its width and some other settings.

Thanks for the series. I was able to get output on my Radxa's Rock 5B (dsi1) + Radxa's 10FHD Display setup. Works smoothly with multiple DE's, rotation and display on/off.

Signature · 2 lines
Thanks,
Dmitry
#10 lore raw
In reply to Heiko Stuebner

Hello Heiko,

Quoted 10 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

As the manual states:
The Display Serial Interface 2 (DSI-2) is part of a group of communication protocols defined by the MIPI Alliance. The MIPI DSI-2 Host Controller is a digital core that implements all protocol functions defined in the MIPI DSI-2 Specification.

Quoted 7 lines

While the driver structure is very similar to the previous DSI controller, the programming model of the core is quite different, with a completely new register set.

Another notable difference is that the phy interface is variable now too in its width and some other settings.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

I tried to track down the problem, and it seems to be a generic issue when horizontal line width is not divisible by 4.
Lowering line width to 1364px fixes the issue, but of course I have two vertical lines of black pixels on the right.
I also made some tests with 720x1280 DSI display. Lowering horizontal line to 718px shows the same problem. With 720px and 716px it works correctly.

Kind regards
Daniel

#11 lore raw

Hi,

Quoted 16 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

Quoted 5 lines

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

On my PineTab2 I got similar messages about 2 weeks ago:
rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp1

Preceding those, I got several panfrost related errors:

panfrost fde60000.gpu: get clock failed -517
panfrost fde60000.gpu: clk init failed -517
platform fde60000.gpu: deferred probe pending: (reason unknown) platform cpufreq-dt: deferred probe pending: (reason unknown)
vdd_gpu_npu: disabling

But can also be that the PineTab2 (likely) needs regulator-always-on and regulator-boot-on in its vdd_gpu_npu node.

Quoted 7 lines

I tried to track down the problem, and it seems to be a generic issue when horizontal line width is not divisible by 4.
Lowering line width to 1364px fixes the issue, but of course I have two vertical lines of black pixels on the right.
I also made some tests with 720x1280 DSI display. Lowering horizontal line to 718px shows the same problem. With 720px and 716px it works correctly.

I haven't look further into it, but the PT2 has a 1280x800 resolution.

HTH,
Diederik

author maintainer
#12 lore raw

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

Heiko

Quoted 28 lines

On my PineTab2 I got similar messages about 2 weeks ago:
rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp1

Preceding those, I got several panfrost related errors:

panfrost fde60000.gpu: get clock failed -517
panfrost fde60000.gpu: clk init failed -517
platform fde60000.gpu: deferred probe pending: (reason unknown) platform cpufreq-dt: deferred probe pending: (reason unknown)
vdd_gpu_npu: disabling

But can also be that the PineTab2 (likely) needs regulator-always-on and regulator-boot-on in its vdd_gpu_npu node.

Quoted 7 lines

I tried to track down the problem, and it seems to be a generic issue when horizontal line width is not divisible by 4.
Lowering line width to 1364px fixes the issue, but of course I have two vertical lines of black pixels on the right.
I also made some tests with 720x1280 DSI display. Lowering horizontal line to 718px shows the same problem. With 720px and 716px it works correctly.

I haven't look further into it, but the PT2 has a 1280x800 resolution.

HTH,
Diederik

maintainer
#13 lore raw

Hi,

Quoted 20 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 19 lines

Hi,

Quoted 16 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Quoted 36 lines

Heiko

Quoted 28 lines

On my PineTab2 I got similar messages about 2 weeks ago:
rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp1

Preceding those, I got several panfrost related errors:

panfrost fde60000.gpu: get clock failed -517
panfrost fde60000.gpu: clk init failed -517
platform fde60000.gpu: deferred probe pending: (reason unknown) platform cpufreq-dt: deferred probe pending: (reason unknown)
vdd_gpu_npu: disabling

But can also be that the PineTab2 (likely) needs regulator-always-on and regulator-boot-on in its vdd_gpu_npu node.

Quoted 7 lines

I tried to track down the problem, and it seems to be a generic issue when horizontal line width is not divisible by 4.
Lowering line width to 1364px fixes the issue, but of course I have two vertical lines of black pixels on the right.
I also made some tests with 720x1280 DSI display. Lowering horizontal line to 718px shows the same problem. With 720px and 716px it works correctly.

I haven't look further into it, but the PT2 has a 1280x800 resolution.

HTH,
Diederik

#14 lore raw
Quoted 31 lines · Andy Yan

Hi,

Quoted 26 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

Quoted 5 lines
Quoted 2 lines

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

Quoted 3 lines
Signature · 2 lines
With best wishes
Dmitry
maintainer
#15 lore raw

Hi Dmitry,

Quoted 32 lines · 在 2024-12-10 09:01:38,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 31 lines · Andy Yan

Hi,

Quoted 26 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

We round down to 4 pixel aligned in mode_fixup in our bsp kernel, because sometimes, some boards do indeed choose a screen that is not 4 pixel aligned

Quoted 8 lines
Quoted 4 lines
Signature · 2 lines
With best wishes
Dmitry
#16 lore raw
Quoted 40 lines · Andy Yan

Hi Dmitry,

Quoted 35 lines · 在 2024-12-10 09:01:38,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 34 lines · Andy Yan

Hi,

Quoted 28 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

We round down to 4 pixel aligned in mode_fixup in our bsp kernel,

What is meant by the "bsp kernel" here? I don't see it being present in the mainline kernel. So, if the mode is unsupported, it should be rejected.

Quoted 9 lines

because sometimes, some boards do indeed choose a screen that is not 4 pixel aligned

Quoted 8 lines
Quoted 4 lines

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
maintainer
#17 lore raw

Hi Dmitry,

Quoted 41 lines · 在 2024-12-10 09:45:11,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 40 lines · Andy Yan

Hi Dmitry,

Quoted 35 lines · 在 2024-12-10 09:01:38,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 34 lines · Andy Yan

Hi,

Quoted 28 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

We round down to 4 pixel aligned in mode_fixup in our bsp kernel,

What is meant by the "bsp kernel" here? I don't see it being present

bsp kernel means downstream vendor kernel.

Quoted 1 line

in the mainline kernel. So, if the mode is unsupported, it should be

Will it be acceptable to add this round down in the mainline mode_fixup?

Quoted 17 lines

rejected.

Quoted 9 lines

because sometimes, some boards do indeed choose a screen that is not 4 pixel aligned

Quoted 8 lines
Quoted 4 lines

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
author maintainer
#18 lore raw

Am Dienstag, 10. Dezember 2024, 02:54:09 CET schrieb Andy Yan:

Quoted 52 lines

Hi Dmitry,

Quoted 48 lines · 在 2024-12-10 09:45:11,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 46 lines · Andy Yan

Hi Dmitry,

Quoted 32 lines · 在 2024-12-10 09:01:38,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 31 lines · Andy Yan

Hi,

Quoted 26 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

We round down to 4 pixel aligned in mode_fixup in our bsp kernel,

Quoted 7 lines
Quoted 1 line

What is meant by the "bsp kernel" here? I don't see it being present

bsp kernel means downstream vendor kernel.

Quoted 1 line

in the mainline kernel. So, if the mode is unsupported, it should be

Will it be acceptable to add this round down in the mainline mode_fixup?

personally I'd like that.

I.e. the thing in the examoke above is an LVDS display, so has essentially fixed resolution. So adapting the resolution may or may not be possible (some for DSI or whatever) .

Doing that rounding-down AND emitting a dev_warn about that fact would be preferrable to me personally, though I don't know if there is some different precedent in other parts of DRM.

Heiko

#19 lore raw
In reply to Andy Yan
Quoted 52 lines · Andy Yan

Hi Dmitry,

Quoted 48 lines · 在 2024-12-10 09:45:11,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 46 lines · Andy Yan

Hi Dmitry,

Quoted 32 lines · 在 2024-12-10 09:01:38,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 31 lines · Andy Yan

Hi,

Quoted 26 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

We round down to 4 pixel aligned in mode_fixup in our bsp kernel,

Quoted 7 lines
Quoted 1 line

What is meant by the "bsp kernel" here? I don't see it being present

bsp kernel means downstream vendor kernel.

Quoted 1 line

in the mainline kernel. So, if the mode is unsupported, it should be

Will it be acceptable to add this round down in the mainline mode_fixup?

I think so.

Quoted 4 lines
Quoted 4 lines

rejected.

Quoted 1 line

because sometimes, some boards do indeed choose a screen that is not 4 pixel aligned

Signature · 2 lines
With best wishes
Dmitry
maintainer
#20 lore raw

Hi All,

Quoted 55 lines · 在 2024-12-10 20:32:03,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 54 lines · Andy Yan

Hi Dmitry,

Quoted 49 lines · 在 2024-12-10 09:45:11,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 40 lines · Andy Yan

Hi Dmitry,

Quoted 35 lines · 在 2024-12-10 09:01:38,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 34 lines · Andy Yan

Hi,

Quoted 28 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 24 lines

Hi,

Quoted 21 lines · Daniel Semkowicz
Quoted 3 lines · Heiko Stuebner

This series adds a bridge and glue driver for the DSI2 controller found in the rk3588 soc from Rockchip, that is based on a Synopsis IP block.

I did more tests with different LVDS displays. I tested following configurations with DSI/LVDS bridge:
- [email protected]
- [email protected]
- [email protected]
- [email protected]

All of them worked without issues, except 1366x768. With this resolution, video is blurry, and offset incorrectly to the left. There are also repeating errors on the console:

rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp3

In correct operation with other resolutions, there is no error. I am not sure if this is a problem in your series or rather in VOP2 driver.

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

We round down to 4 pixel aligned in mode_fixup in our bsp kernel,

What is meant by the "bsp kernel" here? I don't see it being present

Quoted 7 lines
Quoted 5 lines

bsp kernel means downstream vendor kernel.

Quoted 1 line

in the mainline kernel. So, if the mode is unsupported, it should be

Will it be acceptable to add this round down in the mainline mode_fixup?

I think so.

Then I can write a patch for it.

Quoted 9 lines
Quoted 5 lines
Quoted 5 lines

rejected.

Quoted 1 line

because sometimes, some boards do indeed choose a screen that is not 4 pixel aligned

Signature · 2 lines
With best wishes
Dmitry
author maintainer
#21 lore raw

Hi Andy,

Am Dienstag, 10. Dezember 2024, 13:48:12 CET schrieb Andy Yan:

Quoted 24 lines · 在 2024-12-10 20:32:03,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 23 lines · Andy Yan
Quoted 22 lines · 在 2024-12-10 09:45:11,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 10 lines · Andy Yan
Quoted 9 lines · 在 2024-12-10 09:01:38,"Dmitry Baryshkov" <[email protected]> 写道:
Quoted 8 lines · Andy Yan
Quoted 7 lines
Quoted 5 lines · Heiko Stübner

Am Montag, 9. Dezember 2024, 17:11:03 CET schrieb Diederik de Haas:

Quoted 2 lines · Daniel Semkowicz
Quoted 1 line · Heiko Stuebner

This really sounds like something is wrong on the vop side. The interrupt is part of the vop, the divisable by 4 things likely too.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This is a hardware limitation on vop side:
The horizontal resolution must be 4 pixel aligned.

Then mode_valid() and atomic_check() must reject modes that don't fit.

We round down to 4 pixel aligned in mode_fixup in our bsp kernel,

What is meant by the "bsp kernel" here? I don't see it being present

bsp kernel means downstream vendor kernel.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

in the mainline kernel. So, if the mode is unsupported, it should be

Will it be acceptable to add this round down in the mainline mode_fixup?

I think so.

Then I can write a patch for it.

thanks a lot for looking into that :-)

Heiko