Skip to contentSkip to conversation

sn65dsi83: Add LVDS_VCOM option in device-tree

PATCH In review Andrej Picej 4 participants 10 messages Nov 27, 2024 – Nov 28, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover sn65dsi83: Add LVDS_VCOM option in device-tree

Hi all,

This patch series depends on the patch
"[PATCH 11/15] arm64: dts: imx8mm-phyboard-polis: Add support for PEB-AV-10"
(https://lore.kernel.org/linux-arm-kernel/[email protected]/)
which is currently under review. Please apply the dependent series first before applying this one.

Best regards,
Andrej

Andrej Picej (1):
arm64: dts: imx8mm-phyboard-polis-peb-av-10: Set custom lvds_vcom

Janine Hagemann (2):
dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property
ti,lvds-vcom
drm/bridge: ti-sn65dsi83: Add ti,lvds-vcom as optional property

 .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
 .../freescale/imx8mm-phyboard-polis-peb-av-10.dtso |  1 +
 drivers/gpu/drm/bridge/ti-sn65dsi83.c              | 10 +++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property ti,lvds-vcom

From: Janine Hagemann <[email protected]>

Add an optional property to change LVDS output voltage. This depends on the connected display specifications. With this property we directly set the LVDS_VCOM (0x19) register.
Better register property mapping would be quite tricky. Please check bridge's datasheet for details on how register values set the LVDS data lines and LVDS clock output voltage.

---
 .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +13 -1
index 48a97bb3e2e0..5b2c0c281824 100644
@@ -58,6 +58,12 @@ properties:
                   - const: 2
                   - const: 3
                   - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.
 
       port@1:
         $ref: /schemas/graph.yaml#/$defs/port-base
@@ -78,6 +84,12 @@ properties:
                   - const: 2
                   - const: 3
                   - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.
 
       port@2:
         $ref: /schemas/graph.yaml#/properties/port
@@ -120,7 +132,7 @@ allOf:
           properties:
             port@1: false
 
-additionalProperties: false
+additionalProperties: true
 
 examples:
   - |
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH 1/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property ti,lvds-vcom

Quoted 20 lines · Andrej Picej

From: Janine Hagemann <[email protected]>

Add an optional property to change LVDS output voltage. This depends on the connected display specifications. With this property we directly set the LVDS_VCOM (0x19) register.
Better register property mapping would be quite tricky. Please check bridge's datasheet for details on how register values set the LVDS data lines and LVDS clock output voltage.

---
 .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +0 -0
index 48a97bb3e2e0..5b2c0c281824 100644

Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml properties: · line 66

Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +6 -0
@@ -58,6 +58,12 @@ properties:
                   - const: 2
                   - const: 3
                   - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.

Constraints? 0 - 2^32 are all valid values?

Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml properties: · line 92

Quoted 13 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +6 -0
       port@1:
         $ref: /schemas/graph.yaml#/$defs/port-base
@@ -78,6 +84,12 @@ properties:
                   - const: 2
                   - const: 3
                   - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.

Never good to just have 2 copies of the same thing. Move the whole port schema to a $defs entry and add the property there. Then just $ref it:

port@0:
description: Video port for MIPI DSI Channel-A input $ref: '#/$defs/dsi-port'

$defs:
dsi-port:
$ref: /schemas/graph.yaml#/$defs/port-base
unevaluatedProperties: false
description: Video port for MIPI DSI inputs

properties:
endpoint:
$ref: /schemas/media/video-interfaces.yaml#
unevaluatedProperties: false

properties:
data-lanes:
description: array of physical DSI data lane indexes.
minItems: 1
items:
- const: 1
- const: 2
- const: 3
- const: 4

#3 lore raw

Re: [PATCH 1/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property ti,lvds-vcom

Hi Rob,

Quoted 16 lines · Rob Herring
Quoted 15 lines · Andrej Picej

From: Janine Hagemann <[email protected]>

Add an optional property to change LVDS output voltage. This depends on the connected display specifications. With this property we directly set the LVDS_VCOM (0x19) register.
Better register property mapping would be quite tricky. Please check bridge's datasheet for details on how register values set the LVDS data lines and LVDS clock output voltage.

---
  .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
  1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 16 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +0 -0
index 48a97bb3e2e0..5b2c0c281824 100644

Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml properties: · line 66

Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +6 -0
@@ -58,6 +58,12 @@ properties:
                    - const: 2
                    - const: 3
                    - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.

Constraints? 0 - 2^32 are all valid values?

Not really, only first 6 bits, which also means that this can be uint8 then. Will fix with other issues.

Quoted 34 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +0 -0
        port@1:
          $ref: /schemas/graph.yaml#/$defs/port-base

Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml properties: · line 92

Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +6 -0
@@ -78,6 +84,12 @@ properties:
                    - const: 2
                    - const: 3
                    - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.

Never good to just have 2 copies of the same thing. Move the whole port schema to a $defs entry and add the property there. Then just $ref it:

   port@0:
     description: Video port for MIPI DSI Channel-A input
     $ref: '#/$defs/dsi-port'

$defs:
dsi-port:
$ref: /schemas/graph.yaml#/$defs/port-base
unevaluatedProperties: false
description: Video port for MIPI DSI inputs

properties:
endpoint:
$ref: /schemas/media/video-interfaces.yaml#
unevaluatedProperties: false

Quoted 10 lines

properties:
data-lanes:
description: array of physical DSI data lane indexes.
minItems: 1
items:
- const: 1
- const: 2
- const: 3
- const: 4

Ok will do it like this + just noticed that we are adding this under MIPI DSI port, and not LVDS output port for which these property is meant for. Will move it there.

Thanks. Best regards,
Andrej

maintainer
#4 lore raw

Re: [PATCH 1/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property ti,lvds-vcom

Quoted 34 lines · Andrej Picej
Quoted 16 lines · Rob Herring
Quoted 15 lines · Andrej Picej

From: Janine Hagemann <[email protected]>

Add an optional property to change LVDS output voltage. This depends on the connected display specifications. With this property we directly set the LVDS_VCOM (0x19) register.
Better register property mapping would be quite tricky. Please check bridge's datasheet for details on how register values set the LVDS data lines and LVDS clock output voltage.

---
  .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
  1 file changed, 13 insertions(+), 1 deletion(-)
Quoted 16 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +0 -0
index 48a97bb3e2e0..5b2c0c281824 100644

Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml properties: · line 66

Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +6 -0
@@ -58,6 +58,12 @@ properties:
                    - const: 2
                    - const: 3
                    - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.

Constraints? 0 - 2^32 are all valid values?

Quoted 2 lines

Not really, only first 6 bits, which also means that this can be uint8 then. Will fix with other issues.

Also, generally speaking directly using register values is really frowned upon, even more so when they match a value expressed in a standard unit.

Maxime

#5 lore raw

Re: [PATCH 1/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property ti,lvds-vcom

Hi Maxime,

Quoted 35 lines · Maxime Ripard
Quoted 34 lines · Andrej Picej
Quoted 32 lines · Rob Herring
Quoted 20 lines · Andrej Picej

From: Janine Hagemann <[email protected]>

Add an optional property to change LVDS output voltage. This depends on the connected display specifications. With this property we directly set the LVDS_VCOM (0x19) register.
Better register property mapping would be quite tricky. Please check bridge's datasheet for details on how register values set the LVDS data lines and LVDS clock output voltage.

---
   .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
   1 file changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +0 -0
index 48a97bb3e2e0..5b2c0c281824 100644

Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml properties: · line 66

Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +6 -0
@@ -58,6 +58,12 @@ properties:
                     - const: 2
                     - const: 3
                     - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.

Constraints? 0 - 2^32 are all valid values?

Quoted 6 lines
Quoted 2 lines

Not really, only first 6 bits, which also means that this can be uint8 then. Will fix with other issues.

Also, generally speaking directly using register values is really frowned upon, even more so when they match a value expressed in a standard unit.

Yes, I am aware that this is not how devide-tree/device drivers should work. But setting this values based on wanted LVDS voltage will be quite tricky. Matching a value expressed in mV would be quite hard, take a look in the bridge datasheet [1], Chapter 6.5 Electrical Characteristics (|VOD|). Basically both:
- LVDS data line output and
- LVDS clock voltage
is determined by the CSR 0x19.3:2. So when checking which Reg setting CSR 0x19 should be set to both conditions should meet specifications of the connected display. Output voltage for the same CSR 0x19 setting differs between LVDS data lines and LVDS clock.

Anyway, I'll prepare a v2 which only sets a part of this register, a bitfield (2 bits) that is responsible for LVDS differential output voltage.

[1] https://www.ti.com/lit/ds/symlink/sn65dsi83.pdf?ts=1732738773429&ref_url=https%253A%252F%252Fwww.mouser.co.uk%252F

Best regards,
Andrej

Quoted 2 lines

Maxime

#6 lore raw

Re: [PATCH 1/3] dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property ti,lvds-vcom

Quoted 57 lines · Andrej Picej

Hi Maxime,

Quoted 35 lines · Maxime Ripard
Quoted 34 lines · Andrej Picej
Quoted 32 lines · Rob Herring
Quoted 20 lines · Andrej Picej

From: Janine Hagemann <[email protected]>

Add an optional property to change LVDS output voltage. This depends on the connected display specifications. With this property we directly set the LVDS_VCOM (0x19) register.
Better register property mapping would be quite tricky. Please check bridge's datasheet for details on how register values set the LVDS data lines and LVDS clock output voltage.

---
   .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
   1 file changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +0 -0
index 48a97bb3e2e0..5b2c0c281824 100644

Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml properties: · line 66

Quoted 9 lines
Documentation/devicetree/bindings/display/bridge/ti,sn65dsi83.yaml +6 -0
@@ -58,6 +58,12 @@ properties:
                     - const: 2
                     - const: 3
                     - const: 4
+              ti,lvds-vcom:
+                $ref: /schemas/types.yaml#/definitions/uint32
+                description: LVDS output voltage configuration. This defines
+                  LVDS_VCOM (0x19) register value. Check bridge's datasheet for
+                  details on how register values set the LVDS data lines and
+                  LVDS clock output voltage.

Constraints? 0 - 2^32 are all valid values?

Quoted 6 lines
Quoted 2 lines

Not really, only first 6 bits, which also means that this can be uint8 then. Will fix with other issues.

Also, generally speaking directly using register values is really frowned upon, even more so when they match a value expressed in a standard unit.

Yes, I am aware that this is not how devide-tree/device drivers should work. But setting this values based on wanted LVDS voltage will be quite tricky. Matching a value expressed in mV would be quite hard, take a look in the bridge datasheet [1], Chapter 6.5 Electrical Characteristics (|VOD|). Basically both:
- LVDS data line output and
- LVDS clock voltage
is determined by the CSR 0x19.3:2. So when checking which Reg setting CSR 0x19 should be set to both conditions should meet specifications of the connected display. Output voltage for the same CSR 0x19 setting differs between LVDS data lines and LVDS clock.

Quoted 2 lines

Anyway, I'll prepare a v2 which only sets a part of this register, a bitfield (2 bits) that is responsible for LVDS differential output voltage.

Please use mV to specify the value in device tree. Yes, it's not easy. Yes, it is still recommended for multiple reasons.

Quoted 8 lines

[1] https://www.ti.com/lit/ds/symlink/sn65dsi83.pdf?ts=1732738773429&ref_url=https%253A%252F%252Fwww.mouser.co.uk%252F

Best regards,
Andrej

Quoted 2 lines

Maxime

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

PATCH 2/3 drm/bridge: ti-sn65dsi83: Add ti,lvds-vcom as optional property

In reply to Andrej Picej

From: Janine Hagemann <[email protected]>

Add a optional property to change LVDS output voltage. This should not be static as this depends mainly on the connected display voltage requirement.

If the property is not present, the default value of 0x05 is used.

---
 drivers/gpu/drm/bridge/ti-sn65dsi83.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/ti-sn65dsi83.c +9 -1
index 57a7ed13f996..d6824f6501b6 100644
@@ -147,6 +147,7 @@ struct sn65dsi83 {
 	struct regulator		*vcc;
 	bool				lvds_dual_link;
 	bool				lvds_dual_link_even_odd_swap;
+	u32				lvds_vcom;
 };
 
 static const struct regmap_range sn65dsi83_readable_ranges[] = {
@@ -435,7 +436,7 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
 		val |= REG_LVDS_FMT_LVDS_LINK_CFG;
 
 	regmap_write(ctx->regmap, REG_LVDS_FMT, val);
-	regmap_write(ctx->regmap, REG_LVDS_VCOM, 0x05);
+	regmap_write(ctx->regmap, REG_LVDS_VCOM, ctx->lvds_vcom);
 	regmap_write(ctx->regmap, REG_LVDS_LANE,
 		     (ctx->lvds_dual_link_even_odd_swap ?
 		      REG_LVDS_LANE_EVEN_ODD_SWAP : 0) |
@@ -580,6 +581,13 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model)
 {
 	struct drm_bridge *panel_bridge;
 	struct device *dev = ctx->dev;
+	struct device_node *endpoint;
+
+	ctx->lvds_vcom = 0x05;
+
+	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, 0);
+	of_property_read_u32(endpoint, "ti,lvds-vcom", &ctx->lvds_vcom);
+	of_node_put(endpoint);
 
 	ctx->lvds_dual_link = false;
 	ctx->lvds_dual_link_even_odd_swap = false;
Signature · 1 line
2.34.1
#8 lore raw

PATCH 3/3 arm64: dts: imx8mm-phyboard-polis-peb-av-10: Set custom lvds_vcom

In reply to Andrej Picej

Set custom differential output voltage for LVDS, to fulfill requirements of the connected display. LVDS diferential voltage for data-lanes and clock output has to be between 200 mV and 600 mV.
Driver sets 200 Ohm near-end termination by default and since LVDS_VCOM_CHA_LVDS_VOD_SWING (0x19) [3:2] sets both data-lane and clock output voltage we have to set the register to the value of 0x0C (0b11 << 2):
- Steady-state differential output voltage for LVDS data-lanes:
min: 300 mV, typ: 402 mV, max: 511 mV
- Steady-state differential output voltage for LVDS clock lane:
min: 234 mV, typ: 314 mV, max: 399 mV

---
 .../boot/dts/freescale/imx8mm-phyboard-polis-peb-av-10.dtso      | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mm-phyboard-polis-peb-av-10.dtso +1 -0
index a9de42cf14be..709b555ca753 100644
@@ -179,6 +179,7 @@ port@0 {
 			bridge_in: endpoint {
 				remote-endpoint = <&dsi_out>;
 				data-lanes = <1 2 3 4>;
+				ti,lvds-vcom = <0x0C>;
 			};
 		};
 
Signature · 1 line
2.34.1
#9 lore raw
In reply to Andrej Picej

Forgot to CC PHYTEC upstream mailing list. Doing this now.

Quoted 24 lines · Andrej Picej

Hi all,

This patch series depends on the patch
"[PATCH 11/15] arm64: dts: imx8mm-phyboard-polis: Add support for PEB-AV-10"
(https://lore.kernel.org/linux-arm-kernel/[email protected]/)
which is currently under review. Please apply the dependent series first before applying this one.

Best regards,
Andrej

Andrej Picej (1):
arm64: dts: imx8mm-phyboard-polis-peb-av-10: Set custom lvds_vcom

Janine Hagemann (2):
dt-bindings: drm/bridge: ti-sn65dsi83: Add optional property
ti,lvds-vcom
drm/bridge: ti-sn65dsi83: Add ti,lvds-vcom as optional property

  .../bindings/display/bridge/ti,sn65dsi83.yaml      | 14 +++++++++++++-
  .../freescale/imx8mm-phyboard-polis-peb-av-10.dtso |  1 +
  drivers/gpu/drm/bridge/ti-sn65dsi83.c              | 10 +++++++++-
  3 files changed, 23 insertions(+), 2 deletions(-)