* [PATCH v4 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support @ 2026-07-13 8:26 Wojciech Dubowik 2026-07-13 8:26 ` [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik 2026-07-13 8:26 ` [PATCH v4 2/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support Wojciech Dubowik 0 siblings, 2 replies; 6+ messages in thread From: Wojciech Dubowik @ 2026-07-13 8:26 UTC (permalink / raw) To: linux-kernel Cc: Wojciech Dubowik, Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli, David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Marek Vasut, dri-devel, devicetree, imx, linux-arm-kernel From: Wojciech Dubowik <Wojciech.Dubowik@mt.com> Add support for reversed lvds output lanes. With an optional data-lanes property one can support default layout <1 2 3 4> or reversed layout <4 3 2 1>. The property is optional and when not set it keeps the default output layout. Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@mt.com> --- Changes in v4: - Fix data-lanes bindings to be under endpoint subnode and not in the node itself, discovered by shashiko-reviews Changes in v3: - Add optional data-lanes bindings for output nodes Changes in v2: - Parse existing data-lanes property instead of ading new DT bindings --- Wojciech Dubowik (2): dt-bindings: display: sn65dsi83: Add output data-lanes drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support .../bindings/display/bridge/ti,sn65dsi83.yaml | 52 +++++++++++++++++++ drivers/gpu/drm/bridge/ti-sn65dsi83.c | 50 ++++++++++++++++++ 2 files changed, 102 insertions(+) -- 2.47.3 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes 2026-07-13 8:26 [PATCH v4 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support Wojciech Dubowik @ 2026-07-13 8:26 ` Wojciech Dubowik 2026-07-13 8:36 ` sashiko-bot 2026-07-15 6:08 ` Krzysztof Kozlowski 2026-07-13 8:26 ` [PATCH v4 2/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support Wojciech Dubowik 1 sibling, 2 replies; 6+ messages in thread From: Wojciech Dubowik @ 2026-07-13 8:26 UTC (permalink / raw) To: linux-kernel Cc: Wojciech Dubowik, Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli, David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Marek Vasut, dri-devel, devicetree, imx, linux-arm-kernel From: Wojciech Dubowik <Wojciech.Dubowik@mt.com> Add an optional output lvds data lanes property with two allowed values. The array <1 2 3 4> for standard layout and <4 3 2 1> for reversed lvds output lanes. The latter informs the driver that reverse lvds config option has to be set in config register for the respective output channel. Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@mt.com> --- .../bindings/display/bridge/ti,sn65dsi83.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml index e69b6343a8eb..2693c0273f9a 100644 --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml @@ -86,10 +86,62 @@ properties: description: Video port for LVDS Channel-A output (panel or bridge). $ref: '#/$defs/lvds-port' + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + Array of physical LVDS data lane indexes + oneOf: + - items: + - const: 1 + - const: 2 + - const: 3 + - const: 4 + description: | + This is the default layout + - items: + - const: 4 + - const: 3 + - const: 2 + - const: 1 + description: | + This is the reversed layout + port@3: description: Video port for LVDS Channel-B output (panel or bridge). $ref: '#/$defs/lvds-port' + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + Array of physical LVDS data lane indexes + oneOf: + - items: + - const: 1 + - const: 2 + - const: 3 + - const: 4 + description: | + This is the default layout + - items: + - const: 4 + - const: 3 + - const: 2 + - const: 1 + description: | + This is the reversed layout + required: - port@0 - port@2 -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes 2026-07-13 8:26 ` [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik @ 2026-07-13 8:36 ` sashiko-bot 2026-07-15 6:08 ` Krzysztof Kozlowski 1 sibling, 0 replies; 6+ messages in thread From: sashiko-bot @ 2026-07-13 8:36 UTC (permalink / raw) To: Wojciech Dubowik; +Cc: imx, dri-devel, devicetree, Frank.Li, robh, conor+dt Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] The inline `unevaluatedProperties: false` on `endpoint` blocks valid LVDS-specific properties inherited from `#/$defs/lvds-port`. - [Medium] The `data-lanes` schema implicitly forces exactly 4 elements, breaking valid 3-lane LVDS configurations. - [Low] Unnecessary duplication of the `data-lanes` schema block across `port@2` and `port@3`. - [Low] Redundant `$ref` to `uint32-array` for a standard media property. -- --- Patch [1]: [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes --- commit 15be6ea27b74f8702a5daf407df624dc92403b9d Author: Wojciech Dubowik <Wojciech.Dubowik@mt.com> dt-bindings: display: sn65dsi83: Add output data-lanes Add an optional output lvds data lanes property with two allowed values. The array <1 2 3 4> for standard layout and <4 3 2 1> for reversed lvds output lanes. The latter informs the driver that reverse lvds config option has to be set in config register for the respective output channel. > diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml > index e69b6343a8ebb..2693c0273f9ad 100644 > --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml > +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml > @@ -86,10 +86,62 @@ properties: > description: Video port for LVDS Channel-A output (panel or bridge). > $ref: '#/$defs/lvds-port' > > + properties: > + endpoint: > + $ref: /schemas/media/video-interfaces.yaml# > + unevaluatedProperties: false [Severity: High] Will this inline unevaluatedProperties block valid LVDS-specific properties inherited from the shared lvds-port definition? In JSON Schema 2019-09, unevaluatedProperties only considers properties evaluated within its immediate schema object or its direct references. This means it might incorrectly reject properties defined in $defs/lvds-port/properties/endpoint. > + > + properties: > + data-lanes: [Severity: Low] Could this entire data-lanes property definition be defined once centrally inside $defs/lvds-port/properties/endpoint/properties instead of duplicating it across both port@2 and port@3? Placing it in the shared definition might also resolve the unevaluatedProperties conflict. > + $ref: /schemas/types.yaml#/definitions/uint32-array [Severity: Low] Is this explicit type reference necessary? The endpoint references /schemas/media/video-interfaces.yaml#, which already enforces the uint32-array type for data-lanes globally. > + description: | > + Array of physical LVDS data lane indexes > + oneOf: > + - items: > + - const: 1 > + - const: 2 > + - const: 3 > + - const: 4 [Severity: Medium] Does this implicitly force exactly 4 elements and reject valid 3-lane LVDS configurations? Providing a YAML array for items without specifying minItems implicitly sets both minItems and maxItems to the array's length (4). Since the SN65DSI83 hardware supports 18-bpp (3-lane) configurations, device trees using data-lanes = <1 2 3> might fail validation. > + description: | > + This is the default layout > + - items: > + - const: 4 > + - const: 3 > + - const: 2 > + - const: 1 > + description: | > + This is the reversed layout > + [ ... ] -- Sashiko AI review · https://sashiko.dev/#/patchset/20260713082622.52985-1-wojciech.dubowik@mt.com?part=1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes 2026-07-13 8:26 ` [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik 2026-07-13 8:36 ` sashiko-bot @ 2026-07-15 6:08 ` Krzysztof Kozlowski 1 sibling, 0 replies; 6+ messages in thread From: Krzysztof Kozlowski @ 2026-07-15 6:08 UTC (permalink / raw) To: Wojciech Dubowik Cc: linux-kernel, Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli, David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Marek Vasut, dri-devel, devicetree, imx, linux-arm-kernel On Mon, Jul 13, 2026 at 10:26:19AM +0200, Wojciech Dubowik wrote: > From: Wojciech Dubowik <Wojciech.Dubowik@mt.com> > > Add an optional output lvds data lanes property with > two allowed values. The array <1 2 3 4> for standard > layout and <4 3 2 1> for reversed lvds output lanes. > The latter informs the driver that reverse lvds config > option has to be set in config register for the respective > output channel. Please wrap commit message according to Linux coding style / submission process (neither too early nor over the limit): https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597 > > Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@mt.com> > --- > .../bindings/display/bridge/ti,sn65dsi83.yaml | 52 +++++++++++++++++++ > 1 file changed, 52 insertions(+) > > diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml > index e69b6343a8eb..2693c0273f9a 100644 > --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml > +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml > @@ -86,10 +86,62 @@ properties: > description: Video port for LVDS Channel-A output (panel or bridge). > $ref: '#/$defs/lvds-port' > > + properties: > + endpoint: > + $ref: /schemas/media/video-interfaces.yaml# > + unevaluatedProperties: false > + > + properties: > + data-lanes: > + $ref: /schemas/types.yaml#/definitions/uint32-array > + description: | Drop | > + Array of physical LVDS data lane indexes > + oneOf: > + - items: > + - const: 1 > + - const: 2 > + - const: 3 > + - const: 4 > + description: | As well > + This is the default layout > + - items: > + - const: 4 > + - const: 3 > + - const: 2 > + - const: 1 > + description: | Ditto > + This is the reversed layout Honestly, this previous description are redundant. I can read 4-3-2-1 and I do understand it is a reversed from 1-2-3-4. Do not explain the obvious code, but rather design behind. Just drop the descriptions except the first one. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 2/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support 2026-07-13 8:26 [PATCH v4 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support Wojciech Dubowik 2026-07-13 8:26 ` [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik @ 2026-07-13 8:26 ` Wojciech Dubowik 2026-07-15 8:49 ` Luca Ceresoli 1 sibling, 1 reply; 6+ messages in thread From: Wojciech Dubowik @ 2026-07-13 8:26 UTC (permalink / raw) To: linux-kernel Cc: Wojciech Dubowik, Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli, David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Marek Vasut, dri-devel, devicetree, imx, linux-arm-kernel From: Wojciech Dubowik <Wojciech.Dubowik@mt.com> The chip supports output lvds lanes in two orders, default <1 2 3 4> and <4 3 2 1>. Add parsing of an optional output lvds data-lanes property so we can inform chip that the lanes have been reversed. Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@mt.com> --- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c index 42b451432bbb..4945d4c960c4 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -148,6 +148,18 @@ enum sn65dsi83_lvds_term { OHM_200 }; +enum { + NORMAL_LANE_MAPPING, + REVERSE_LANE_MAPPING, +}; + +#define DATA_LANES_COUNT 4 + +static const int supported_data_lane_mapping[][DATA_LANES_COUNT] = { + [NORMAL_LANE_MAPPING] = { 1, 2, 3, 4 }, + [REVERSE_LANE_MAPPING] = { 4, 3, 2, 1}, +}; + enum sn65dsi83_model { MODEL_SN65DSI83, MODEL_SN65DSI84, @@ -163,6 +175,7 @@ struct sn65dsi83 { struct regulator *vcc; bool lvds_dual_link; bool lvds_dual_link_even_odd_swap; + bool lvds_reverse_lanes_conf[2]; int lvds_vod_swing_conf[2]; int lvds_term_conf[2]; int irq; @@ -644,6 +657,10 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge, regmap_write(ctx->regmap, REG_LVDS_LANE, (ctx->lvds_dual_link_even_odd_swap ? REG_LVDS_LANE_EVEN_ODD_SWAP : 0) | + (ctx->lvds_reverse_lanes_conf[CHANNEL_A] ? + REG_LVDS_LANE_CHA_REVERSE_LVDS : 0) | + (ctx->lvds_reverse_lanes_conf[CHANNEL_B] ? + REG_LVDS_LANE_CHB_REVERSE_LVDS : 0) | (ctx->lvds_term_conf[CHANNEL_A] ? REG_LVDS_LANE_CHA_LVDS_TERM : 0) | (ctx->lvds_term_conf[CHANNEL_B] ? @@ -832,10 +849,12 @@ static int sn65dsi83_parse_lvds_endpoint(struct sn65dsi83 *ctx, int channel) u32 lvds_vod_swing_clk[2] = { 0, 1000000 }; /* Set default near end terminataion to 200 Ohm */ u32 lvds_term = 200; + u32 data_lanes[DATA_LANES_COUNT]; int lvds_vod_swing_conf; int ret = 0; int ret_data; int ret_clock; + int i, j; if (channel == CHANNEL_A) endpoint_reg = 2; @@ -854,6 +873,37 @@ static int sn65dsi83_parse_lvds_endpoint(struct sn65dsi83 *ctx, int channel) goto exit; } + ret_data = of_property_read_u32_array(endpoint, "data-lanes", data_lanes, + ARRAY_SIZE(data_lanes)); + if (ret_data != 0 && ret_data != -EINVAL) { + ret = ret_data; + goto exit; + } + + if (!ret_data) { + for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) { + for (j = 0; j < DATA_LANES_COUNT; j++) { + if (data_lanes[j] != supported_data_lane_mapping[i][j]) + break; + } + + if (j == DATA_LANES_COUNT) + break; + } + + switch (i) { + case NORMAL_LANE_MAPPING: + break; + case REVERSE_LANE_MAPPING: + ctx->lvds_reverse_lanes_conf[channel] = true; + break; + default: + dev_err(dev, "invalid data lanes mapping\n"); + ret = -EINVAL; + goto exit; + } + } + ret_data = of_property_read_u32_array(endpoint, "ti,lvds-vod-swing-data-microvolt", lvds_vod_swing_data, ARRAY_SIZE(lvds_vod_swing_data)); if (ret_data != 0 && ret_data != -EINVAL) { -- 2.47.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 2/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support 2026-07-13 8:26 ` [PATCH v4 2/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support Wojciech Dubowik @ 2026-07-15 8:49 ` Luca Ceresoli 0 siblings, 0 replies; 6+ messages in thread From: Luca Ceresoli @ 2026-07-15 8:49 UTC (permalink / raw) To: Wojciech Dubowik Cc: linux-kernel, Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli, David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Marek Vasut, dri-devel, devicetree, imx, linux-arm-kernel On Mon, 13 Jul 2026 10:26:20 +0200, Wojciech Dubowik <wojciech.dubowik@mt.com> wrote: Hello Wojciech, > > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c > index e6dbe51d0dba..d676ea3b40e8 100644 > --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c > @@ -148,6 +148,18 @@ enum sn65dsi83_lvds_term { > OHM_200 > }; > > +enum { > + NORMAL_LANE_MAPPING, > + REVERSE_LANE_MAPPING, Please use a fixed prefix and use the suffix to differentiate: LANE_MAPPING_NORMAL, LANE_MAPPING_REVERSE, > @@ -854,6 +873,37 @@ static int sn65dsi83_parse_lvds_endpoint(struct sn65dsi83 *ctx, int channel) > goto exit; > } > > + ret_data = of_property_read_u32_array(endpoint, "data-lanes", data_lanes, > + ARRAY_SIZE(data_lanes)); > + if (ret_data != 0 && ret_data != -EINVAL) { > + ret = ret_data; > + goto exit; The goto-based error handling is getting trickier and trickier with more error conditions. Can you please add a preliminary commit in this series that replaces: -struct device_node *endpoint; -endpoint = of_graph_get_endpoint_by_regs(dev->of_node, endpoint_reg, -1); +struct device_node *endpoint __free(device_node) = + of_graph_get_endpoint_by_regs(dev->of_node, endpoint_reg, -1); and removes the entire "ret = foo; goto exit;" logic with simple returns? > + } > + > + if (!ret_data) { > + for (i = 0; i < ARRAY_SIZE(supported_data_lane_mapping); i++) { > + for (j = 0; j < DATA_LANES_COUNT; j++) { > + if (data_lanes[j] != supported_data_lane_mapping[i][j]) > + break; > + } > + > + if (j == DATA_LANES_COUNT) > + break; > + } I think a memcmp() can simplify the implementation if you use the same data type (u32) for data_lanes and supported_data_lane_mapping[]. > + > + switch (i) { > + case NORMAL_LANE_MAPPING: > + break; > + case REVERSE_LANE_MAPPING: > + ctx->lvds_reverse_lanes_conf[channel] = true; > + break; > + default: > + dev_err(dev, "invalid data lanes mapping\n"); > + ret = -EINVAL; > + goto exit; > + } > + } And perhaps the whole if (!ret_data) here can be simplified a lot as this (pseudocode, not tested): if (!ret_data) { if (memcmp(data_lanes[j], supported_data_lane_mapping[NORMAL_LANE_MAPPING], size) == 0) break; else if (memcmp(data_lanes[j], supported_data_lane_mapping[REVERSE_LANE_MAPPING], size) == 0) ctx->lvds_reverse_lanes_conf[channel] = true; else return dev_err_probe(...); } Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-15 8:49 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-07-13 8:26 [PATCH v4 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support Wojciech Dubowik 2026-07-13 8:26 ` [PATCH v4 1/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik 2026-07-13 8:36 ` sashiko-bot 2026-07-15 6:08 ` Krzysztof Kozlowski 2026-07-13 8:26 ` [PATCH v4 2/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support Wojciech Dubowik 2026-07-15 8:49 ` Luca Ceresoli
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox