Skip to contentSkip to conversation

MIPI DSI phy for rk3588

PATCH Superseded Heiko Stuebner 3 participants 6 messages Dec 3, 2024 – Jan 31, 2025

Subsystems (3)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

v5 cover MIPI DSI phy for rk3588

This adds the phy driver need for DSI output on rk3588.

The phy itself is used for both DSI output and CSI input, though the CSI part for the whole chain needs a lot more work, so is left out for now and only the DSI part implemented.

This allows the rk3588 with its current VOP support to drive a DSI display using the DSI2 controller driver I'll submit in a next step.

Only generic phy interfaces are used, so the DSI part is pretty straight forward.

changes in v5:
- add bitfield.h for the FIELD_PROP definition
(reported by kernel-test-robot)
- add Sebastian's Reviewed-by
- add Conor's Ack to the dt-binding

changes in v4:
- moved to #phy-cells = 1 as suggested by Sebastian, with the argument denoting the requested phy-type (C-PHY, D-PHY). This works similarly how the Mediatek C/D-PHY already implements this, see mails around:
https://lore.kernel.org/all/[email protected]/
- dropped Krzysztof's review tag from the binding because of this
- dropped custom UPDATE macro and use FIELD_PREP instead
- build a FIELD_PREP_HIWORD macro for the GRF settings
- add received Tested-by tags

changes in v3:
- add Krzysztof review tag to the binding
- address Sebastian's review comments
- better error handling
- dropping empty function
- headers
- not using of_match_ptr - this should also make the test-robot happier

changes in v2:
- fix error in dt-binding example
- drop unused frequency table
- pull in some more recent improvements from the vendor-kernel which includes a lot less magic values
- already include the support for rk3576
- use dev_err_probe

Heiko Stuebner (2):
dt-bindings: phy: Add Rockchip MIPI C-/D-PHY schema
phy: rockchip: Add Samsung MIPI D-/C-PHY driver

 .../phy/rockchip,rk3588-mipi-dcphy.yaml       |   87 +
 drivers/phy/rockchip/Kconfig                  |   12 +
 drivers/phy/rockchip/Makefile                 |    1 +
 .../phy/rockchip/phy-rockchip-samsung-dcphy.c | 1604 +++++++++++++++++
 4 files changed, 1704 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/rockchip,rk3588-mipi-dcphy.yaml
 create mode 100644 drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
Signature · 1 line
2.45.2
author maintainer
#1 lore raw

PATCH v5 1/2 dt-bindings: phy: Add Rockchip MIPI C-/D-PHY schema

From: Heiko Stuebner <[email protected]>

Add dt-binding schema for the MIPI C-/D-PHY found on Rockchip RK3588 SoCs.

---
 .../phy/rockchip,rk3588-mipi-dcphy.yaml       | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/rockchip,rk3588-mipi-dcphy.yaml
Documentation/devicetree/bindings/phy/rockchip,rk3588-mipi-dcphy.yaml new file +87 -0
new file mode 100644
index 000000000000..c8ff5ba22a86
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/rockchip,rk3588-mipi-dcphy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip MIPI D-/C-PHY with Samsung IP block
+
+maintainers:
+  - Guochun Huang <[email protected]>
+  - Heiko Stuebner <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - rockchip,rk3576-mipi-dcphy
+      - rockchip,rk3588-mipi-dcphy
+
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 1
+    description: |
+      Argument is mode to operate in. Supported modes are:
+        - PHY_TYPE_DPHY
+        - PHY_TYPE_CPHY
+      See include/dt-bindings/phy/phy.h for constants.
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: ref
+
+  resets:
+    maxItems: 4
+
+  reset-names:
+    items:
+      - const: m_phy
+      - const: apb
+      - const: grf
+      - const: s_phy
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to the syscon managing the 'mipi dcphy general register files'.
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rockchip,rk3588-cru.h>
+    #include <dt-bindings/reset/rockchip,rk3588-cru.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      phy@feda0000 {
+        compatible = "rockchip,rk3588-mipi-dcphy";
+        reg = <0x0 0xfeda0000 0x0 0x10000>;
+        clocks = <&cru PCLK_MIPI_DCPHY0>,
+                 <&cru CLK_USBDPPHY_MIPIDCPPHY_REF>;
+        clock-names = "pclk", "ref";
+        resets = <&cru SRST_M_MIPI_DCPHY0>,
+                 <&cru SRST_P_MIPI_DCPHY0>,
+                 <&cru SRST_P_MIPI_DCPHY0_GRF>,
+                 <&cru SRST_S_MIPI_DCPHY0>;
+        reset-names = "m_phy", "apb", "grf", "s_phy";
+        rockchip,grf = <&mipidcphy0_grf>;
+        #phy-cells = <1>;
+      };
+    };
Signature · 1 line
2.45.2
Reviewed-by on v5 1/2
#2 lore raw

Re: [PATCH v5 1/2] dt-bindings: phy: Add Rockchip MIPI C-/D-PHY schema

Quoted 6 lines · Heiko Stuebner
Documentation/devicetree/bindings/phy/rockchip,rk3588-mipi-dcphy.yaml new file +6 -0
+properties:
+  compatible:
+    enum:
+      - rockchip,rk3576-mipi-dcphy
+      - rockchip,rk3588-mipi-dcphy
+

Documentation/devicetree/bindings/phy/rockchip,rk3588-mipi-dcphy.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/phy/rockchip,rk3588-mipi-dcphy.yaml new file +10 -0
+  reg:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 1
+    description: |
+      Argument is mode to operate in. Supported modes are:
+        - PHY_TYPE_DPHY
+        - PHY_TYPE_CPHY
+      See include/dt-bindings/phy/phy.h for constants.

That's the only difference from version I gave review. It is approved style of passing phy type/mode, so adding this is not valid reason to drop my review tag and request re-review.

Best regards,
Krzysztof

author maintainer
#3 lore raw

PATCH v5 2/2 phy: rockchip: Add Samsung MIPI D-/C-PHY driver

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Add driver for the MIPI D-/C-PHY block based around a Samsung IP-block that is for example needed to drive a MIPI DSI output on rk3588.

Right now only the D-PHY portion is implemented, with the C-PHY part needing separate work.

---
 drivers/phy/rockchip/Kconfig                  |   12 +
 drivers/phy/rockchip/Makefile                 |    1 +
 .../phy/rockchip/phy-rockchip-samsung-dcphy.c | 1604 +++++++++++++++++
 3 files changed, 1617 insertions(+)
 create mode 100644 drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c
drivers/phy/rockchip/Kconfig +12 -0
index 2f7a05f21dc5..2bfb42996503 100644
@@ -83,6 +83,18 @@ config PHY_ROCKCHIP_PCIE
 	help
 	  Enable this to support the Rockchip PCIe PHY.
 
+config PHY_ROCKCHIP_SAMSUNG_DCPHY
+	tristate "Rockchip Samsung MIPI DCPHY driver"
+	depends on (ARCH_ROCKCHIP || COMPILE_TEST)
+	select GENERIC_PHY
+	select GENERIC_PHY_MIPI_DPHY
+	help
+	  Enable this to support the Rockchip MIPI DCPHY with
+	  Samsung IP block.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called phy-rockchip-samsung-dcphy
+
 config PHY_ROCKCHIP_SAMSUNG_HDPTX
 	tristate "Rockchip Samsung HDMI/eDP Combo PHY driver"
 	depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF
drivers/phy/rockchip/Makefile +1 -0
index 010a824e32ce..117aaffd037d 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_PHY_ROCKCHIP_INNO_HDMI)	+= phy-rockchip-inno-hdmi.o
 obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)	+= phy-rockchip-inno-usb2.o
 obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY)	+= phy-rockchip-naneng-combphy.o
 obj-$(CONFIG_PHY_ROCKCHIP_PCIE)		+= phy-rockchip-pcie.o
+obj-$(CONFIG_PHY_ROCKCHIP_SAMSUNG_DCPHY)	+= phy-rockchip-samsung-dcphy.o
 obj-$(CONFIG_PHY_ROCKCHIP_SAMSUNG_HDPTX)	+= phy-rockchip-samsung-hdptx.o
 obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3)	+= phy-rockchip-snps-pcie3.o
 obj-$(CONFIG_PHY_ROCKCHIP_TYPEC)	+= phy-rockchip-typec.o
drivers/phy/rockchip/phy-rockchip-samsung-dcphy.c new file +1604 -0

1,604 lines not on this page · raw message

Signature · 1 line
2.45.2
Tested-by on the v5 series
#4 lore raw
In reply to Heiko Stuebner

Hi Heiko,

Quoted 6 lines · Heiko Stuebner

This adds the phy driver need for DSI output on rk3588.

The phy itself is used for both DSI output and CSI input, though the CSI part for the whole chain needs a lot more work, so is left out for now and only the DSI part implemented.

Quoted 6 lines

This allows the rk3588 with its current VOP support to drive a DSI display using the DSI2 controller driver I'll submit in a next step.

Only generic phy interfaces are used, so the DSI part is pretty straight forward.

I assume this is the same setup you tested this series with, but confirmation doesn't hurt.

Tested with https://lore.kernel.org/linux-rockchip/[email protected]/ applied on top.

Thanks!
Quentin

author maintainer
#5 lore raw
In reply to Heiko Stuebner

Hi phy-maintainers,

Am Dienstag, 3. Dezember 2024, 17:49:30 MEZ schrieb Heiko Stuebner:

Quoted 11 lines

This adds the phy driver need for DSI output on rk3588.

The phy itself is used for both DSI output and CSI input, though the CSI part for the whole chain needs a lot more work, so is left out for now and only the DSI part implemented.

This allows the rk3588 with its current VOP support to drive a DSI display using the DSI2 controller driver I'll submit in a next step.

Only generic phy interfaces are used, so the DSI part is pretty straight forward.

a tiny little ping :-)

Is this still in a queue, or did it fall through the cracks during xmas?

Thanks a lot
Heiko