* [PATCH v1 0/3] Add eDP lane mapping support
@ 2026-05-14 7:01 Damon Ding
2026-05-14 7:01 ` [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties Damon Ding
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Damon Ding @ 2026-05-14 7:01 UTC (permalink / raw)
To: hjc, heiko, andy.yan, maarten.lankhorst, mripard, tzimmermann,
airlied, simona, robh, krzk+dt, conor+dt, andrzej.hajda,
neil.armstrong, rfoss
Cc: Laurent.pinchart, jonas, jernej.skrabec, nicolas.frattaroli,
cristian.ciocaltea, sebastian.reichel, dmitry.baryshkov,
luca.ceresoli, dianders, m.szyprowski, dri-devel, devicetree,
linux-arm-kernel, linux-rockchip, linux-kernel, Damon Ding
This patch series is followed by:
https://lore.kernel.org/all/20260513074414.2053435-1-damon.ding@rock-chips.com/
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: Supplement inherited properties for rockchip,analogix-dp schema
Patch 2: Add endpoint data-lanes property to analogix-dp binding
Patch 3: Implement lane mapping in analogix_dp driver
Damon Ding (3):
dt-bindings: display: rockchip: analogix-dp: Expose inherited
properties
dt-bindings: display: bridge: analogix-dp: Add data-lanes support for
endpoint
drm/bridge: analogix_dp: Add support for optional data-lanes mapping
.../bindings/display/bridge/analogix,dp.yaml | 24 ++++++--
.../rockchip/rockchip,analogix-dp.yaml | 7 +++
.../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, 97 insertions(+), 13 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties 2026-05-14 7:01 [PATCH v1 0/3] Add eDP lane mapping support Damon Ding @ 2026-05-14 7:01 ` Damon Ding 2026-05-14 16:20 ` sashiko-bot 2026-05-14 18:16 ` Conor Dooley 2026-05-14 7:01 ` [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint Damon Ding 2026-05-14 7:01 ` [PATCH v1 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping Damon Ding 2 siblings, 2 replies; 9+ messages in thread From: Damon Ding @ 2026-05-14 7:01 UTC (permalink / raw) To: hjc, heiko, andy.yan, maarten.lankhorst, mripard, tzimmermann, airlied, simona, robh, krzk+dt, conor+dt, andrzej.hajda, neil.armstrong, rfoss Cc: Laurent.pinchart, jonas, jernej.skrabec, nicolas.frattaroli, cristian.ciocaltea, sebastian.reichel, dmitry.baryshkov, luca.ceresoli, dianders, m.szyprowski, dri-devel, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, Damon Ding Expose the inherited properties from the base analogix-dp schema to satisfy unevaluatedProperties constraints. Signed-off-by: Damon Ding <damon.ding@rock-chips.com> --- .../bindings/display/rockchip/rockchip,analogix-dp.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml index bb75d898a5c5..896ded87880f 100644 --- a/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml @@ -50,6 +50,13 @@ properties: aux-bus: $ref: /schemas/display/dp-aux-bus.yaml# + reg: true + interrupts: true + phys: true + phy-names: true + force-hpd: true + ports: true + required: - compatible - clocks -- 2.34.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties 2026-05-14 7:01 ` [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties Damon Ding @ 2026-05-14 16:20 ` sashiko-bot 2026-05-14 18:16 ` Conor Dooley 1 sibling, 0 replies; 9+ messages in thread From: sashiko-bot @ 2026-05-14 16:20 UTC (permalink / raw) To: Damon Ding; +Cc: robh, conor+dt, devicetree, krzk+dt Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Redefining inherited properties as `true` is a redundant schema inheritance anti-pattern that weakens future validation. -- commit 6cdf876f78b231fc30c12abedc12fb6b25fa8e18 Author: Damon Ding <damon.ding@rock-chips.com> dt-bindings: display: rockchip: analogix-dp: Expose inherited properties The commit adds true values to several properties in the Rockchip Analogix DP binding schema. The commit message states this is necessary to expose inherited properties to satisfy unevaluatedProperties constraints. > diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml > index d99b23b88cc59..4118b87b8dc53 100644 > --- a/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml > +++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml > @@ -49,6 +49,13 @@ properties: > aux-bus: > $ref: /schemas/display/dp-aux-bus.yaml# > > + reg: true > + interrupts: true > + phys: true > + phy-names: true > + force-hpd: true > + ports: true > + Is it necessary to redefine these inherited properties to satisfy unevaluatedProperties constraints? The base schema analogix,dp.yaml already defines these properties. Properties evaluated by a $ref within an allOf block are automatically annotated as evaluated, which should satisfy the unevaluatedProperties: false constraint in the leaf schema. Could redefining these properties locally as true introduce a validation regression if the base schema changes in the future? Setting them to true translates to allowing any value without constraints. While the allOf intersection currently enforces the base schema's constraints, if the base schema is later refactored or removes one of these properties, this leaf schema might silently accept malformed device trees instead of failing validation. -- Sashiko AI review · https://sashiko.dev/#/patchset/20260514070133.2275069-1-damon.ding@rock-chips.com?part=1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties 2026-05-14 7:01 ` [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties Damon Ding 2026-05-14 16:20 ` sashiko-bot @ 2026-05-14 18:16 ` Conor Dooley 1 sibling, 0 replies; 9+ messages in thread From: Conor Dooley @ 2026-05-14 18:16 UTC (permalink / raw) To: Damon Ding Cc: hjc, heiko, andy.yan, maarten.lankhorst, mripard, tzimmermann, airlied, simona, robh, krzk+dt, conor+dt, andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas, jernej.skrabec, nicolas.frattaroli, cristian.ciocaltea, sebastian.reichel, dmitry.baryshkov, luca.ceresoli, dianders, m.szyprowski, dri-devel, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1143 bytes --] On Thu, May 14, 2026 at 03:01:31PM +0800, Damon Ding wrote: > Expose the inherited properties from the base analogix-dp schema > to satisfy unevaluatedProperties constraints. > > Signed-off-by: Damon Ding <damon.ding@rock-chips.com> Given it's unevaluatedProperties, not addtionalProperties, this patch shouldn't be needed? > --- > .../bindings/display/rockchip/rockchip,analogix-dp.yaml | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml > index bb75d898a5c5..896ded87880f 100644 > --- a/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml > +++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml > @@ -50,6 +50,13 @@ properties: > aux-bus: > $ref: /schemas/display/dp-aux-bus.yaml# > > + reg: true > + interrupts: true > + phys: true > + phy-names: true > + force-hpd: true > + ports: true > + > required: > - compatible > - clocks > -- > 2.34.1 > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint 2026-05-14 7:01 [PATCH v1 0/3] Add eDP lane mapping support Damon Ding 2026-05-14 7:01 ` [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties Damon Ding @ 2026-05-14 7:01 ` Damon Ding 2026-05-14 16:58 ` sashiko-bot 2026-05-14 18:19 ` Conor Dooley 2026-05-14 7:01 ` [PATCH v1 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping Damon Ding 2 siblings, 2 replies; 9+ messages in thread From: Damon Ding @ 2026-05-14 7:01 UTC (permalink / raw) To: hjc, heiko, andy.yan, maarten.lankhorst, mripard, tzimmermann, airlied, simona, robh, krzk+dt, conor+dt, andrzej.hajda, neil.armstrong, rfoss Cc: Laurent.pinchart, jonas, jernej.skrabec, nicolas.frattaroli, cristian.ciocaltea, sebastian.reichel, dmitry.baryshkov, luca.ceresoli, dianders, m.szyprowski, dri-devel, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, Damon Ding Add data-lanes property support to the port@1 endpoint for physical lane mapping configuration. Signed-off-by: Damon Ding <damon.ding@rock-chips.com> --- .../bindings/display/bridge/analogix,dp.yaml | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml index 62f0521b0924..a82f9b7776c0 100644 --- a/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml +++ b/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml @@ -36,19 +36,35 @@ properties: Hotplug detect GPIO. Indicates which GPIO should be used for hotplug detection + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + deprecated: true + minItems: 1 + maxItems: 4 + items: + maximum: 3 + ports: $ref: /schemas/graph.yaml#/properties/ports 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. + description: Port node with one endpoint connected to sink device node. + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + properties: + data-lanes: + minItems: 1 + maxItems: 4 + items: + enum: [ 0, 1, 2, 3 ] required: - port@0 -- 2.34.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint 2026-05-14 7:01 ` [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint Damon Ding @ 2026-05-14 16:58 ` sashiko-bot 2026-05-14 18:19 ` Conor Dooley 1 sibling, 0 replies; 9+ messages in thread From: sashiko-bot @ 2026-05-14 16:58 UTC (permalink / raw) To: Damon Ding; +Cc: krzk+dt, robh, devicetree, conor+dt Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The patch silently adds a deprecated top-level `data-lanes` property that is completely irrelevant to the analogix-dp binding. - [Low] Inconsistent validation constraints for the `data-lanes` arrays. -- commit f1eb1174d9c0a3dbfb4324c331483cad76c51c68 Author: Damon Ding <damon.ding@rock-chips.com> 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 in the analogix-dp device tree binding. > diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml > index 62f0521b09245..a82f9b7776c0a 100644 > --- a/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml > +++ b/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml > @@ -36,19 +36,35 @@ properties: > Hotplug detect GPIO. > Indicates which GPIO should be used for hotplug detection > > + data-lanes: > + $ref: /schemas/types.yaml#/definitions/uint32-array > + deprecated: true > + minItems: 1 > + maxItems: 4 > + items: > + maximum: 3 The commit message states that data-lanes support is being added to the port@1 endpoint, but this adds a top-level data-lanes property marked as deprecated. Is this top-level property addition intended? Looking at the analogix-dp driver history and earlier analogix_dp.txt bindings, a root-level data-lanes property does not appear to have been supported previously. Does this remnant come from another binding that was accidentally copied? Leaving it here might pollute the schema and allow invalid device trees to pass validation with just a deprecation warning instead of an error. [ ... ] > port@1: > $ref: /schemas/graph.yaml#/properties/port > - description: > - Port node with one endpoint connected to a dp-connector node. > + description: Port node with one endpoint connected to sink device node. > + properties: > + endpoint: > + $ref: /schemas/media/video-interfaces.yaml# > + unevaluatedProperties: false > + properties: > + data-lanes: > + minItems: 1 > + maxItems: 4 > + items: > + enum: [ 0, 1, 2, 3 ] This isn't a bug, but the valid items here are restricted using an enum, whereas the top-level property uses a maximum constraint. If the top-level property is removed as suggested above this inconsistency will naturally be resolved, but it is worth pointing out in case both properties are kept. > > required: > - port@0 -- Sashiko AI review · https://sashiko.dev/#/patchset/20260514070133.2275069-1-damon.ding@rock-chips.com?part=2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint 2026-05-14 7:01 ` [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint Damon Ding 2026-05-14 16:58 ` sashiko-bot @ 2026-05-14 18:19 ` Conor Dooley 1 sibling, 0 replies; 9+ messages in thread From: Conor Dooley @ 2026-05-14 18:19 UTC (permalink / raw) To: Damon Ding Cc: hjc, heiko, andy.yan, maarten.lankhorst, mripard, tzimmermann, airlied, simona, robh, krzk+dt, conor+dt, andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas, jernej.skrabec, nicolas.frattaroli, cristian.ciocaltea, sebastian.reichel, dmitry.baryshkov, luca.ceresoli, dianders, m.szyprowski, dri-devel, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel [-- Attachment #1: Type: text/plain, Size: 2216 bytes --] On Thu, May 14, 2026 at 03:01:32PM +0800, Damon Ding wrote: > Add data-lanes property support to the port@1 endpoint for physical > lane mapping configuration. > > Signed-off-by: Damon Ding <damon.ding@rock-chips.com> > --- > .../bindings/display/bridge/analogix,dp.yaml | 24 +++++++++++++++---- > 1 file changed, 20 insertions(+), 4 deletions(-) > > diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml > index 62f0521b0924..a82f9b7776c0 100644 > --- a/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml > +++ b/Documentation/devicetree/bindings/display/bridge/analogix,dp.yaml > @@ -36,19 +36,35 @@ properties: > Hotplug detect GPIO. > Indicates which GPIO should be used for hotplug detection > > + data-lanes: > + $ref: /schemas/types.yaml#/definitions/uint32-array > + deprecated: true Why are you adding a new property as deprecated? Why does this duplicate what you're adding to the port node? At the very least, your commit is lacking an explanation. pw-bot: changes-requested Cheers, Conor. > + minItems: 1 > + maxItems: 4 > + items: > + maximum: 3 > + > ports: > $ref: /schemas/graph.yaml#/properties/ports > > 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. > + description: Port node with one endpoint connected to sink device node. > + properties: > + endpoint: > + $ref: /schemas/media/video-interfaces.yaml# > + unevaluatedProperties: false > + properties: > + data-lanes: > + minItems: 1 > + maxItems: 4 > + items: > + enum: [ 0, 1, 2, 3 ] > > required: > - port@0 > -- > 2.34.1 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping 2026-05-14 7:01 [PATCH v1 0/3] Add eDP lane mapping support Damon Ding 2026-05-14 7:01 ` [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties Damon Ding 2026-05-14 7:01 ` [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint Damon Ding @ 2026-05-14 7:01 ` Damon Ding 2026-05-14 17:57 ` sashiko-bot 2 siblings, 1 reply; 9+ messages in thread From: Damon Ding @ 2026-05-14 7:01 UTC (permalink / raw) To: hjc, heiko, andy.yan, maarten.lankhorst, mripard, tzimmermann, airlied, simona, robh, krzk+dt, conor+dt, andrzej.hajda, neil.armstrong, rfoss Cc: Laurent.pinchart, jonas, jernej.skrabec, nicolas.frattaroli, cristian.ciocaltea, sebastian.reichel, dmitry.baryshkov, luca.ceresoli, dianders, m.szyprowski, dri-devel, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel, Damon Ding 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. Signed-off-by: Damon Ding <damon.ding@rock-chips.com> --- .../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(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index c8eb3511f92a..a7d19c3be7e0 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -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; } diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h index 17347448c6b0..634fad241e69 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h @@ -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); diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 6207ded7ffd5..f5f55bd25062 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -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); diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h index 12735139046c..ac914e37089b 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h @@ -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) -- 2.34.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping 2026-05-14 7:01 ` [PATCH v1 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping Damon Ding @ 2026-05-14 17:57 ` sashiko-bot 0 siblings, 0 replies; 9+ messages in thread From: sashiko-bot @ 2026-05-14 17:57 UTC (permalink / raw) To: Damon Ding; +Cc: krzk+dt, devicetree, conor+dt, robh Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] Stack buffer overflow when parsing 'data-lanes' property on EXYNOS platforms. - [High] Incorrect hardware configuration for asymmetric lane mappings due to inverted logical-to-physical mapping. - [Medium] Inconsistent endpoint node resolution leads to device tree parsing errors. -- commit 433b68e59e322b480b7a41218242dfa6cb857ab3 Author: Damon Ding <damon.ding@rock-chips.com> drm/bridge: analogix_dp: Add support for optional data-lanes mapping This commit parses the optional 'data-lanes' device tree property to support custom physical lane mapping configuration. > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > index 8cf6b73bceac0..d53ab25bc57b1 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > @@ -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]; [ ... ] > + 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); Can this inconsistent endpoint node resolution lead to parsing errors? The drm_of_get_data_lanes_count_ep() call strictly searches for an endpoint with reg = 0 on port 1, but the subsequent of_graph_get_endpoint_by_regs() call uses reg = -1 to match the first available endpoint regardless of its register value. If a valid endpoint has a non-zero register, won't the first query fail while the second would have correctly found it? > + if (!endpoint) > + return -EINVAL; > + > + ret = of_property_read_u32_array(endpoint, "data-lanes", tmp, num_lanes); Does this introduce a potential stack buffer overflow for the tmp array on EXYNOS platforms? The tmp array is allocated on the stack with a fixed size of LANE_COUNT4 (4), but num_lanes is bounded by video_info->max_lane_count. Looking at the EXYNOS platform parsing later in the same file: case EXYNOS_DP: ... of_property_read_u32(dp_node, "samsung,lane-count", &video_info->max_lane_count); The max_lane_count is populated directly from the samsung,lane-count device tree property without validation. If a malformed device tree specifies a value greater than 4, num_lanes will exceed the size of the tmp array, causing of_property_read_u32_array() to write out of bounds and corrupt the stack. [ ... ] > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > index 38fd8d5014d29..45c7652645a13 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c > @@ -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; Is the logical-to-physical lane mapping inverted here? The data-lanes device tree property semantics dictate that the array index is the logical lane and the array value is the physical lane. However, the ANALOGIX_DP_LANE_MAP register fields appear to configure which logical lane is assigned to a specific physical lane. By assigning reg = lane_map[0] << LANE0_MAP_SHIFT, does this code write the physical lane assigned to logical lane 0 into the hardware configuration for physical lane 0? While this works coincidentally for symmetric permutations like <0 1 2 3> or <3 2 1 0>, it would result in incorrect lane assignments for asymmetric mappings like <1 2 3 0>. > > writel(reg, dp->reg_base + ANALOGIX_DP_LANE_MAP); > } -- Sashiko AI review · https://sashiko.dev/#/patchset/20260514070133.2275069-1-damon.ding@rock-chips.com?part=3 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-05-14 18:19 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-14 7:01 [PATCH v1 0/3] Add eDP lane mapping support Damon Ding 2026-05-14 7:01 ` [PATCH v1 1/3] dt-bindings: display: rockchip: analogix-dp: Expose inherited properties Damon Ding 2026-05-14 16:20 ` sashiko-bot 2026-05-14 18:16 ` Conor Dooley 2026-05-14 7:01 ` [PATCH v1 2/3] dt-bindings: display: bridge: analogix-dp: Add data-lanes support for endpoint Damon Ding 2026-05-14 16:58 ` sashiko-bot 2026-05-14 18:19 ` Conor Dooley 2026-05-14 7:01 ` [PATCH v1 3/3] drm/bridge: analogix_dp: Add support for optional data-lanes mapping Damon Ding 2026-05-14 17:57 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox