Devicetree
 help / color / mirror / Atom feed
* [PATCH v3 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support
       [not found] <20260710082630.394040-1-wojciech.dubowik@mt.com>
@ 2026-07-10  8:26 ` Wojciech Dubowik
  2026-07-10  8:26 ` [PATCH v3 1/2] drm/bridge: ti-sn65dsi83: Add reversed " Wojciech Dubowik
  2026-07-10  8:26 ` [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik
  2 siblings, 0 replies; 6+ messages in thread
From: Wojciech Dubowik @ 2026-07-10  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,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, 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 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):
  drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support
  dt-bindings: display: sn65dsi83: Add output data-lanes

 .../bindings/display/bridge/ti,sn65dsi83.yaml | 42 ++++++++++++++++
 drivers/gpu/drm/bridge/ti-sn65dsi83.c         | 50 +++++++++++++++++++
 2 files changed, 92 insertions(+)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support
       [not found] <20260710082630.394040-1-wojciech.dubowik@mt.com>
  2026-07-10  8:26 ` [PATCH v3 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support Wojciech Dubowik
@ 2026-07-10  8:26 ` Wojciech Dubowik
  2026-07-10  8:37   ` sashiko-bot
  2026-07-10  8:26 ` [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik
  2 siblings, 1 reply; 6+ messages in thread
From: Wojciech Dubowik @ 2026-07-10  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,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, 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

* [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes
       [not found] <20260710082630.394040-1-wojciech.dubowik@mt.com>
  2026-07-10  8:26 ` [PATCH v3 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support Wojciech Dubowik
  2026-07-10  8:26 ` [PATCH v3 1/2] drm/bridge: ti-sn65dsi83: Add reversed " Wojciech Dubowik
@ 2026-07-10  8:26 ` Wojciech Dubowik
  2026-07-10  8:34   ` sashiko-bot
  2 siblings, 1 reply; 6+ messages in thread
From: Wojciech Dubowik @ 2026-07-10  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,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, 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 | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
index e69b6343a8eb..4431f113bb9c 100644
--- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
@@ -86,10 +86,52 @@ properties:
         description: Video port for LVDS Channel-A output (panel or bridge).
         $ref: '#/$defs/lvds-port'
 
+        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:
+          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 v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes
  2026-07-10  8:26 ` [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik
@ 2026-07-10  8:34   ` sashiko-bot
  2026-07-10  9:10     ` Wojciech Dubowik
  0 siblings, 1 reply; 6+ messages in thread
From: sashiko-bot @ 2026-07-10  8:34 UTC (permalink / raw)
  To: Wojciech Dubowik; +Cc: dri-devel, imx, devicetree, Frank.Li, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Mismatch between device tree schema and driver implementation for the `data-lanes` property.
--

--- Patch [2]: [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes ---
commit 98aea58cd5128c6a4b72efd4a5f9ec088fd30dca
Author: Wojciech Dubowik <Wojciech.Dubowik@mt.com>

dt-bindings: display: sn65dsi83: Add output data-lanes

This commit adds an optional output LVDS data lanes property with two allowed
values. It supports the standard layout <1 2 3 4> and reversed layout <4 3 2 1>
for output channels.

> diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> index e69b6343a8ebb..4431f113bb9cd 100644
> --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> @@ -86,10 +86,52 @@ properties:
>          description: Video port for LVDS Channel-A output (panel or bridge).
>          $ref: '#/$defs/lvds-port'
>  
> +        properties:
> +          data-lanes:
> +            $ref: /schemas/types.yaml#/definitions/uint32-array

[Severity: Medium]
Does this schema change place data-lanes at the correct level in the
device tree hierarchy?

The schema defines data-lanes as a direct property of the port node,
but standard OF graph rules and the driver implementation parse it from the
endpoint node:

drivers/gpu/drm/bridge/ti-sn65dsi83.c:sn65dsi83_parse_lvds_endpoint() {
    ...
    ret_data = of_property_read_u32_array(endpoint, "data-lanes", data_lanes,
                    ARRAY_SIZE(data_lanes));
    ...
}

Because the driver reads from the endpoint node rather than the port node,
will it silently fail to find the configuration and fall back to the default
layout on affected hardware?

> +            description: |
> +              Array of physical LVDS data lane indexes
> +            oneOf:

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710082630.394040-1-wojciech.dubowik@mt.com?part=2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support
  2026-07-10  8:26 ` [PATCH v3 1/2] drm/bridge: ti-sn65dsi83: Add reversed " Wojciech Dubowik
@ 2026-07-10  8:37   ` sashiko-bot
  0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-10  8:37 UTC (permalink / raw)
  To: Wojciech Dubowik; +Cc: imx, robh, conor+dt, devicetree, Frank.Li, dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Probe definitively fails on valid legacy 3-lane or 0-indexed device trees due to rigid array bounds.
--

--- Patch [1]: [PATCH v3 1/2] drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support ---
commit 47fc41c5744e78e6f8072b1226e9548c69361da5
Author: Wojciech Dubowik <Wojciech.Dubowik@mt.com>

drm/bridge: ti-sn65dsi83: Add reversed lvds lanes support

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.

> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
[ ... ]
> @@ -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) {

[Severity: High]
Does this code break valid legacy device trees that define fewer than 4 lanes?

If a device tree has a data-lanes property on the LVDS endpoint with fewer
than 4 lanes (e.g., <1 2 3>), of_property_read_u32_array() will return
-EOVERFLOW because it rigidly expects exactly ARRAY_SIZE(data_lanes) elements.
This will immediately abort the probe, breaking previously working displays.

> +		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;

[Severity: High]
Will this cause the probe to fail on 0-indexed device tree configurations?

The array comparison logic above this switch strictly checks for 1-indexed
mappings. If the device tree uses a valid 0-indexed scheme (e.g., <0 1 2 3>),
it falls through to this default case, causing the probe to fail with -EINVAL.

> +			goto exit;
> +		}
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710082630.394040-1-wojciech.dubowik@mt.com?part=1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes
  2026-07-10  8:34   ` sashiko-bot
@ 2026-07-10  9:10     ` Wojciech Dubowik
  0 siblings, 0 replies; 6+ messages in thread
From: Wojciech Dubowik @ 2026-07-10  9:10 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: dri-devel, imx, devicetree, Frank.Li, robh, conor+dt

On Fri, Jul 10, 2026 at 08:34:25AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Mismatch between device tree schema and driver implementation for the `data-lanes` property.
> --
> 
> --- Patch [2]: [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes ---
> commit 98aea58cd5128c6a4b72efd4a5f9ec088fd30dca
> Author: Wojciech Dubowik <Wojciech.Dubowik@mt.com>
> 
> dt-bindings: display: sn65dsi83: Add output data-lanes
> 
> This commit adds an optional output LVDS data lanes property with two allowed
> values. It supports the standard layout <1 2 3 4> and reversed layout <4 3 2 1>
> for output channels.
> 
> > diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> > index e69b6343a8ebb..4431f113bb9cd 100644
> > --- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> > +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml
> > @@ -86,10 +86,52 @@ properties:
> >          description: Video port for LVDS Channel-A output (panel or bridge).
> >          $ref: '#/$defs/lvds-port'
> >  
> > +        properties:
> > +          data-lanes:
> > +            $ref: /schemas/types.yaml#/definitions/uint32-array
> 
> [Severity: Medium]
> Does this schema change place data-lanes at the correct level in the
> device tree hierarchy?
> 
> The schema defines data-lanes as a direct property of the port node,
> but standard OF graph rules and the driver implementation parse it from the
> endpoint node:

This is valid comment. While testing dt bindings I have put data-lanes property
on the wrong level. It should in under endpoint and not in main node.

I will fix it in v4

> 
> drivers/gpu/drm/bridge/ti-sn65dsi83.c:sn65dsi83_parse_lvds_endpoint() {
>     ...
>     ret_data = of_property_read_u32_array(endpoint, "data-lanes", data_lanes,
>                     ARRAY_SIZE(data_lanes));
>     ...
> }
> 
> Because the driver reads from the endpoint node rather than the port node,
> will it silently fail to find the configuration and fall back to the default
> layout on affected hardware?
> 
> > +            description: |
> > +              Array of physical LVDS data lane indexes
> > +            oneOf:
> 
> [ ... ]
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260710082630.394040-1-wojciech.dubowik@mt.com?part=2

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-10  9:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260710082630.394040-1-wojciech.dubowik@mt.com>
2026-07-10  8:26 ` [PATCH v3 0/2] drm/bridge: ti-sn65dsi83: Add reverse lvds lanes support Wojciech Dubowik
2026-07-10  8:26 ` [PATCH v3 1/2] drm/bridge: ti-sn65dsi83: Add reversed " Wojciech Dubowik
2026-07-10  8:37   ` sashiko-bot
2026-07-10  8:26 ` [PATCH v3 2/2] dt-bindings: display: sn65dsi83: Add output data-lanes Wojciech Dubowik
2026-07-10  8:34   ` sashiko-bot
2026-07-10  9:10     ` Wojciech Dubowik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox