Skip to contentSkip to conversation

*** IT6505 driver read dt properties ***

PATCH Superseded allen 4 participants 8 messages Oct 6, 2022 – Oct 7, 2022

Subsystems (4)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

allen

author
#0 lore raw

v3 cover *** IT6505 driver read dt properties ***

From: allen chen <[email protected]>

This series let driver can read properties from dt to restrict dp output bandwidth.

Changes in v3:
-Rename property name.

allen chen (2):
dt-bindings: it6505: add properties to restrict output bandwidth drm/bridge: add it6505 driver to read data-lanes and
max-pixel-clock-mhz from dt

 .../bindings/display/bridge/ite,it6505.yaml   | 12 +++++++
 drivers/gpu/drm/bridge/ite-it6505.c           | 36 +++++++++++++++++--
 2 files changed, 45 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v3 1/2 dt-bindings: it6505: add properties to restrict output bandwidth

From: allen chen <[email protected]>

Add properties to restrict dp output data-lanes and clock.

---
 .../bindings/display/bridge/ite,it6505.yaml          | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +12 -0
index 833d11b2303a..f5482a614d05 100644
@@ -52,6 +52,16 @@ properties:
     maxItems: 1
     description: extcon specifier for the Power Delivery
 
+  ite,dp-output-data-lane-count:
+    description: restrict the dp output data-lanes with value of 1-4
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 1, 2, 4 ]
+
+  ite,dp-output-max-pixel-clock-mhz:
+    description: restrict max pixel clock
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 150
+
   port:
     $ref: /schemas/graph.yaml#/properties/port
     description: A port node pointing to DPI host port node
@@ -84,6 +94,8 @@ examples:
             pwr18-supply = <&it6505_pp18_reg>;
             reset-gpios = <&pio 179 1>;
             extcon = <&usbc_extcon>;
+            ite,dp-output-data-lane-count = <2>;
+            ite,dp-output-max-pixel-clock-mhz = <150>;
 
             port {
                 it6505_in: endpoint {
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v3 1/2] dt-bindings: it6505: add properties to restrict output bandwidth

Quoted 15 lines · allen

From: allen chen <[email protected]>

Add properties to restrict dp output data-lanes and clock.

---
 .../bindings/display/bridge/ite,it6505.yaml          | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +0 -0
index 833d11b2303a..f5482a614d05 100644

Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml properties: · line 56

Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +2 -0
@@ -52,6 +52,16 @@ properties:
     maxItems: 1
     description: extcon specifier for the Power Delivery
 
+  ite,dp-output-data-lane-count:
+    description: restrict the dp output data-lanes with value of 1-4

Drop "with value of 1-4" because it is redundant, but instead explain what this property is about. "Restrict output" is not yet enough. Restrict the number? Or choose specific lanes? Why it cannot be data-lanes from video-interfaces?

Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml properties: · line 60

Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +4 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 1, 2, 4 ]
+
+  ite,dp-output-max-pixel-clock-mhz:

Test your patches before sending.

Best regards,
Krzysztof

#3 lore raw

RE: [PATCH v3 1/2] dt-bindings: it6505: add properties to restrict output bandwidth

hi

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Thursday, October 6, 2022 4:17 PM
To: Allen Chen (陳柏宇) <[email protected]>
Cc: Jau-Chih Tseng (曾昭智) <[email protected]>; Kenneth Hung (洪家倫) <[email protected]>; Hermes Wu (吳佳宏) <[email protected]>; Pin-yen Lin <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>; open list:DRM DRIVERS <[email protected]>; open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS <[email protected]>; open list <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: it6505: add properties to restrict output bandwidth

Quoted 17 lines · allen

From: allen chen <[email protected]>

Add properties to restrict dp output data-lanes and clock.

---
 .../bindings/display/bridge/ite,it6505.yaml          | 12 ++++++++++++
 1 file changed, 12 insertions(+)
(quoted diff) +0 -0

a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml index 833d11b2303a..f5482a614d05 100644

Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml properties: · line 56

Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +2 -0
@@ -52,6 +52,16 @@ properties:
     maxItems: 1
     description: extcon specifier for the Power Delivery
 
+  ite,dp-output-data-lane-count:
+    description: restrict the dp output data-lanes with value of 1-4

Drop "with value of 1-4" because it is redundant, but instead explain what this property is about. "Restrict output" is not yet enough. Restrict the number? Or choose specific lanes? Why it cannot be data-lanes from video-interfaces?

==> DP output bandwidth depends on data-lane-count, so the number of output data-lane-count will restrict output bandwidth. In this dt-binding we don't have output endpoint, so use another property name to configure.
If need to use data-lanes, where can we put in this dt-binding?

Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml properties: · line 60

Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +4 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 1, 2, 4 ]
+
+  ite,dp-output-max-pixel-clock-mhz:

Test your patches before sending.

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH v3 1/2] dt-bindings: it6505: add properties to restrict output bandwidth

Quoted 36 lines · On 07/10/2022 05:18, [email protected] wrote:

hi

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Thursday, October 6, 2022 4:17 PM
To: Allen Chen (陳柏宇) <[email protected]>
Cc: Jau-Chih Tseng (曾昭智) <[email protected]>; Kenneth Hung (洪家倫) <[email protected]>; Hermes Wu (吳佳宏) <[email protected]>; Pin-yen Lin <[email protected]>; Andrzej Hajda <[email protected]>; Neil Armstrong <[email protected]>; Robert Foss <[email protected]>; Laurent Pinchart <[email protected]>; Jonas Karlman <[email protected]>; Jernej Skrabec <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>; open list:DRM DRIVERS <[email protected]>; open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS <[email protected]>; open list <[email protected]>
Subject: Re: [PATCH v3 1/2] dt-bindings: it6505: add properties to restrict output bandwidth

Quoted 17 lines · allen

From: allen chen <[email protected]>

Add properties to restrict dp output data-lanes and clock.

---
 .../bindings/display/bridge/ite,it6505.yaml          | 12 ++++++++++++
 1 file changed, 12 insertions(+)
(quoted diff) +0 -0

a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml index 833d11b2303a..f5482a614d05 100644

Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml properties: · line 56

Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +2 -0
@@ -52,6 +52,16 @@ properties:
     maxItems: 1
     description: extcon specifier for the Power Delivery
 
+  ite,dp-output-data-lane-count:
+    description: restrict the dp output data-lanes with value of 1-4

Drop "with value of 1-4" because it is redundant, but instead explain what this property is about. "Restrict output" is not yet enough. Restrict the number? Or choose specific lanes? Why it cannot be data-lanes from video-interfaces?

Quoted 3 lines

==> DP output bandwidth depends on data-lane-count, so the number of output data-lane-count will restrict output bandwidth. In this dt-binding we don't have output endpoint, so use another property name to configure.
If need to use data-lanes, where can we put in this dt-binding?

I see you got review in v2 to rename it, but it still should be the same property, if it has similar/same meaning. It can be put here. You just need to define its type or reference other schema (e.g. video-interfaces if applicable) which defines it.

Best regards,
Krzysztof

maintainer
#5 lore raw

Re: [PATCH v3 1/2] dt-bindings: it6505: add properties to restrict output bandwidth

In reply to allen
Quoted 10 lines · allen

From: allen chen <[email protected]>

Add properties to restrict dp output data-lanes and clock.

---
 .../bindings/display/bridge/ite,it6505.yaml          | 12 ++++++++++++
 1 file changed, 12 insertions(+)

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml: properties:ite,dp-output-max-pixel-clock-mhz: '$ref' should not be valid under {'const': '$ref'}
hint: Standard unit suffix properties don't need a type $ref
from schema $id: http://devicetree.org/meta-schemas/core.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

#6 lore raw

Re: [PATCH v3 1/2] dt-bindings: it6505: add properties to restrict output bandwidth

In reply to allen
Quoted 16 lines · allen

From: allen chen <[email protected]>

Add properties to restrict dp output data-lanes and clock.

---
 .../bindings/display/bridge/ite,it6505.yaml          | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +0 -0
index 833d11b2303a..f5482a614d05 100644

Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml properties: · line 58

Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +4 -0
@@ -52,6 +52,16 @@ properties:
     maxItems: 1
     description: extcon specifier for the Power Delivery
 
+  ite,dp-output-data-lane-count:
+    description: restrict the dp output data-lanes with value of 1-4
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [ 1, 2, 4 ]

We have a standard property for lanes: data-lanes

It goes in the endpoint.

Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml properties: · line 63

Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml +5 -0
+
+  ite,dp-output-max-pixel-clock-mhz:
+    description: restrict max pixel clock
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 150

Also have a common property for this: 'link-frequencies'

author
#7 lore raw

PATCH v3 2/2 drm/bridge: add it6505 driver to read data-lanes and max-pixel-clock-mhz from dt

In reply to allen

From: allen chen <[email protected]>

Add driver to read data-lanes and max-pixel-clock-mhz from dt property to restrict output bandwidth.

---
 drivers/gpu/drm/bridge/ite-it6505.c | 36 ++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +33 -3
index 2767b70fa2cb..eca9a2c296a8 100644
@@ -436,6 +436,8 @@ struct it6505 {
 	bool powered;
 	bool hpd_state;
 	u32 afe_setting;
+	u32 max_dpi_pixel_clock;
+	u32 max_lane_count;
 	enum hdcp_state hdcp_status;
 	struct delayed_work hdcp_work;
 	struct work_struct hdcp_wait_ksv_list;
@@ -1475,7 +1477,8 @@ static void it6505_parse_link_capabilities(struct it6505 *it6505)
 	it6505->lane_count = link->num_lanes;
 	DRM_DEV_DEBUG_DRIVER(dev, "Sink support %d lanes training",
 			     it6505->lane_count);
-	it6505->lane_count = min_t(int, it6505->lane_count, MAX_LANE_COUNT);
+	it6505->lane_count = min_t(int, it6505->lane_count,
+				   it6505->max_lane_count);
 
 	it6505->branch_device = drm_dp_is_branch(it6505->dpcd);
 	DRM_DEV_DEBUG_DRIVER(dev, "Sink %sbranch device",
@@ -2901,7 +2904,7 @@ it6505_bridge_mode_valid(struct drm_bridge *bridge,
 	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
 		return MODE_NO_INTERLACE;
 
-	if (mode->clock > DPI_PIXEL_CLK_MAX)
+	if (mode->clock > it6505->max_dpi_pixel_clock)
 		return MODE_CLOCK_HIGH;
 
 	it6505->video_info.clock = mode->clock;
@@ -3066,6 +3069,8 @@ static void it6505_parse_dt(struct it6505 *it6505)
 {
 	struct device *dev = &it6505->client->dev;
 	u32 *afe_setting = &it6505->afe_setting;
+	u32 *max_lane_count = &it6505->max_lane_count;
+	u32 *max_dpi_pixel_clock = &it6505->max_dpi_pixel_clock;
 
 	it6505->lane_swap_disabled =
 		device_property_read_bool(dev, "no-laneswap");
@@ -3081,7 +3086,32 @@ static void it6505_parse_dt(struct it6505 *it6505)
 	} else {
 		*afe_setting = 0;
 	}
-	DRM_DEV_DEBUG_DRIVER(dev, "using afe_setting: %d", *afe_setting);
+
+	if (device_property_read_u32(dev, "ite,dp-output-data-lane-count",
+				     max_lane_count) == 0) {
+		if (*max_lane_count > 4 || *max_lane_count == 3) {
+			dev_err(dev, "max lane count error, use default");
+			*max_lane_count = MAX_LANE_COUNT;
+		}
+	} else {
+		*max_lane_count = MAX_LANE_COUNT;
+	}
+
+	if (device_property_read_u32(dev, "ite,dp-output-max-pixel-clock-mhz",
+				     max_dpi_pixel_clock) == 0) {
+		*max_dpi_pixel_clock *= 1000;
+		if (*max_dpi_pixel_clock > 297000) {
+			dev_err(dev, "max pixel clock error, use default");
+			*max_dpi_pixel_clock = DPI_PIXEL_CLK_MAX;
+		}
+	} else {
+		*max_dpi_pixel_clock = DPI_PIXEL_CLK_MAX;
+	}
+
+	DRM_DEV_DEBUG_DRIVER(dev, "using afe_setting: %u, max_lane_count: %u",
+			     it6505->afe_setting, it6505->max_lane_count);
+	DRM_DEV_DEBUG_DRIVER(dev, "using max_dpi_pixel_clock: %u kHz",
+			     it6505->max_dpi_pixel_clock);
 }
 
 static ssize_t receive_timing_debugfs_show(struct file *file, char __user *buf,
Signature · 1 line
2.25.1