Add eDP lane mapping support
Subsystems (6)
v2 cover Add eDP lane mapping support
This series adds configurable eDP/DP physical lane mapping support via device tree data-lanes property.
Lane mapping is mainly used for below scenarios:
1. Correct PCB lane swap and differential line routing crossover without hardware changes;
2. Adapt mismatched lane pin definitions between SoC and eDP panel;
3. Support multiple panel hardware variants on the same board by configuring data-lanes in device tree only.
The series includes driver implementation and device tree binding updates to support custom lane mapping configuration from endpoint node, and keeps default linear lane order if no configuration is given.
Patch 1: Add endpoint data-lanes property to analogix-dp binding Patch 2: Add data-lanes property example in rockchip analogix-dp binding Patch 3: Implement lane mapping in analogix_dp driver
Damon Ding (3):
dt-bindings: display: bridge: analogix-dp: Add data-lanes support for
endpoint
dt-bindings: rockchip: analogix-dp: Add data-lanes example drm/bridge: analogix_dp: Add support for optional data-lanes mapping
.../bindings/display/bridge/analogix,dp.yaml | 17 ++++-- .../rockchip/rockchip,analogix-dp.yaml | 1 + .../drm/bridge/analogix/analogix_dp_core.c | 56 +++++++++++++++++++ .../drm/bridge/analogix/analogix_dp_core.h | 4 +- .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 15 +++-- .../gpu/drm/bridge/analogix/analogix_dp_reg.h | 4 ++ 6 files changed, 83 insertions(+), 14 deletions(-)
---
Changes in v2:
- Add lane mapping application scenarios in commit message.
- Remove redundant deprecated property 'data-lanes' for eDP node.
- Update port@1 $ref to /schemas/graph.yaml#/$defs/port-base.
Signature · 1 line
2.34.1
PATCH v2 1/3 dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint
Add data-lanes property support to the port@1 endpoint for physical lane mapping configuration.
Lane mapping is mainly used for below scenarios:
1. Correct PCB lane swap and differential line routing crossover without hardware changes;
2. Adapt mismatched lane pin definitions between SoC and eDP panel;
3. Support multiple panel hardware variants on the same board by configuring data-lanes in device tree only.
---
Changes in v2:
- Add lane mapping application scenarios in commit message.
- Remove redundant deprecated property 'data-lanes' for eDP node.
- Update port@1 $ref to /schemas/graph.yaml#/$defs/port-base.
--- .../bindings/display/bridge/analogix,dp.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml +12 -5
@@ -42,13 +42,20 @@ properties: properties: port@0: $ref: /schemas/graph.yaml#/properties/port - description: - Input node to receive pixel data. + description: Input node to receive pixel data. port@1: - $ref: /schemas/graph.yaml#/properties/port - description: - Port node with one endpoint connected to a dp-connector node. + $ref: /schemas/graph.yaml#/$defs/port-base + description: Port node with one endpoint connected to sink device node. + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + properties: + data-lanes: + minItems: 1 + maxItems: 4 + items: + enum: [ 0, 1, 2, 3 ] required: - port@0
Signature · 7 lines
2.34.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
[email protected]
AI reviewRe: [PATCH v2 1/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Missing `unevaluatedProperties: false` on `port@1` and `endpoint` nodes leads to leaky schema…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing unevaluatedProperties: false on port@1 and endpoint nodes leads to leaky schema validation. --
commit 707c36bedcf3fbf40724e79e4e941f57ce9d5a3a
Author: Damon Ding <[email protected]>
dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint
This commit adds data-lanes property support to the port@1 endpoint for physical lane mapping configuration to handle PCB lane swaps and mismatched pin definitions.
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml +0
-0
[ ... ]
Quoted 5 lines
port@1:Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml +1
-3- $ref: /schemas/graph.yaml#/properties/port - description: - Port node with one endpoint connected to a dp-connector node. + $ref: /schemas/graph.yaml#/$defs/port-base
Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml properties: · line 58
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml +10
-0+ description: Port node with one endpoint connected to sink device node. + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + properties: + data-lanes: + minItems: 1 + maxItems: 4 + items: + enum: [ 0, 1, 2, 3 ]
[Severity: Medium]
Does this change allow undocumented properties or typos to silently pass schema validation?
By replacing /schemas/graph.yaml#/properties/port with the open /schemas/graph.yaml#/$defs/port-base, custom properties can be added. However, since unevaluatedProperties: false is missing on both the port@1 and endpoint nodes, the schema validation becomes leaky.
Would it be better to add unevaluatedProperties: false to these nodes so that property typos (like data-lane = <1 2 3 4>) are correctly flagged as errors during dt_binding_check?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH v2 1/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint
In reply to Damon DingQuoted 11 lines · Damon Ding
Add data-lanes property support to the port@1 endpoint for physical lane mapping configuration.
Lane mapping is mainly used for below scenarios:
1. Correct PCB lane swap and differential line routing crossover without hardware changes;
2. Adapt mismatched lane pin definitions between SoC and eDP panel;
3. Support multiple panel hardware variants on the same board by configuring data-lanes in device tree only.Signed-off-by Damon Ding <[email protected]>
Sashiko complaint here looks valid.
pw-bot: changes-requested
Thanks,
Conor.
Quoted 44 lines
---
Changes in v2:
- Add lane mapping application scenarios in commit message.
- Remove redundant deprecated property 'data-lanes' for eDP node.
- Update port@1 $ref to /schemas/graph.yaml#/$defs/port-base.--- .../bindings/display/bridge/analogix,dp.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml +12
-5@@ -42,13 +42,20 @@ properties: properties: port@0: $ref: /schemas/graph.yaml#/properties/port - description: - Input node to receive pixel data. + description: Input node to receive pixel data. port@1: - $ref: /schemas/graph.yaml#/properties/port - description: - Port node with one endpoint connected to a dp-connector node. + $ref: /schemas/graph.yaml#/$defs/port-base + description: Port node with one endpoint connected to sink device node. + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + properties: + data-lanes: + minItems: 1 + maxItems: 4 + items: + enum: [ 0, 1, 2, 3 ] required: - port@0Signature · 1 line
2.34.1
Re: [PATCH v2 1/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint
Quoted 11 lines · Conor Dooley
Quoted 10 lines · Damon Ding
Add data-lanes property support to the port@1 endpoint for physical lane mapping configuration.
Lane mapping is mainly used for below scenarios:
1. Correct PCB lane swap and differential line routing crossoverwithout hardware changes;2. Adapt mismatched lane pin definitions between SoC and eDP panel;
3. Support multiple panel hardware variants on the same board by configuring data-lanes in device tree only.
Quoted 5 lines
Quoted 1 line
Signed-off-by Damon Ding <[email protected]>Sashiko complaint here looks valid.
pw-bot: changes-requested
Yes, unevaluatedProperties: false should be added to both the port@1 and endpoint nodes.
Will fix in v3.
Best regards,
Damon
Quoted 45 lines
Quoted 45 lines
---
Changes in v2:
- Add lane mapping application scenarios in commit message.
- Remove redundant deprecated property 'data-lanes' for eDP node.
- Update port@1 $ref to /schemas/graph.yaml#/$defs/port-base.--- .../bindings/display/bridge/analogix,dp.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml +12
-5@@ -42,13 +42,20 @@ properties: properties: port@0: $ref: /schemas/graph.yaml#/properties/port - description: - Input node to receive pixel data. + description: Input node to receive pixel data. port@1: - $ref: /schemas/graph.yaml#/properties/port - description: - Port node with one endpoint connected to a dp-connector node. + $ref: /schemas/graph.yaml#/$defs/port-base + description: Port node with one endpoint connected to sink device node. + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + properties: + data-lanes: + minItems: 1 + maxItems: 4 + items: + enum: [ 0, 1, 2, 3 ] required: - port@0Signature · 1 line
2.34.1
PATCH v2 2/3 dt-bindings: rockchip: analogix-dp: Add data-lanes example
In reply to Damon DingAdd data-lanes setting in endpoint example to show actual lane mapping usage.
--- .../bindings/display/rockchip/rockchip,analogix-dp.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +1 -0
@@ -151,6 +151,7 @@ examples: reg = <1>; edp_out_panel: endpoint { + data-lanes = <0 1>; remote-endpoint = <&panel_in_edp>; }; };
Signature · 1 line
2.34.1
Re: [PATCH v2 2/3] dt-bindings: rockchip: analogix-dp: Add data-lanes example
Quoted 4 lines · Damon Ding
Add data-lanes setting in endpoint example to show actual lane mapping usage.
Signed-off-by Damon Ding <[email protected]>
Squash this with patch 1.
pw-bot: changes-requested
Thanks,
Conor.
Quoted 19 lines
--- .../bindings/display/rockchip/rockchip,analogix-dp.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +1
-0@@ -151,6 +151,7 @@ examples: reg = <1>; edp_out_panel: endpoint { + data-lanes = <0 1>; remote-endpoint = <&panel_in_edp>; }; };Signature · 1 line
2.34.1
Re: [PATCH v2 2/3] dt-bindings: rockchip: analogix-dp: Add data-lanes example
Quoted 9 lines · Conor Dooley
Quoted 4 lines · Damon Ding
Add data-lanes setting in endpoint example to show actual lane mapping usage.
Signed-off-by Damon Ding <[email protected]>Squash this with patch 1.
pw-bot: changes-requested
Yes, will fix in v3
Best regards,
Damon
Quoted 20 lines
Quoted 20 lines
--- .../bindings/display/rockchip/rockchip,analogix-dp.yaml | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +1
-0@@ -151,6 +151,7 @@ examples: reg = <1>; edp_out_panel: endpoint { + data-lanes = <0 1>; remote-endpoint = <&panel_in_edp>; }; };Signature · 1 line
2.34.1
PATCH v2 3/3 drm/bridge: analogix_dp: Add support for optional data-lanes mapping
In reply to Damon DingParse the optional 'data-lanes' device tree property to support custom physical lane mapping configuration.
If no valid configuration is found, fall back to the default lane map (0, 1, 2, 3) automatically and keep the driver running.
Lane mapping is mainly used for below scenarios:
1. Correct PCB lane swap and differential line routing crossover without hardware changes;
2. Adapt mismatched lane pin definitions between SoC and eDP panel;
3. Support multiple panel hardware variants on the same board by configuring data-lanes in device tree only.
---
Changes in v2:
- Add lane mapping application scenarios in commit message.
--- .../drm/bridge/analogix/analogix_dp_core.c | 56 +++++++++++++++++++ .../drm/bridge/analogix/analogix_dp_core.h | 4 +- .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 15 +++-- .../gpu/drm/bridge/analogix/analogix_dp_reg.h | 4 ++ 4 files changed, 70 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +56 -0
@@ -1234,6 +1234,59 @@ static const struct drm_bridge_funcs analogix_dp_bridge_funcs = { .detect = analogix_dp_bridge_detect, }; +static int analogix_dp_dt_parse_lanes_map (struct analogix_dp_device *dp) +{ +struct video_info *video_info = &dp->video_info; +struct device_node *endpoint; +u32 tmp[LANE_COUNT4 ]; +u32 map[LANE_COUNT4 ] = {0 ,1 ,2 ,3 }; +bool used[LANE_COUNT4 ] = {false}; +int num_lanes; +int ret, i; + +memcpy (video_info->lane_map, map,sizeof (map)); + + num_lanes =drm_of_get_data_lanes_count_ep (dp->dev->of_node,1 ,0 ,1 , + video_info->max_lane_count); +if (num_lanes <0 ) +return -EINVAL ; + + endpoint =of_graph_get_endpoint_by_regs (dp->dev->of_node,1 ,-1 ); +if (!endpoint) +return -EINVAL ; + + ret =of_property_read_u32_array (endpoint,"data-lanes" , tmp, num_lanes); +of_node_put (endpoint); +if (ret) +return -EINVAL ; + +for (i =0 ; i < num_lanes; i++) { +if (tmp[i] >=LANE_COUNT4 ) { +dev_dbg (dp->dev,"data-lanes[%d] = %u is out of range\n" , i, tmp[i]); +return -EINVAL ; + } + +if (used[tmp[i]]) { +dev_dbg (dp->dev,"data-lanes[%d] = %u is duplicate\n" , i, tmp[i]); +return -EINVAL ; + } + + used[tmp[i]] = true; + map[i] = tmp[i]; + } + +for (i =0 ; i <LANE_COUNT4 && num_lanes <LANE_COUNT4 ; i++) { +if (!used[i]) + map[num_lanes++] = i; + } + +dev_dbg (dp->dev,"Using parsed lane map: <%u %u %u %u>\n" , map[0 ], map[1 ], map[2 ], map[3 ]); + +memcpy (video_info->lane_map, map,sizeof (map)); + +return 0 ; +} +static int analogix_dp_dt_parse_pdata (struct analogix_dp_device *dp) {struct device_node *dp_node = dp->dev->of_node;
@@ -1266,6 +1319,9 @@ static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp)break ; } +if (analogix_dp_dt_parse_lanes_map (dp)) +dev_dbg (dp->dev,"No valid data-lanes found, using default lane map\n" ); +return 0 ; }
drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +3 -1
@@ -137,6 +137,8 @@ struct video_info {int max_link_rate;enum link_lane_count_type max_lane_count; + +u32 lane_map[LANE_COUNT4 ]; };struct link_train {
@@ -175,7 +177,7 @@ struct analogix_dp_device {/* analogix_dp_reg.c */ void analogix_dp_enable_video_mute (struct analogix_dp_device *dp,bool enable);void analogix_dp_stop_video (struct analogix_dp_device *dp); -void analogix_dp_lane_swap (struct analogix_dp_device *dp,bool enable); +void analogix_dp_lane_mapping (struct analogix_dp_device *dp);void analogix_dp_init_analog_param (struct analogix_dp_device *dp);void analogix_dp_init_interrupt (struct analogix_dp_device *dp);void analogix_dp_reset (struct analogix_dp_device *dp);
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +7 -8
@@ -48,16 +48,15 @@ void analogix_dp_stop_video(struct analogix_dp_device *dp)writel (reg, dp->reg_base +ANALOGIX_DP_VIDEO_CTL_1 ); } -void analogix_dp_lane_swap (struct analogix_dp_device *dp,bool enable) +void analogix_dp_lane_mapping (struct analogix_dp_device *dp) { +u32 *lane_map = dp->video_info.lane_map;u32 reg; -if (enable) - reg =LANE3_MAP_LOGIC_LANE_0 |LANE2_MAP_LOGIC_LANE_1 | -LANE1_MAP_LOGIC_LANE_2 |LANE0_MAP_LOGIC_LANE_3 ; -else - reg =LANE3_MAP_LOGIC_LANE_3 |LANE2_MAP_LOGIC_LANE_2 | -LANE1_MAP_LOGIC_LANE_1 |LANE0_MAP_LOGIC_LANE_0 ; + reg = lane_map[0 ] <<LANE0_MAP_SHIFT ; + reg |= lane_map[1 ] <<LANE1_MAP_SHIFT ; + reg |= lane_map[2 ] <<LANE2_MAP_SHIFT ; + reg |= lane_map[3 ] <<LANE3_MAP_SHIFT ;writel (reg, dp->reg_base +ANALOGIX_DP_LANE_MAP ); }
@@ -140,7 +139,7 @@ void analogix_dp_reset(struct analogix_dp_device *dp)usleep_range (20 ,30 ); -analogix_dp_lane_swap (dp,0 ); +analogix_dp_lane_mapping (dp);writel (0x0 , dp->reg_base +ANALOGIX_DP_SYS_CTL_1 );writel (0x40 , dp->reg_base +ANALOGIX_DP_SYS_CTL_2 );
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h +4 -0
@@ -209,6 +209,10 @@#define LANE0_MAP_LOGIC_LANE_1 (0x1 << 0)#define LANE0_MAP_LOGIC_LANE_2 (0x2 << 0)#define LANE0_MAP_LOGIC_LANE_3 (0x3 << 0) +#define LANE3_MAP_SHIFT (6) +#define LANE2_MAP_SHIFT (4) +#define LANE1_MAP_SHIFT (2) +#define LANE0_MAP_SHIFT (0)/* ANALOGIX_DP_ANALOG_CTL_1 */ #define TX_TERMINAL_CTRL_50_OHM (0x1 << 4)
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v2 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] Incorrect logical-to-physical lane mapping causes inverted mapping in ANALOGIX_DP_LANE_MAP.…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Incorrect logical-to-physical lane mapping causes inverted mapping in ANALOGIX_DP_LANE_MAP.
- [High] Potential stack buffer overflow when parsing data-lanes if max_lane_count exceeds 4.
- [High] Custom lane mapping is not applied to the PHY configuration during link training.
- [Medium] Inconsistent endpoint reg matching between lane counting and endpoint fetching. --
commit 85a24e4079e66f4ed5dd4c98ce61e660ea4f5de4
Author: Damon Ding <[email protected]>
drm/bridge: analogix_dp: Add support for optional data-lanes mapping
Parse the optional 'data-lanes' device tree property to support custom physical lane mapping configuration. If no valid configuration is found, fall back to the default lane map (0, 1, 2, 3) automatically and keep the driver running.
Quoted 12 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +4
-0@@ -1234,6 +1234,59 @@ static const struct drm_bridge_funcs analogix_dp_bridge_funcs = { .detect = analogix_dp_bridge_detect, }; +static int analogix_dp_dt_parse_lanes_map (struct analogix_dp_device *dp) +{ +struct video_info *video_info = &dp->video_info; +struct device_node *endpoint;
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c static const struct drm_bridge_funcs analogix_dp_bridge_funcs = { · line 1250
Quoted 10 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +10
-0+u32 tmp[LANE_COUNT4 ]; +u32 map[LANE_COUNT4 ] = {0 ,1 ,2 ,3 }; +bool used[LANE_COUNT4 ] = {false}; +int num_lanes; +int ret, i; + +memcpy (video_info->lane_map, map,sizeof (map)); + + num_lanes =drm_of_get_data_lanes_count_ep (dp->dev->of_node,1 ,0 ,1 , + video_info->max_lane_count);
[Severity: High]
Can this cause a stack buffer overflow if max_lane_count exceeds 4?
On Exynos platforms, max_lane_count is read directly from the samsung,lane-count device tree property without validation. If a misconfigured device tree specifies a lane-count greater than 4, drm_of_get_data_lanes_count_ep() will return a num_lanes value up to that maximum.
Will the subsequent call to of_property_read_u32_array() then write past the end of the tmp array?
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c static const struct drm_bridge_funcs analogix_dp_bridge_funcs = { · line 1254
Quoted 4 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +4
-0+if (num_lanes <0 ) +return -EINVAL ; + + endpoint =of_graph_get_endpoint_by_regs (dp->dev->of_node,1 ,-1 );
[Severity: Medium]
Are we matching inconsistent endpoints here?
The earlier call to drm_of_get_data_lanes_count_ep() hardcodes reg = 0 to search for endpoint@0. However, this lookup via of_graph_get_endpoint_by_regs() uses reg = -1, which fetches the first endpoint under port 1 regardless of its address.
If the device tree defines multiple endpoints, could the driver count the lanes in endpoint@0 but then mistakenly read the data-lanes array from a different endpoint?
Quoted 5 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +5
-0+if (!endpoint) +return -EINVAL ; + + ret =of_property_read_u32_array (endpoint,"data-lanes" , tmp, num_lanes); +of_node_put (endpoint);
[ ... ]
drivers/gpu/drm/bridge/analogix/analogix_dp_core.h struct video_info { · line 142
Quoted 11 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +2
-0@@ -137,6 +137,8 @@ struct video_info {int max_link_rate;enum link_lane_count_type max_lane_count; + +u32 lane_map[LANE_COUNT4 ]; };
[Severity: High]
Is the custom lane mapping applied to the PHY configuration during link training?
During link training, the driver extracts voltage swing and pre-emphasis values per logical lane and assigns them directly to the PHY.
Because the DP MAC routes logical lanes to different physical lanes via the custom mapping, do the analog adjustments need to be applied to the corresponding mapped physical lanes to avoid breaking link training on boards utilizing lane mapping?
[ ... ]
Quoted 14 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +2
-1@@ -48,16 +48,15 @@ void analogix_dp_stop_video(struct analogix_dp_device *dp)writel (reg, dp->reg_base +ANALOGIX_DP_VIDEO_CTL_1 ); } -void analogix_dp_lane_swap (struct analogix_dp_device *dp,bool enable) +void analogix_dp_lane_mapping (struct analogix_dp_device *dp) { +u32 *lane_map = dp->video_info.lane_map;u32 reg;
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c void analogix_dp_stop_video(struct analogix_dp_device *dp) · line 59
Quoted 10 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +4
-6-if (enable) - reg =LANE3_MAP_LOGIC_LANE_0 |LANE2_MAP_LOGIC_LANE_1 | -LANE1_MAP_LOGIC_LANE_2 |LANE0_MAP_LOGIC_LANE_3 ; -else - reg =LANE3_MAP_LOGIC_LANE_3 |LANE2_MAP_LOGIC_LANE_2 | -LANE1_MAP_LOGIC_LANE_1 |LANE0_MAP_LOGIC_LANE_0 ; + reg = lane_map[0 ] <<LANE0_MAP_SHIFT ; + reg |= lane_map[1 ] <<LANE1_MAP_SHIFT ; + reg |= lane_map[2 ] <<LANE2_MAP_SHIFT ; + reg |= lane_map[3 ] <<LANE3_MAP_SHIFT ;
[Severity: High]
Does this write the physical lane index into the logical lane bit-field instead of the other way around?
The ANALOGIX_DP_LANE_MAP hardware register expects the logic lane number to be written into the bit-field dedicated to the physical lane. The current bitwise shift writes the physical lane index into the bit-field for the logical lane.
For symmetric permutations like <3 2 1 0> this might work by coincidence, but could this result in an inverted mapping for non-symmetric permutations (e.g., <1 2 3 0>), causing link training and display output to fail?
Quoted 3 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +0
-0writel (reg, dp->reg_base +ANALOGIX_DP_LANE_MAP ); }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3