Skip to contentSkip to conversation

Add eDP support for RK3576

PATCH Superseded Damon Ding 3 participants 18 messages May 25 – May 26

Subsystems (6)

v8 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Damon Ding

author
#0 lore raw

v8 cover Add eDP support for RK3576

Patch 1-5 are to add missing clock "hclk" for RK3588 eDP nodes. Patch 6-7 are to add the RK3576 eDP node.
Patch 8-10 are to support the RK3576 Analogix DP controller.

Damon Ding (10):
dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock

    for RK3588

dt-bindings: display: rockchip: analogix-dp: Add per-clock
descriptions
arm64: dts: rockchip: Add missing hclk for RK3588 eDP0
arm64: dts: rockchip: Add missing hclk for RK3588 eDP1 drm/rockchip: analogix_dp: Enable hclk for RK3588
dt-bindings: display: rockchip: analogix-dp: Add support for RK3576
arm64: dts: rockchip: Add eDP node for RK3576 drm/bridge: analogix_dp: Rename and simplify is_rockchip() drm/bridge: analogix_dp: Add support for RK3576 drm/rockchip: analogix_dp: Add support for RK3576

 .../rockchip/rockchip,analogix-dp.yaml        | 41 ++++++++++++++++++-
 arch/arm64/boot/dts/rockchip/rk3576.dtsi      | 28 +++++++++++++
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi |  4 +-
 .../arm64/boot/dts/rockchip/rk3588-extra.dtsi |  4 +-
 .../drm/bridge/analogix/analogix_dp_core.c    |  3 +-
 .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 18 ++++----
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   | 15 +++++++
 include/drm/bridge/analogix_dp.h              | 13 +++++-
 8 files changed, 108 insertions(+), 18 deletions(-)

---

Changes in v2:
- Split out separate patches to add the "hclk" clock reference.
- Split out separate patches to enable the "hclk" clock.
- Add Reviewed-by tag.

Changes in v3:
- Add a patch to expand descriptions for clocks of the eDP node.
- Add Reviewed-by tag.

Changes in v4:
- Modify commit msg.

Changes in v5:
- Enforce the correct third clock name on a per-compatible basis.
- Modify the commit msg simultaneously.
- Add Acked-by tag.

Changes in v6:
- Expand more detail commit msg about using hclk instead of grf clock.

Changes in v7:
- List all valid clock names at the top level, and constrain the clock count for each platform with minItems/maxItems in allOf.

Changes in v8:
- Fix indentation to 10 for enum in clock-names property.

Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v8 1/10 dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588

RK3588 eDP controller requires HCLK_VO1 to access the VO1 GRF registers and enable the video datapath.

Previously, the clock was enabled implicitly via the 'rockchip,vo-grf' phandle reference, which allowed the eDP to work without explicitly managing the hclk_vo1 clock. However, this is not safe or explicit.

To make the clock dependency explicit, enforce per-SoC clock-names requirements:
- RK3288: 2 clocks (dp, pclk)
- RK3399: 3 clocks (dp, pclk, grf)
- RK3588: 3 clocks (dp, pclk, hclk)

Do not reuse the 'grf' clock name for RK3588 because it represents a different clock with distinct control logic:
- The 'grf' clock is only for GRF register access and is toggled dynamically during register access.
- The 'hclk' clock controls both GRF access and video datapath gating, and must remain enabled during probe.

Fixes f855146263b1 ("dt-bindings: display: rockchip: analogix-dp: Add support for RK3588")

---

Changes in v4:
- Modify the commit msg.

Changes in v5:
- Enforce the correct third clock name on a per-compatible basis.
- Modify the commit msg simultaneously.

Changes in v6:
- Expand more detail commit msg about using hclk instead of grf clock.

Changes in v7:
- List all valid clock names at the top level, and constrain the clock count for each platform with minItems/maxItems in allOf.

Changes in v8:
- Fix indentation to 10 for enum in clock-names property.

---
 .../rockchip/rockchip,analogix-dp.yaml        | 34 ++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +33 -1
index d99b23b88cc5..a1ab7a77bdd3 100644
@@ -26,7 +26,9 @@ properties:
     items:
       - const: dp
       - const: pclk
-      - const: grf
+      - enum:
+          - grf
+          - hclk
 
   power-domains:
     maxItems: 1
@@ -60,6 +62,32 @@ required:
 allOf:
   - $ref: /schemas/display/bridge/analogix,dp.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3288-dp
+    then:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          maxItems: 2
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3399-edp
+    then:
+      properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
+
   - if:
       properties:
         compatible:
@@ -68,6 +96,10 @@ allOf:
               - rockchip,rk3588-edp
     then:
       properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
         resets:
           minItems: 2
         reset-names:
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v8 01/10] dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The schema fails to enforce the per-SoC clock names for the third clock as claimed in the commit…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The schema fails to enforce the per-SoC clock names for the third clock as claimed in the commit message. --

commit 610de2ebf53101c37f8a390596d7553b1a60ba5c
Author: Damon Ding <[email protected]>

dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588

This commit changes the analogix-dp binding to require the hclk clock for the RK3588 eDP controller to make the dependency explicit. It attempts to define per-SoC clock requirements, specifying 2 clocks for RK3288, and 3 clocks for RK3399 (grf) and RK3588 (hclk).

Quoted 15 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +3 -1
index d99b23b88cc59..a1ab7a77bdd35 100644
@@ -26,7 +26,9 @@ properties:
     items:
       - const: dp
       - const: pclk
-      - const: grf
+      - enum:
+          - grf
+          - hclk
 
   power-domains:
     maxItems: 1

[ ... ]

Quoted 3 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +0 -0
@@ -60,6 +62,32 @@ required:
 allOf:
   - $ref: /schemas/display/bridge/analogix,dp.yaml#

[ ... ]

Quoted 17 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +13 -0
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3399-edp
+    then:
+      properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
+
   - if:
       properties:
         compatible:

Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml allOf: · line 102

Quoted 7 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +4 -0
@@ -68,6 +96,10 @@ allOf:
               - rockchip,rk3588-edp
     then:
       properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3

[Severity: Medium]
The commit message explicitly states the intent to enforce per-SoC clock-names requirements, specifying that RK3399 requires grf as the third clock while RK3588 requires hclk.

Does this implementation actually enforce the per-SoC clock names for the third clock?

The conditional blocks only add minItems: 3 to the clock-names property without explicitly defining the sequence of allowed values. Since the top-level clock-names definition allows an enum of grf and hclk, could an RK3399 node successfully validate while using hclk, or an RK3588 node validate while using grf?

Should the then clauses explicitly define clock-names: items with the exact sequence of const strings required for each specific SoC to fully enforce these constraints?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH v8 01/10] dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588

In reply to Damon Ding
Quoted 79 lines · Damon Ding

RK3588 eDP controller requires HCLK_VO1 to access the VO1 GRF registers and enable the video datapath.

Previously, the clock was enabled implicitly via the 'rockchip,vo-grf' phandle reference, which allowed the eDP to work without explicitly managing the hclk_vo1 clock. However, this is not safe or explicit.

To make the clock dependency explicit, enforce per-SoC clock-names requirements:
- RK3288: 2 clocks (dp, pclk)
- RK3399: 3 clocks (dp, pclk, grf)
- RK3588: 3 clocks (dp, pclk, hclk)

Do not reuse the 'grf' clock name for RK3588 because it represents a different clock with distinct control logic:
- The 'grf' clock is only for GRF register access and is toggled dynamically during register access.
- The 'hclk' clock controls both GRF access and video datapath gating, and must remain enabled during probe.

Fixes f855146263b1 ("dt-bindings: display: rockchip: analogix-dp: Add support for RK3588")

---

Changes in v4:
- Modify the commit msg.

Changes in v5:
- Enforce the correct third clock name on a per-compatible basis.
- Modify the commit msg simultaneously.

Changes in v6:
- Expand more detail commit msg about using hclk instead of grf clock.

Changes in v7:
- List all valid clock names at the top level, and constrain the clock count for each platform with minItems/maxItems in allOf.

Changes in v8:
- Fix indentation to 10 for enum in clock-names property.

---
 .../rockchip/rockchip,analogix-dp.yaml        | 34 ++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +18 -1
index d99b23b88cc5..a1ab7a77bdd3 100644
@@ -26,7 +26,9 @@ properties:
     items:
       - const: dp
       - const: pclk
-      - const: grf
+      - enum:
+          - grf
+          - hclk
 
   power-domains:
     maxItems: 1
@@ -60,6 +62,32 @@ required:
 allOf:
   - $ref: /schemas/display/bridge/analogix,dp.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3288-dp
+    then:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          maxItems: 2
+
+  - if:
+      properties:

Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml required: · line 89

Quoted 10 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +10 -0
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3399-edp
+    then:
+      properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3

If you go back to v6, you'll see that I never asked you to remove the explict clock-names from here or below. Only the one from the 3288 section. The minItems was an addition, not a replacement.

pw-bot: changes-requested

Cheers,
Conor.

Quoted 19 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +5 -0
+
   - if:
       properties:
         compatible:
@@ -68,6 +96,10 @@ allOf:
               - rockchip,rk3588-edp
     then:
       properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
         resets:
           minItems: 2
         reset-names:
Signature · 1 line
2.34.1
author
#4 lore raw

Re: [PATCH v8 01/10] dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588

Hi Conor,

Quoted 95 lines · Conor Dooley
Quoted 79 lines · Damon Ding

RK3588 eDP controller requires HCLK_VO1 to access the VO1 GRF registers and enable the video datapath.

Previously, the clock was enabled implicitly via the 'rockchip,vo-grf' phandle reference, which allowed the eDP to work without explicitly managing the hclk_vo1 clock. However, this is not safe or explicit.

To make the clock dependency explicit, enforce per-SoC clock-names requirements:
- RK3288: 2 clocks (dp, pclk)
- RK3399: 3 clocks (dp, pclk, grf)
- RK3588: 3 clocks (dp, pclk, hclk)

Do not reuse the 'grf' clock name for RK3588 because it represents a different clock with distinct control logic:
- The 'grf' clock is only for GRF register access and is toggled dynamically during register access.
- The 'hclk' clock controls both GRF access and video datapath gating, and must remain enabled during probe.

Fixes f855146263b1 ("dt-bindings: display: rockchip: analogix-dp: Add support for RK3588")

---

Changes in v4:
- Modify the commit msg.

Changes in v5:
- Enforce the correct third clock name on a per-compatible basis.
- Modify the commit msg simultaneously.

Changes in v6:
- Expand more detail commit msg about using hclk instead of grf clock.

Changes in v7:
- List all valid clock names at the top level, and constrain the clock count for each platform with minItems/maxItems in allOf.

Changes in v8:
- Fix indentation to 10 for enum in clock-names property.

---
  .../rockchip/rockchip,analogix-dp.yaml        | 34 ++++++++++++++++++-
  1 file changed, 33 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +18 -1
index d99b23b88cc5..a1ab7a77bdd3 100644
@@ -26,7 +26,9 @@ properties:
      items:
        - const: dp
        - const: pclk
-      - const: grf
+      - enum:
+          - grf
+          - hclk
 
    power-domains:
      maxItems: 1
@@ -60,6 +62,32 @@ required:
  allOf:
    - $ref: /schemas/display/bridge/analogix,dp.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3288-dp
+    then:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          maxItems: 2
+
+  - if:
+      properties:

Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml required: · line 89

Quoted 10 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +10 -0
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3399-edp
+    then:
+      properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3

If you go back to v6, you'll see that I never asked you to remove the explict clock-names from here or below. Only the one from the 3288 section. The minItems was an addition, not a replacement.

Quoted 2 lines

pw-bot: changes-requested

Sorry for the misunderstanding. I will restore the explicit clock-names definitions and fix this in next version.

Best regards,
Damon

Quoted 20 lines
Quoted 20 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +5 -0
+
    - if:
        properties:
          compatible:
@@ -68,6 +96,10 @@ allOf:
                - rockchip,rk3588-edp
      then:
        properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
          resets:
            minItems: 2
          reset-names:
Signature · 1 line
2.34.1
author
#5 lore raw

Re: [PATCH v8 01/10] dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588

Hi Conor,

Quoted 98 lines · Damon Ding

Hi Conor,

Quoted 95 lines · Conor Dooley
Quoted 81 lines · Damon Ding

RK3588 eDP controller requires HCLK_VO1 to access the VO1 GRF registers and enable the video datapath.

Previously, the clock was enabled implicitly via the 'rockchip,vo-grf' phandle reference, which allowed the eDP to work without explicitly managing the hclk_vo1 clock. However, this is not safe or explicit.

To make the clock dependency explicit, enforce per-SoC clock-names requirements:
  - RK3288: 2 clocks (dp, pclk)
  - RK3399: 3 clocks (dp, pclk, grf)
  - RK3588: 3 clocks (dp, pclk, hclk)

Do not reuse the 'grf' clock name for RK3588 because it represents a different clock with distinct control logic:
- The 'grf' clock is only for GRF register access and is toggled dynamically during register access.
- The 'hclk' clock controls both GRF access and video datapath gating, and must remain enabled during probe.

Fixes f855146263b1 ("dt-bindings: display: rockchip: analogix-dp: Add support for RK3588")

---

Changes in v4:
- Modify the commit msg.

Changes in v5:
- Enforce the correct third clock name on a per-compatible basis.
- Modify the commit msg simultaneously.

Changes in v6:
- Expand more detail commit msg about using hclk instead of grf clock.

Changes in v7:
- List all valid clock names at the top level, and constrain the clock count for each platform with minItems/maxItems in allOf.

Changes in v8:
- Fix indentation to 10 for enum in clock-names property.
---
  .../rockchip/rockchip,analogix-dp.yaml        | 34 ++++++++++++++++++-

  1 file changed, 33 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/ display/rockchip/rockchip,analogix-dp.yaml renamed from Documentation/devicetree/bindings/display/rockchip/ rockchip,analogix-dp.yaml +0 -1
index d99b23b88cc5..a1ab7a77bdd3 100644
--- a/Documentation/devicetree/bindings/display/rockchip/ 

rockchip,analogix-dp.yaml
+++ b/Documentation/devicetree/bindings/display/rockchip/ rockchip,analogix-dp.yaml

Documentation/devicetree/bindings/ display/rockchip/rockchip,analogix-dp.yaml renamed from Documentation/devicetree/bindings/display/rockchip/ rockchip,analogix-dp.yaml +0 -0
@@ -26,7 +26,9 @@ properties:

      items:
        - const: dp
        - const: pclk
-      - const: grf
+      - enum:
+          - grf
+          - hclk
    power-domains:
      maxItems: 1

Documentation/devicetree/bindings/ display/rockchip/rockchip,analogix-dp.yaml renamed from Documentation/devicetree/bindings/display/rockchip/ rockchip,analogix-dp.yaml +0 -0
@@ -60,6 +62,32 @@ required:

  allOf:
    - $ref: /schemas/display/bridge/analogix,dp.yaml# +  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3288-dp
+    then:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          maxItems: 2
+
+  - if:
+      properties:
+        compatible:
+          contains:

Quoted 8 lines

+            enum:
+              - rockchip,rk3399-edp
+    then:
+      properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3

If you go back to v6, you'll see that I never asked you to remove the explict clock-names from here or below. Only the one from the 3288 section. The minItems was an addition, not a replacement.

Quoted 5 lines
Quoted 2 lines

pw-bot: changes-requested

Sorry for the misunderstanding. I will restore the explicit clock-names definitions and fix this in next version.

Sorry to bother you. I attempted to place the explicit clock-names under minItems:

Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +8 -0
index a1ab7a77bdd3..ef03edf52de8 100644
@@ -87,6 +87,10 @@ allOf:
           minItems: 3
         clock-names:
           minItems: 3
+          items:
+            - const: dp
+            - const: pclk
+            - const: grf
 
   - if:
       properties:
@@ -100,6 +104,10 @@ allOf:
           minItems: 3
         clock-names:
           minItems: 3
+          items:
+            - const: dp
+            - const: pclk
+            - const: hclk
         resets:
           minItems: 2
         reset-names:

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml

Then the following errors occurred:

SCHEMA Documentation/devicetree/bindings/processed-schema.json
CHKDT ./Documentation/devicetree/bindings
/home/ding/drm-misc/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml: allOf:2:then:properties:clock-names: 'oneOf' conditional failed, one must be fixed:
False schema does not allow 3
[{'const': 'dp'}, {'const': 'pclk'}, {'const': 'grf'}] is too long
[{'const': 'dp'}, {'const': 'pclk'}, {'const': 'grf'}] is too short
1 was expected
3 is greater than the maximum of 2
hint: "minItems" is only needed if less than the "items" list
length
from schema $id: http://devicetree.org/meta-schemas/items.yaml
/home/ding/drm-misc/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml: allOf:3:then:properties:clock-names: 'oneOf' conditional failed, one must be fixed:

        False schema does not allow 3
        [{'const': 'dp'}, {'const': 'pclk'}, {'const': 'hclk'}] is too long
        [{'const': 'dp'}, {'const': 'pclk'}, {'const': 'hclk'}] is too 

short
1 was expected
3 is greater than the maximum of 2
hint: "minItems" is only needed if less than the "items" list
length
from schema $id: http://devicetree.org/meta-schemas/items.yaml
LINT ./Documentation/devicetree/bindings
DTEX
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.example.dts
DTC [C]
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.example.dtb

Neither keeping only minItems nor only the explicit clock-names causes any errors. Would it be a better idea to keep just the explicit clock-names here?

Best regards,
Damon

Quoted 24 lines
Quoted 21 lines
Quoted 21 lines

+
    - if:
        properties:
          compatible:

Documentation/devicetree/bindings/ display/rockchip/rockchip,analogix-dp.yaml renamed from Documentation/devicetree/bindings/display/rockchip/ rockchip,analogix-dp.yaml +0 -0
@@ -68,6 +96,10 @@ allOf:

                - rockchip,rk3588-edp
      then:
        properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
          resets:
            minItems: 2
          reset-names:

Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v8 01/10] dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588

Quoted 171 lines · Damon Ding

Hi Conor,

Quoted 101 lines · Damon Ding

Hi Conor,

Quoted 98 lines · Conor Dooley
Quoted 84 lines · Damon Ding

RK3588 eDP controller requires HCLK_VO1 to access the VO1 GRF registers and enable the video datapath.

Previously, the clock was enabled implicitly via the 'rockchip,vo-grf' phandle reference, which allowed the eDP to work without explicitly managing the hclk_vo1 clock. However, this is not safe or explicit.

To make the clock dependency explicit, enforce per-SoC clock-names requirements:
  - RK3288: 2 clocks (dp, pclk)
  - RK3399: 3 clocks (dp, pclk, grf)
  - RK3588: 3 clocks (dp, pclk, hclk)

Do not reuse the 'grf' clock name for RK3588 because it represents a different clock with distinct control logic:
- The 'grf' clock is only for GRF register access and is toggled dynamically during register access.
- The 'hclk' clock controls both GRF access and video datapath gating, and must remain enabled during probe.

Fixes f855146263b1 ("dt-bindings: display: rockchip:

analogix-dp: Add support for RK3588")

---

Changes in v4:
- Modify the commit msg.

Changes in v5:
- Enforce the correct third clock name on a per-compatible basis.
- Modify the commit msg simultaneously.

Changes in v6:
- Expand more detail commit msg about using hclk instead of grf clock.

Changes in v7:
- List all valid clock names at the top level, and constrain the clock count for each platform with minItems/maxItems in allOf.

Changes in v8:
- Fix indentation to 10 for enum in clock-names property.
---
  .../rockchip/rockchip,analogix-dp.yaml        | 34 ++++++++++++++++++-

  1 file changed, 33 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

rockchip,analogix-dp.yaml b/Documentation/devicetree/bindings/ display/rockchip/rockchip,analogix-dp.yaml
index d99b23b88cc5..a1ab7a77bdd3 100644
--- a/Documentation/devicetree/bindings/display/rockchip/ rockchip,analogix-dp.yaml
+++ b/Documentation/devicetree/bindings/display/rockchip/ rockchip,analogix-dp.yaml

(quoted diff) +0 -0
@@ -26,7 +26,9 @@ properties:

      items:
        - const: dp
        - const: pclk
-      - const: grf
+      - enum:
+          - grf
+          - hclk
    power-domains:
      maxItems: 1

(quoted diff) +0 -0
@@ -60,6 +62,32 @@ required:

  allOf:
    - $ref: /schemas/display/bridge/analogix,dp.yaml# +  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - rockchip,rk3288-dp
+    then:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          maxItems: 2
+
+  - if:
+      properties:
+        compatible:
+          contains:

Quoted 8 lines

+            enum:
+              - rockchip,rk3399-edp
+    then:
+      properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3

If you go back to v6, you'll see that I never asked you to remove the explict clock-names from here or below. Only the one from the 3288 section. The minItems was an addition, not a replacement.

Quoted 6 lines
Quoted 2 lines

pw-bot: changes-requested

Sorry for the misunderstanding. I will restore the explicit clock-names definitions and fix this in next version.

Sorry to bother you. I attempted to place the explicit clock-names under minItems:

Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +8 -0
index a1ab7a77bdd3..ef03edf52de8 100644
@@ -87,6 +87,10 @@ allOf:
           minItems: 3
         clock-names:
           minItems: 3
+          items:
+            - const: dp
+            - const: pclk
+            - const: grf
 
   - if:
       properties:
@@ -100,6 +104,10 @@ allOf:
           minItems: 3
         clock-names:
           minItems: 3
+          items:
+            - const: dp
+            - const: pclk
+            - const: hclk
         resets:
           minItems: 2
         reset-names:

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml

Then the following errors occurred:

SCHEMA Documentation/devicetree/bindings/processed-schema.json
CHKDT ./Documentation/devicetree/bindings
/home/ding/drm-misc/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml:
allOf:2:then:properties:clock-names: 'oneOf' conditional failed, one must be fixed:
False schema does not allow 3
[{'const': 'dp'}, {'const': 'pclk'}, {'const': 'grf'}] is too long [{'const': 'dp'}, {'const': 'pclk'}, {'const': 'grf'}] is too short
1 was expected
3 is greater than the maximum of 2
hint: "minItems" is only needed if less than the "items" list length
from schema $id: http://devicetree.org/meta-schemas/items.yaml
/home/ding/drm-misc/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml:
allOf:3:then:properties:clock-names: 'oneOf' conditional failed, one must be fixed:
False schema does not allow 3
[{'const': 'dp'}, {'const': 'pclk'}, {'const': 'hclk'}] is too long [{'const': 'dp'}, {'const': 'pclk'}, {'const': 'hclk'}] is too short
1 was expected
3 is greater than the maximum of 2
hint: "minItems" is only needed if less than the "items" list length
from schema $id: http://devicetree.org/meta-schemas/items.yaml
LINT ./Documentation/devicetree/bindings
DTEX Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.example.dts DTC [C] Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.example.dtb

Quoted 3 lines

Neither keeping only minItems nor only the explicit clock-names causes any errors. Would it be a better idea to keep just the explicit clock-names here?

Sure.

This feels like a bug because I have no idea where the "maximum of 2" is coming from. I'll ask Rob about it.

author
#7 lore raw

PATCH v8 2/10 dt-bindings: display: rockchip: analogix-dp: Add per-clock descriptions

In reply to Damon Ding

Supplement dedicated description for each clock in the clocks property, clarifying the function of each clock input for the Analogix DP controller binding.

---

Changes in v4:
- Modify the commit msg.

Changes in v5:
- Add Acked-by tag.

---
 .../bindings/display/rockchip/rockchip,analogix-dp.yaml      | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +4 -1
index a1ab7a77bdd3..81240ad67385 100644
@@ -19,7 +19,10 @@ properties:
 
   clocks:
     minItems: 2
-    maxItems: 3
+    items:
+      - description: Reference clock
+      - description: APB bus clock
+      - description: GRF or AHB bus clock
 
   clock-names:
     minItems: 2
Signature · 1 line
2.34.1
author
#8 lore raw

PATCH v8 3/10 arm64: dts: rockchip: Add missing hclk for RK3588 eDP0

In reply to Damon Ding

Add the required HCLK_VO1 bus clock to RK3588 eDP0 node with corresponding clock-name "hclk". This clock is necessary for the eDP controller to access video output GRF and work properly.

Previously the clock was enabled implicitly via GRF phandle reference. Add it explicitly now to align with updated binding.

Fixes dc79d3d5e7c7 ("arm64: dts: rockchip: Add eDP0 node for RK3588")

---

Changes in v4:
- Modify the commit msg.

---
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +2 -2
index 4fb8888c281c..24a5ccbac08c 100644
@@ -1712,8 +1712,8 @@ hdmi0_out: port@1 {
 	edp0: edp@fdec0000 {
 		compatible = "rockchip,rk3588-edp";
 		reg = <0x0 0xfdec0000 0x0 0x1000>;
-		clocks = <&cru CLK_EDP0_24M>, <&cru PCLK_EDP0>;
-		clock-names = "dp", "pclk";
+		clocks = <&cru CLK_EDP0_24M>, <&cru PCLK_EDP0>, <&cru HCLK_VO1>;
+		clock-names = "dp", "pclk", "hclk";
 		interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH 0>;
 		phys = <&hdptxphy0>;
 		phy-names = "dp";
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v8 03/10] arm64: dts: rockchip: Add missing hclk for RK3588 eDP0

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] System Crash / Unhandled Clock State during GRF Access --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] System Crash / Unhandled Clock State during GRF Access
--

commit 4e13c2219274a6bd1764125601fd9e53185296bf
Author: Damon Ding <[email protected]>

arm64: dts: rockchip: Add missing hclk for RK3588 eDP0

This commit adds the HCLK_VO1 bus clock to the RK3588 eDP0 node and updates the clock-names property to include "hclk". This is intended to allow the eDP controller to access the video output GRF properly.

arch/arm64/boot/dts/rockchip/rk3588-base.dtsi hdmi0_out: port@1 { · line 1779

Quoted 12 lines
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +2 -2
index 546e19487219e..a8e8e844bb930 100644
@@ -1775,8 +1775,8 @@ hdmi0_out: port@1 {
 	edp0: edp@fdec0000 {
 		compatible = "rockchip,rk3588-edp";
 		reg = <0x0 0xfdec0000 0x0 0x1000>;
-		clocks = <&cru CLK_EDP0_24M>, <&cru PCLK_EDP0>;
-		clock-names = "dp", "pclk";
+		clocks = <&cru CLK_EDP0_24M>, <&cru PCLK_EDP0>, <&cru HCLK_VO1>;
+		clock-names = "dp", "pclk", "hclk";

[Severity: High]
Does adding this clock here before the driver is updated break git bisect?

Adding HCLK_VO1 to the clocks property causes it to be managed by the generic PM domain via pm_clk. The pm_clk framework automatically disables all clocks in the clocks property when the device is runtime-suspended.

During a modeset, drm_atomic_helper_commit_modeset_enables() executes the encoder's atomic_enable hook before the bridge's atomic_enable hook. Since the analogix_dp driver relies on the bridge's atomic_enable hook to call pm_runtime_get_sync(), the device is still runtime-suspended when the encoder's atomic_enable executes.

Consequently, HCLK_VO1 is disabled when the driver attempts to write to the vo1_grf registers. Can accessing the GRF without its bus clock enabled cause an asynchronous external abort and hang the system?

While this is fixed later in the series by commit 8a60fbccaa8c7 ("drm/rockchip: analogix_dp: Enable hclk for RK3588"), adding the clock to the device tree before the driver is prepared to handle its PM lifecycle appears to break git bisect by introducing a crash on modeset.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
author
#10 lore raw

PATCH v8 4/10 arm64: dts: rockchip: Add missing hclk for RK3588 eDP1

In reply to Damon Ding

Add the required HCLK_VO1 bus clock to RK3588 eDP1 node with corresponding clock-name "hclk". This clock is necessary for the eDP controller to access video output GRF and work properly.

Previously the clock was enabled implicitly via GRF phandle reference. Add it explicitly now to align with updated binding.

Fixes a481bb0b1ad9 ("arm64: dts: rockchip: Add eDP1 dt node for rk3588")

---

Changes in v4:
- Modify the commit msg.

---
 arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi +2 -2
index a2640014ee04..b251bb129cdb 100644
@@ -285,8 +285,8 @@ hdmi1_out: port@1 {
 	edp1: edp@fded0000 {
 		compatible = "rockchip,rk3588-edp";
 		reg = <0x0 0xfded0000 0x0 0x1000>;
-		clocks = <&cru CLK_EDP1_24M>, <&cru PCLK_EDP1>;
-		clock-names = "dp", "pclk";
+		clocks = <&cru CLK_EDP1_24M>, <&cru PCLK_EDP1>, <&cru HCLK_VO1>;
+		clock-names = "dp", "pclk", "hclk";
 		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH 0>;
 		phys = <&hdptxphy1>;
 		phy-names = "dp";
Signature · 1 line
2.34.1
author
#11 lore raw

PATCH v8 5/10 drm/rockchip: analogix_dp: Enable hclk for RK3588

In reply to Damon Ding

Acquire and enable the HCLK_VO1 bus clock explicitly for RK3588 eDP controller to guarantee register and datapath access.

The clock was previously enabled implicitly via rockchip,vo-grf phandle reference, which relies on side effect and is fragile.

Fetch optional "hclk" clock in driver to align with updated device tree binding and keep consistent with hardware clock dependency.

Fixes 729f8eefdcad ("drm/rockchip: analogix_dp: Add support for RK3588")

---

Changes in v4:
- Modify the commit msg.

---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +6 -0
index 06072efd7fca..d2af5eb29dbb 100644
@@ -311,6 +311,7 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)
 {
 	struct device *dev = dp->dev;
 	struct device_node *np = dev->of_node;
+	struct clk *clk;
 
 	dp->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
 	if (IS_ERR(dp->grf))
@@ -327,6 +328,11 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)
 		return dev_err_probe(dev, PTR_ERR(dp->pclk),
 				     "failed to get pclk property\n");
 
+	clk = devm_clk_get_optional_enabled(dev, "hclk");
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk),
+				     "failed to get hclk property\n");
+
 	dp->rst = devm_reset_control_get(dev, "dp");
 	if (IS_ERR(dp->rst))
 		return dev_err_probe(dev, PTR_ERR(dp->rst),
Signature · 7 lines
2.34.1


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

PATCH v8 6/10 dt-bindings: display: rockchip: analogix-dp: Add support for RK3576

In reply to Damon Ding

RK3576 integrates an eDP TX controller compatible with the existing RK3588 hardware design, reuse the same binding configuration directly.

---

Changes in v2:
- Split out a separate patch to add the "hclk" clock reference.

Chanegs in v4:
- Modify the commit msg.

Changes in v5:
- Add Acked-by tag.

---
 .../bindings/display/rockchip/rockchip,analogix-dp.yaml         | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +2 -0
index 81240ad67385..033eefcab2e8 100644
@@ -15,6 +15,7 @@ properties:
     enum:
       - rockchip,rk3288-dp
       - rockchip,rk3399-edp
+      - rockchip,rk3576-edp
       - rockchip,rk3588-edp
 
   clocks:
@@ -96,6 +97,7 @@ allOf:
         compatible:
           contains:
             enum:
+              - rockchip,rk3576-edp
               - rockchip,rk3588-edp
     then:
       properties:
Signature · 1 line
2.34.1
author
#13 lore raw

PATCH v8 7/10 arm64: dts: rockchip: Add eDP node for RK3576

In reply to Damon Ding

Add full device tree definition for the integrated eDP controller on RK3576, following the existing RK3588 hardware layout.

Configure required register range, clocks, interrupt, phy, power domain, reset and grf properties to fully describe the controller.

---

Changes in v2:
- Add Reviewed-by tag.

Changes in v4:
- Modify the commit msg.

---
 arch/arm64/boot/dts/rockchip/rk3576.dtsi | 28 ++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/rockchip/rk3576.dtsi +28 -0
index 28175d8200d5..733449cb88b1 100644
@@ -1496,6 +1496,34 @@ hdmi_out: port@1 {
 			};
 		};
 
+		edp: edp@27dc0000 {
+			compatible = "rockchip,rk3576-edp";
+			reg = <0x0 0x27dc0000 0x0 0x1000>;
+			clocks = <&cru CLK_EDP0_24M>, <&cru PCLK_EDP0>, <&cru HCLK_VO0_ROOT>;
+			clock-names = "dp", "pclk", "hclk";
+			interrupts = <GIC_SPI 365 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&hdptxphy>;
+			phy-names = "dp";
+			power-domains = <&power RK3576_PD_VO0>;
+			resets = <&cru SRST_EDP0_24M>, <&cru SRST_P_EDP0>;
+			reset-names = "dp", "apb";
+			rockchip,grf = <&vo0_grf>;
+			status = "disabled";
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				edp_in: port@0 {
+					reg = <0>;
+				};
+
+				edp_out: port@1 {
+					reg = <1>;
+				};
+			};
+		};
+
 		dp: dp@27e40000 {
 			compatible = "rockchip,rk3576-dp";
 			reg = <0x0 0x27e40000 0x0 0x30000>;
Signature · 1 line
2.34.1
author
#14 lore raw

PATCH v8 8/10 drm/bridge: analogix_dp: Rename and simplify is_rockchip()

In reply to Damon Ding

Rename inline helper is_rockchip() to analogix_dp_is_rockchip() to follow driver namespace convention consistently across code.

Replace chained equality comparisons with switch-case layout to improve readability and simplify adding new SoC entries later.

---

Changes in v3:
- Add Reviewed-by tag.

Changes in v4:
- Modify the commit msg.

---
 .../gpu/drm/bridge/analogix/analogix_dp_core.c |  2 +-
 .../gpu/drm/bridge/analogix/analogix_dp_reg.c  | 18 +++++++++---------
 include/drm/bridge/analogix_dp.h               | 11 +++++++++--
 3 files changed, 19 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +1 -1
index 573900c2cefc..c2fd5b978fc0 100644
@@ -870,7 +870,7 @@ static int analogix_dp_bridge_atomic_check(struct drm_bridge *bridge,
 	struct drm_display_info *di = &conn_state->connector->display_info;
 	u32 mask = BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444) | BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR422);
 
-	if (is_rockchip(dp->plat_data->dev_type)) {
+	if (analogix_dp_is_rockchip(dp->plat_data->dev_type)) {
 		if ((di->color_formats & mask)) {
 			DRM_DEBUG_KMS("Swapping display color format from YUV to RGB\n");
 			di->color_formats &= ~mask;
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +9 -9
index f84c1d48d671..ea8401293a23 100644
@@ -72,7 +72,7 @@ void analogix_dp_init_analog_param(struct analogix_dp_device *dp)
 	reg = SEL_24M | TX_DVDD_BIT_1_0625V;
 	writel(reg, dp->reg_base + ANALOGIX_DP_ANALOG_CTL_2);
 
-	if (dp->plat_data && is_rockchip(dp->plat_data->dev_type)) {
+	if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type)) {
 		reg = REF_CLK_24M;
 		if (dp->plat_data->dev_type == RK3288_DP)
 			reg ^= REF_CLK_MASK;
@@ -123,7 +123,7 @@ void analogix_dp_reset(struct analogix_dp_device *dp)
 	analogix_dp_stop_video(dp);
 	analogix_dp_enable_video_mute(dp, 0);
 
-	if (dp->plat_data && is_rockchip(dp->plat_data->dev_type))
+	if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type))
 		reg = RK_VID_CAP_FUNC_EN_N | RK_VID_FIFO_FUNC_EN_N |
 			SW_FUNC_EN_N;
 	else
@@ -233,7 +233,7 @@ void analogix_dp_set_pll_power_down(struct analogix_dp_device *dp, bool enable)
 	u32 mask = DP_PLL_PD;
 	u32 pd_addr = ANALOGIX_DP_PLL_CTL;
 
-	if (dp->plat_data && is_rockchip(dp->plat_data->dev_type)) {
+	if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type)) {
 		pd_addr = ANALOGIX_DP_PD;
 		mask = RK_PLL_PD;
 	}
@@ -254,12 +254,12 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp,
 	u32 phy_pd_addr = ANALOGIX_DP_PHY_PD;
 	u32 mask;
 
-	if (dp->plat_data && is_rockchip(dp->plat_data->dev_type))
+	if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type))
 		phy_pd_addr = ANALOGIX_DP_PD;
 
 	switch (block) {
 	case AUX_BLOCK:
-		if (dp->plat_data && is_rockchip(dp->plat_data->dev_type))
+		if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type))
 			mask = RK_AUX_PD;
 		else
 			mask = AUX_PD;
@@ -317,7 +317,7 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp,
 		 * to power off everything instead of DP_PHY_PD in
 		 * Rockchip
 		 */
-		if (dp->plat_data && is_rockchip(dp->plat_data->dev_type))
+		if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type))
 			mask = DP_INC_BG;
 		else
 			mask = DP_PHY_PD;
@@ -329,7 +329,7 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp,
 			reg &= ~mask;
 
 		writel(reg, dp->reg_base + phy_pd_addr);
-		if (dp->plat_data && is_rockchip(dp->plat_data->dev_type))
+		if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type))
 			usleep_range(10, 15);
 		break;
 	case POWER_ALL:
@@ -465,7 +465,7 @@ void analogix_dp_init_aux(struct analogix_dp_device *dp)
 	analogix_dp_reset_aux(dp);
 
 	/* AUX_BIT_PERIOD_EXPECTED_DELAY doesn't apply to Rockchip IP */
-	if (dp->plat_data && is_rockchip(dp->plat_data->dev_type))
+	if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type))
 		reg = 0;
 	else
 		reg = AUX_BIT_PERIOD_EXPECTED_DELAY(3);
@@ -837,7 +837,7 @@ void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp)
 	u32 reg;
 
 	reg = readl(dp->reg_base + ANALOGIX_DP_FUNC_EN_1);
-	if (dp->plat_data && is_rockchip(dp->plat_data->dev_type)) {
+	if (dp->plat_data && analogix_dp_is_rockchip(dp->plat_data->dev_type)) {
 		reg &= ~(RK_VID_CAP_FUNC_EN_N | RK_VID_FIFO_FUNC_EN_N);
 	} else {
 		reg &= ~(MASTER_VID_FUNC_EN_N | SLAVE_VID_FUNC_EN_N);
include/drm/bridge/analogix_dp.h +9 -2
index 854af692229b..7b670dd769e9 100644
@@ -19,9 +19,16 @@ enum analogix_dp_devtype {
 	RK3588_EDP,
 };
 
-static inline bool is_rockchip(enum analogix_dp_devtype type)
+static inline bool analogix_dp_is_rockchip(enum analogix_dp_devtype type)
 {
-	return type == RK3288_DP || type == RK3399_EDP || type == RK3588_EDP;
+	switch (type) {
+	case RK3288_DP:
+	case RK3399_EDP:
+	case RK3588_EDP:
+		return true;
+	default:
+		return false;
+	}
 }
 
 struct analogix_dp_plat_data {
Signature · 1 line
2.34.1
author
#15 lore raw

PATCH v8 9/10 drm/bridge: analogix_dp: Add support for RK3576

In reply to Damon Ding

Add RK3576_EDP device type entry and extend Rockchip check to match existing hardware capabilities shared with RK3588.

Set identical maximum link rate and lane count parameters for RK3576 eDP controller to reuse existing RK3588 config.

---

Changes in v3:
- Add Reviewed-by tag.

Changes in v4:
- Modify the commit msg.

---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 1 +
 include/drm/bridge/analogix_dp.h                   | 2 ++
 2 files changed, 3 insertions(+)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +1 -0
index c2fd5b978fc0..5dc07ff84cd3 100644
@@ -1249,6 +1249,7 @@ static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp)
 		video_info->max_link_rate = 0x0A;
 		video_info->max_lane_count = 0x04;
 		break;
+	case RK3576_EDP:
 	case RK3588_EDP:
 		video_info->max_link_rate = 0x14;
 		video_info->max_lane_count = 0x04;
include/drm/bridge/analogix_dp.h +2 -0
index 7b670dd769e9..0e0b87abee59 100644
@@ -16,6 +16,7 @@ enum analogix_dp_devtype {
 	EXYNOS_DP,
 	RK3288_DP,
 	RK3399_EDP,
+	RK3576_EDP,
 	RK3588_EDP,
 };
 
@@ -24,6 +25,7 @@ static inline bool analogix_dp_is_rockchip(enum analogix_dp_devtype type)
 	switch (type) {
 	case RK3288_DP:
 	case RK3399_EDP:
+	case RK3576_EDP:
 	case RK3588_EDP:
 		return true;
 	default:
Signature · 1 line
2.34.1
author
#16 lore raw

PATCH v8 10/10 drm/rockchip: analogix_dp: Add support for RK3576

In reply to Damon Ding

RK3576 integrates Analogix eDP 1.3 TX and Samsung combo PHY hardware blocks that fully match the proven RK3588 design.

Add dedicated chip data table and device tree matching entry to bring up basic eDP functionality for the RK3576 platform.

Support is limited to RGB output up to 4K@60Hz for now; audio, PSR and other advanced eDP 1.3 features remain unvalidated.

---

Changes in v2:
- Split out a separate patch to enable the "hclk" clock.
- Add Reviewed-by tag.

Changes in v3:
- Add Reviewed-by tag.

Changes in v4:
- Modify the commit msg.

---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +9 -0
index d2af5eb29dbb..d4c5dd61e95b 100644
@@ -522,6 +522,14 @@ static const struct rockchip_dp_chip_data rk3288_dp[] = {
 	{ /* sentinel */ }
 };
 
+static const struct rockchip_dp_chip_data rk3576_edp[] = {
+	{
+		.chip_type = RK3576_EDP,
+		.reg = 0x27dc0000,
+	},
+	{ /* sentinel */ }
+};
+
 static const struct rockchip_dp_chip_data rk3588_edp[] = {
 	{
 		.edp_mode = GRF_REG_FIELD(0x0000, 0, 0),
@@ -539,6 +547,7 @@ static const struct rockchip_dp_chip_data rk3588_edp[] = {
 static const struct of_device_id rockchip_dp_dt_ids[] = {
 	{.compatible = "rockchip,rk3288-dp", .data = &rk3288_dp },
 	{.compatible = "rockchip,rk3399-edp", .data = &rk3399_edp },
+	{.compatible = "rockchip,rk3576-edp", .data = &rk3576_edp },
 	{.compatible = "rockchip,rk3588-edp", .data = &rk3588_edp },
 	{}
 };
Signature · 1 line
2.34.1
#17 lore raw

Re: [PATCH v8 10/10] drm/rockchip: analogix_dp: Add support for RK3576

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] The rk3576_edp chip data table omits .edp_mode GRF register field initialization, which may prevent the combo PHY from being properly configured.

Pre-existing issues:
- [Critical] A sprintf call formats a potentially long device node path into a fixed 32-byte stack buffer name, causing a stack overflow vulnerability. --

commit d5d21d53d47c2f7f634710afc76442e39aeaf0f8
Author: Damon Ding <[email protected]>

drm/rockchip: analogix_dp: Add support for RK3576

This commit adds dedicated chip data and a device tree matching entry to bring up basic eDP functionality for the RK3576 platform. It notes that the hardware blocks fully match the proven RK3588 design.

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static const struct rockchip_dp_chip_data rk3288_dp[] = { · line 528

Quoted 12 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +4 -0
index d2af5eb29dbb5..d4c5dd61e95bb 100644
@@ -522,6 +522,14 @@ static const struct rockchip_dp_chip_data rk3288_dp[] = {
 	{ /* sentinel */ }
 };
 
+static const struct rockchip_dp_chip_data rk3576_edp[] = {
+	{
+		.chip_type = RK3576_EDP,
+		.reg = 0x27dc0000,

[Severity: High]
Does this missing .edp_mode initialization prevent the combo PHY from being properly configured?

The commit message states that the RK3576 hardware blocks fully match the RK3588 design. However, the RK3588 implementation uses .edp_mode to configure the combo PHY via GRF when powering on the DP controller.

Because .edp_mode is left uninitialized here, when rockchip_dp_poweron() calls rockchip_grf_field_write(), it will silently return 0 since .valid is false, skipping the GRF configuration entirely.

[ ... ]

This isn't a bug introduced by this patch, but while reviewing this file I noticed a pre-existing issue in rockchip_dp_drm_encoder_enable():

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:rockchip_dp_drm_encoder_enable() {
    char name[32];
    ...
    if (remote_port_parent) {
        if (of_get_child_by_name(remote_port_parent, "ports")) {
            ...
            sprintf(name, "%s vp%d", remote_port_parent->full_name, port_id);
    ...
}

[Severity: Critical]
Since remote_port_parent->full_name points to the device tree node's full name (which can exceed 32 characters), can this unbounded string write overflow the 32-byte name buffer on the stack?

Additionally, it appears the name variable is never actually used for anything after being formatted, meaning this vulnerability exists purely in dead logic.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10