drm: bridge: Add TI tmds181 and sn65dp159 driver
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): 1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.d6331613-729b-4f92-9c2d-d2abe6df38d5@emailsignatures365.codetwo.com
v4 cover drm: bridge: Add TI tmds181 and sn65dp159 driver
In the past I've seen (and contributed to) hacks that model the chips as phy or even (really!) clock drivers. Since the chip usually sits between a signal that is (almost) HDMI and a HDMI connector, I decided to stop lying and write it as a DRM bridge driver.
Our experience with these chips is that they work best under manual control enabling them only once the signal is active. At low resolutions (under 4k), the optimal setting is usually to only use redriver mode. Setting the termination to 150-300 Ohms improves EMC performance at lower resolutions, hence the driver enables 75-150 Ohms for HDMI2 modes and defaults to 150-300 Ohm termination for other modes.
Changes in v4:
Use fallback compatibledev_err_probe, this_module, of_match_ptr
Use fallback compatible in driver
Add vcc-supply and vdd-supply in driver
Changes in v3:
Fix duplicate links
Add vcc-supply and vdd-supply
Fix missing type for ti,slew-rate
Lower-case hex values and use defines for EYESCAN registers Remove equalizer code (unlikely to be used)
Remove attributes (no longer useful, undocumented) Fix build for 6.17 kernel
Use devm_drm_bridge_alloc
Sort includes and add linux/bitfield.h
Check chip type and complain on mismatch
Changes in v2:
Document driver specific bindings like slew-rate and threshold Use atomic_enable/disable
Use #defines for bit fields in registers
Allow HDMI 2 compliance
Filter modes on clock range
Use cross-over pixel frequency instead of manual overides Devicetree bindings according to standards
Mike Looijmans (2):
dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159
bindings
drm: bridge: Add TI tmds181 and sn65dp159 driver
.../bindings/display/bridge/ti,tmds181.yaml | 152 +++++++ drivers/gpu/drm/bridge/Kconfig | 11 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/ti-tmds181.c | 401 ++++++++++++++++++ 4 files changed, 565 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml create mode 100644 drivers/gpu/drm/bridge/ti-tmds181.c
Signature · 20 lines
2.43.0 base-commit: 53e760d8949895390e256e723e7ee46618310361 branch: drm-ti-tmds181 Met vriendelijke groet / kind regards, Mike Looijmans System Expert TOPIC Embedded Products B.V. Materiaalweg 4, 5681 RJ Best The Netherlands T: +31 (0) 499 33 69 69 E: [email protected] W: www.topic.nl Please consider the environment before printing this e-mail
PATCH v4 1/2 dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Add DT binding document for TI TMDS181 and SN65DP159 HDMI retimers.
The two chips have similar register maps, but different applications (source vs. sink).
---
Changes in v4:
Use fallback compatible
Changes in v3:
Fix duplicate links
Add vcc-supply and vdd-supply
Fix missing type for ti,slew-rate
Changes in v2:
Document driver specific bindings like slew-rate and threshold
.../bindings/display/bridge/ti,tmds181.yaml | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +152 -0
@@ -0,0 +1,152 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/ti,tmds181.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TMDS181 and SN65DP159 HDMI retimer/redriver chips + +maintainers: + - Mike Looijmans <[email protected]> + +description: | + Texas Instruments TMDS181 and SN65DP159 retimer and redriver chips. + https://www.ti.com/product/TMDS181 + https://www.ti.com/product/SN65DP159 + +properties: + compatible: + oneOf: + - const: ti,tmds181 + - items: + - const: ti,sn65dp159 + - const: ti,tmds181 + + reg: + enum: + - 0x5b + - 0x5c + - 0x5d + - 0x5e + + oe-gpios: + maxItems: 1 + description: GPIO specifier for OE pin (active high). + + vdd-supply: + description: Core power supply, 1.1V + + vcc-supply: + description: IO power supply, 3.3V + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI (ish) input + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI output (panel or bridge) + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + required: + - port@0 + - port@1 + + ti,source-mode: + type: boolean + description: + Force chip to operate in "source" mode. Allows to use + a TMDS181 chip (which defaults to sink) as cable driver. + + ti,sink-mode: + type: boolean + description: + Force chip to operate in "sink" mode. Allows to use + a DP159 chip (defaults to source) for incoming signals. + + ti,retimer-threshold-hz: + minimum: 25000000 + maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode. + + ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode. + + ti,slew-rate: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3 + default: 3 + description: Set slew rate, 0 is slowest, 3 is fastest. + + ti,disable-equalizer: + type: boolean + description: Disable the equalizer (to save power). + + ti,adaptive-equalizer: + type: boolean + description: Set the equalizer to adaptive mode. + +required: + - compatible + - reg + - ports + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + bridge@5b { + compatible = "ti,sn65dp159", "ti,tmds181"; + reg = <0x5b>; + + oe-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&encoder_out>; + }; + }; + + port@1 { + reg = <1>; + + endpoint { + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + }; + };
Signature · 18 lines
2.43.0 Met vriendelijke groet / kind regards, Mike Looijmans System Expert TOPIC Embedded Products B.V. Materiaalweg 4, 5681 RJ Best The Netherlands T: +31 (0) 499 33 69 69 E: [email protected] W: www.topic.nl Please consider the environment before printing this e-mail
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 34 lines · Mike Looijmans
.../bindings/display/bridge/ti,tmds181.yaml | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/ti,tmds181.yamlDocumentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +24
-0@@ -0,0 +1,152 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/ti,tmds181.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TMDS181 and SN65DP159 HDMI retimer/redriver chips + +maintainers: + - Mike Looijmans <[email protected]> + +description: | + Texas Instruments TMDS181 and SN65DP159 retimer and redriver chips. + https://www.ti.com/product/TMDS181 + https://www.ti.com/product/SN65DP159 + +properties: + compatible: + oneOf: + - const: ti,tmds181 + - items: + - const: ti,sn65dp159 + - const: ti,tmds181 +
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 34
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ reg: + enum: + - 0x5b + - 0x5c + - 0x5d + - 0x5e + + oe-gpios: + maxItems: 1 + description: GPIO specifier for OE pin (active high).
So that's reset-gpios or powerdown-gpios (see gpio-consumer-common). At least datasheet calls them that in one place.
Quoted 32 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +32
-0+ + vdd-supply: + description: Core power supply, 1.1V + + vcc-supply: + description: IO power supply, 3.3V + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI (ish) input + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI output (panel or bridge) + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + required:
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 76
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ - port@0 + - port@1 + + ti,source-mode: + type: boolean + description: + Force chip to operate in "source" mode. Allows to use + a TMDS181 chip (which defaults to sink) as cable driver. + + ti,sink-mode:
Aren't these two mutually exclusive? Can same device operate in source and in sink mode simultaneously?
Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +7
-0+ type: boolean + description: + Force chip to operate in "sink" mode. Allows to use + a DP159 chip (defaults to source) for incoming signals. + + ti,retimer-threshold-hz: + minimum: 25000000
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 93
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode. + + ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode.
This suggest it is not applicable to TMDS, so you need to restrict it to disallow it there (see example-schema).
Actually several other properties say they are applicable only to DP159.
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 95
Quoted 2 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +2
-0+ + ti,slew-rate:
Common property is "slew-rate" - see pincfg-node.yaml
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 108
Quoted 13 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +13
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3 + default: 3 + description: Set slew rate, 0 is slowest, 3 is fastest. + + ti,disable-equalizer: + type: boolean + description: Disable the equalizer (to save power). + + ti,adaptive-equalizer: + type: boolean + description: Set the equalizer to adaptive mode.
Can equalizer be disabled and adaptive the same time?
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 115
Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +7
-0+ +required: + - compatible + - reg + - ports + +additionalProperties: false
Best regards,
Krzysztof
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 39 lines · Krzysztof Kozlowski
Quoted 38 lines · Mike Looijmans
.../bindings/display/bridge/ti,tmds181.yaml | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+)create mode 100644
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yamlDocumentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +28
-0@@ -0,0 +1,152 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/ti,tmds181.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TMDS181 and SN65DP159 HDMI retimer/redriver chips + +maintainers: + - Mike Looijmans <[email protected]> + +description: | + Texas Instruments TMDS181 and SN65DP159 retimer and redriver chips. + https://www.ti.com/product/TMDS181 + https://www.ti.com/product/SN65DP159 + +properties: + compatible: + oneOf: + - const: ti,tmds181 + - items: + - const: ti,sn65dp159 + - const: ti,tmds181 + + reg: + enum: + - 0x5b + - 0x5c
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 34
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +6
-0+ - 0x5d + - 0x5e + + oe-gpios: + maxItems: 1 + description: GPIO specifier for OE pin (active high).So that's reset-gpios or powerdown-gpios (see gpio-consumer-common). At least datasheet calls them that in one place.
reset-gpios fits reasonably. Though the pin is labeled "OE".
(Our experience: The pin must be driven low until the power supplies are up. Failure to do so may put the chip in an error state, pulling the I2C lines low, that only a power cycle may resolve. So it's close enough to "reset")
Quoted 36 lines
Quoted 36 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +36
-0+ + vdd-supply: + description: Core power supply, 1.1V + + vcc-supply: + description: IO power supply, 3.3V + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI (ish) input + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI output (panel or bridge) + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + required: + - port@0 + - port@1 + + ti,source-mode:
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 76
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +6
-0+ type: boolean + description: + Force chip to operate in "source" mode. Allows to use + a TMDS181 chip (which defaults to sink) as cable driver. + + ti,sink-mode:Aren't these two mutually exclusive? Can same device operate in source and in sink mode simultaneously?
They're exclusive, yes. Will add that.
Quoted 20 lines
Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +7
-0+ type: boolean + description: + Force chip to operate in "sink" mode. Allows to use + a DP159 chip (defaults to source) for incoming signals. + + ti,retimer-threshold-hz: + minimum: 25000000Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 93
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode. + + ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode.This suggest it is not applicable to TMDS, so you need to restrict it to disallow it there (see example-schema).
Quoted 1 line
Actually several other properties say they are applicable only to DP159.
Will do.
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 95
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +2
-0+ + ti,slew-rate:Common property is "slew-rate" - see
pincfg-node.yaml
Will change to slew-rate.
Quoted 15 lines
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 108
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ default: 3 + description: Set slew rate, 0 is slowest, 3 is fastest. + + ti,disable-equalizer: + type: boolean + description: Disable the equalizer (to save power). + + ti,adaptive-equalizer: + type: boolean + description: Set the equalizer to adaptive mode.Can equalizer be disabled and adaptive the same time?
No, since "adaptive" is the default, I'll just remove that option.
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 115
Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +7
-0+ +required: + - compatible + - reg + - ports + +additionalProperties: falseBest regards,
Krzysztof
Signature · 1 line
Mike Looijmans
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 28 lines · Mike Looijmans
Quoted 19 lines
Quoted 19 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +19
-0+ endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI output (panel or bridge) + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + required: + - port@0 + - port@1 + + ti,source-mode:Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 76
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +6
-0+ type: boolean + description: + Force chip to operate in "source" mode. Allows to use + a TMDS181 chip (which defaults to sink) as cable driver. + + ti,sink-mode:Aren't these two mutually exclusive? Can same device operate in source and in sink mode simultaneously?
Quoted 1 line
They're exclusive, yes. Will add that.
Then either define constraints per variant in if:then: or maybe better use string enum. Not sure what applies where, so tricky to say which choice is better.
Best regards,
Krzysztof
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 28 lines · Krzysztof Kozlowski
Quoted 27 lines · Mike Looijmans
Quoted 27 lines
Quoted 15 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +15
-0+ endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI output (panel or bridge) + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + required:Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 76
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ - port@0 + - port@1 + + ti,source-mode: + type: boolean + description: + Force chip to operate in "source" mode. Allows to use + a TMDS181 chip (which defaults to sink) as cable driver. + + ti,sink-mode:Aren't these two mutually exclusive? Can same device operate in source and in sink mode simultaneously?
Quoted 7 lines
Quoted 1 line
They're exclusive, yes. Will add that.
Then either define constraints per variant in if:then: or maybe better use string enum. Not sure what applies where, so tricky to say which choice is better.
Best regards,
Krzysztof
Since there's already going to be an "if" block, it simplifies parsing to keep the booleans. My first attempt was this, but that doesn't work as I'd expect. Adding "slew-rate" to the example dts results in an error, so apparently the "if" block doesn't do what I think it would and I haven't figured out yet what the correct syntax must be:
if:
properties:
compatible:
contains:
const: ti,sn65dp159
then:
properties:
ti,sink-mode:
type: boolean
description:
Force chip to operate in "sink" mode. Allows to use a DP159 chip (defaults to source) for incoming signals. ti,dvi-mode:
type: boolean
description: Makes the DP159 chip operate in DVI mode. slew-rate:
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3
default: 3
description: Set slew rate, 0 is slowest, 3 is fastest. else:
properties:
ti,source-mode:
type: boolean
description:
Force chip to operate in "source" mode. Allows to use a TMDS181 chip (which defaults to sink) as cable driver.
Signature · 10 lines
Mike Looijmans System Expert TOPIC Embedded Products B.V. Materiaalweg 4, 5681 RJ Best The Netherlands T: +31 (0) 499 33 69 69 E: [email protected] W: www.topic.nl
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 59 lines · Mike Looijmans
Quoted 28 lines · Krzysztof Kozlowski
Quoted 27 lines · Mike Looijmans
Quoted 27 lines
Quoted 15 lines
+ endpoint:
+ $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: falseDocumentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +12
-0+ + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: Video port for HDMI output (panel or bridge) + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + required:Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 76
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ - port@0 + - port@1 + + ti,source-mode: + type: boolean + description: + Force chip to operate in "source" mode. Allows to use + a TMDS181 chip (which defaults to sink) as cable driver. + + ti,sink-mode:Aren't these two mutually exclusive? Can same device operate in source and in sink mode simultaneously?
Quoted 7 lines
Quoted 1 line
They're exclusive, yes. Will add that.
Then either define constraints per variant in if:then: or maybe better use string enum. Not sure what applies where, so tricky to say which choice is better.
Best regards,
KrzysztofSince there's already going to be an "if" block, it simplifies parsing to keep the booleans. My first attempt was this, but that doesn't work as I'd expect. Adding "slew-rate" to the example dts results in an error, so apparently the "if" block doesn't do what I think it would and I haven't figured out yet what the correct syntax must be:
if:
properties:
compatible:
contains:
const: ti,sn65dp159
then:
properties:
ti,sink-mode:
type: boolean
description:
Force chip to operate in "sink" mode. Allows to use a DP159 chip (defaults to source) for incoming signals. ti,dvi-mode:
type: boolean
description: Makes the DP159 chip operate in DVI mode. slew-rate:
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3
default: 3
Quoted 9 lines
description: Set slew rate, 0 is slowest, 3 is fastest. else:
properties:
ti,source-mode:
type: boolean
description:
Force chip to operate in "source" mode. Allows to use a TMDS181 chip (which defaults to sink) as cable driver.
Hmm, apparently one cannot "add" properties in the "if:" block? The opposite approach, disallowing properties, works, e.g.:
if:
properties:
compatible:
contains:
const: ti,sn65dp159
then:
properties:
ti,source-mode: false
else:
properties:
ti,sink-mode: false
ti,dvi-mode: false
slew-rate: false
This produces the wanted behavior, though it looks counter-intuitive to me.
Signature · 1 line
Mike Looijmans
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 29 lines · Mike Looijmans
Quoted 20 lines
if:
properties:
compatible:
contains:
const: ti,sn65dp159
then:
properties:
ti,sink-mode:
type: boolean
description:
Force chip to operate in "sink" mode. Allows to use a DP159 chip (defaults to source) for incoming signals. ti,dvi-mode:
type: boolean
description: Makes the DP159 chip operate in DVI mode. slew-rate:
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3
default: 3Quoted 9 lines
description: Set slew rate, 0 is slowest, 3 is fastest. else:
properties:
ti,source-mode:
type: boolean
description:
Force chip to operate in "source" mode. Allows to use a TMDS181 chip (which defaults to sink) as cable driver.
Quoted 1 line
Hmm, apparently one cannot "add" properties in the "if:" block? The
One can, but should not. Define properties in top level and disallow them.
See also example-schema.
Quoted 15 lines
opposite approach, disallowing properties, works, e.g.:
if:
properties:
compatible:
contains:
const: ti,sn65dp159
then:
properties:
ti,source-mode: false
else:
properties:
ti,sink-mode: false
ti,dvi-mode: false
slew-rate: false
So any device can work in any mode? Then this should be just enum with different defaults.
Best regards,
Krzysztof
Maxime Ripard
maintainerRe: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
In reply to Mike LooijmansDocumentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 89
Quoted 8 lines · Mike Looijmans
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +8
-0+ ti,retimer-threshold-hz: + minimum: 25000000 + maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode.
Why should anyone want to tune this at the firmware level?
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 93
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode.
Ditto. Both describe policy, not hardware.
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 104
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ ti,slew-rate: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3 + default: 3 + description: Set slew rate, 0 is slowest, 3 is fastest. + + ti,disable-equalizer: + type: boolean + description: Disable the equalizer (to save power).
Why shouldn't we disable all the time then? Again, it looks like a policy, and not something that should be set in stone in the firmware.
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 108
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ ti,adaptive-equalizer: + type: boolean + description: Set the equalizer to adaptive mode.
Ditto.
Maxime
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 10 lines · Maxime Ripard
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 89
Quoted 8 lines · Mike Looijmans
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +8
-0+ ti,retimer-threshold-hz: + minimum: 25000000 + maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode.Why should anyone want to tune this at the firmware level?
It's a board property. You'd set this based on the hardware you've soldered on. If your clock and serdes are good quality, there's no need for the chip to be in retimer mode (it will consume more power and actually make the signal worse). At higher speeds, that situation may change, hence the need for a way to describe that. The chip has a similar function built in, but with only 2 choices of cross-over point.
To tune these parameters (retimer, equalizer), you'll probably have to take your equipment to a test facility (like we did). It's not something that end-users would want to tune themselves.
Most of these settings can also be done using pin strapping. I guess it'd be helpful if I added that to the description.
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 93
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode.Ditto. Both describe policy, not hardware.
I would set this flag if I've soldered on a DVI connector instead of a HDMI one. I'd consider that hardware.
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 104
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +10
-0+ ti,slew-rate: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3 + default: 3 + description: Set slew rate, 0 is slowest, 3 is fastest. + + ti,disable-equalizer: + type: boolean + description: Disable the equalizer (to save power).
Quoted 2 lines
Why shouldn't we disable all the time then? Again, it looks like a policy, and not something that should be set in stone in the firmware.
Again, board property. The equalizer is there to make up for things like PCB losses (mismatch maybe?) or serdes running at (or beyond) its maximum. Again, depending on your board you may need this or not. It replaces a pinstrapping option.
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 108
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ ti,adaptive-equalizer: + type: boolean + description: Set the equalizer to adaptive mode.
It's the default setting of the chip so this flag will be removed in the next version.
Quoted 1 line
Maxime
Mike.
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 10 lines · Mike Looijmans
Quoted 9 lines · Maxime Ripard
Quoted 8 lines · Mike Looijmans
+ ti,retimer-threshold-hz:
+ minimum: 25000000
+ maximum: 600000000
+ default: 200000000
+ description:
+ Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode.
Quoted 7 lines
Quoted 1 line
Why should anyone want to tune this at the firmware level?
It's a board property. You'd set this based on the hardware you've soldered on. If your clock and serdes are good quality, there's no need for the chip to be in retimer mode (it will consume more power and actually make the signal worse). At higher speeds, that situation may change, hence the need for a way to describe that. The chip has a similar function built in, but with only 2 choices of cross-over point.
To tune these parameters (retimer, equalizer), you'll probably have to take your equipment to a test facility (like we did). It's not something that end-users would want to tune themselves.
Most of these settings can also be done using pin strapping. I guess it'd be helpful if I added that to the description.
Looking back at the datasheet - once you enable the I2C interface of the pin, many of the pinstrapping options are no longer available (such as slew-rate, dvi/hdmi mode, equalizer and termination). The devicetree properties allow these settings to be applied again.
Quoted 2 lines
...
M.
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
In reply to Mike LooijmansQuoted 27 lines · Mike Looijmans
Quoted 10 lines · Maxime Ripard
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 89
Quoted 8 lines · Mike Looijmans
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +8
-0+ ti,retimer-threshold-hz: + minimum: 25000000 + maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode.Why should anyone want to tune this at the firmware level?
It's a board property. You'd set this based on the hardware you've soldered on. If your clock and serdes are good quality, there's no need for the chip to be in retimer mode (it will consume more power and actually make the signal worse). At higher speeds, that situation may change, hence the need for a way to describe that. The chip has a similar function built in, but with only 2 choices of cross-over point.
To tune these parameters (retimer, equalizer), you'll probably have to take your equipment to a test facility (like we did). It's not something that end-users would want to tune themselves.
Most of these settings can also be done using pin strapping. I guess it'd be helpful if I added that to the description.
Quoted 7 lines
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 93
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode.Ditto. Both describe policy, not hardware.
I would set this flag if I've soldered on a DVI connector instead of a HDMI one. I'd consider that hardware.
Do you need to set this if you have DVI monitor attached to the HDMI connector via the passive cable?
As for the connector type, you can check it in the .atomic_enable by checking drm_connector::connector_type.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 27 lines · Dmitry Baryshkov
Quoted 26 lines · Mike Looijmans
Quoted 10 lines · Maxime Ripard
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 89
Quoted 8 lines · Mike Looijmans
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +8
-0+ ti,retimer-threshold-hz: + minimum: 25000000 + maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode.Why should anyone want to tune this at the firmware level?
It's a board property. You'd set this based on the hardware you've soldered on. If your clock and serdes are good quality, there's no need for the chip to be in retimer mode (it will consume more power and actually make the signal worse). At higher speeds, that situation may change, hence the need for a way to describe that. The chip has a similar function built in, but with only 2 choices of cross-over point.
To tune these parameters (retimer, equalizer), you'll probably have to take your equipment to a test facility (like we did). It's not something that end-users would want to tune themselves.
Most of these settings can also be done using pin strapping. I guess it'd be helpful if I added that to the description.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 93
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode.Ditto. Both describe policy, not hardware.
I would set this flag if I've soldered on a DVI connector instead of a HDMI one. I'd consider that hardware.
Do you need to set this if you have DVI monitor attached to the HDMI connector via the passive cable?
In our testing, the setting didn't appear to have any effect on the video signals. Activating the I2C interface blocks the pinstrapping setting of this bit, that's the only reason it's there.
I've been digging through the datasheet. It appears that the DVI mode disables an I2C slave on the DDC bus, when in HDMI_SEL mode the datasheet says: "Device configured for HDMI (Adaptor ID block is readable through I2C or I2C-over-AUX."
Apparently a better name for the pin would be "disable-adaptor-id-block".
Another approach would be to just always disable it in the driver. It appears to make the retimer "visible" in the DDC path and even allows to change some settings that way (most noticeably, turn it on/off), which will interfere with the driver's functions. If we're directly controlling the device over I2C, one shouldn't be using this secondary interface.
Quoted 2 lines
As for the connector type, you can check it in the .atomic_enable by checking
drm_connector::connector_type.
Assuming this is the last bridge, yes. But see above, I suggest removing this from the bindings and just always set it in the driver.
M.
Re: [PATCH v4 1/2] dt-bindings: drm/bridge: ti-tmds181: Add TI TMDS181 and SN65DP159 bindings
Quoted 46 lines · Mike Looijmans
Quoted 27 lines · Dmitry Baryshkov
Quoted 26 lines · Mike Looijmans
Quoted 10 lines · Maxime Ripard
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 89
Quoted 8 lines · Mike Looijmans
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +8
-0+ ti,retimer-threshold-hz: + minimum: 25000000 + maximum: 600000000 + default: 200000000 + description: + Cross-over point. Up until this pixel clock frequency + the chip remains in the low-power redriver mode. Above + the threshold the chip should operate in retimer mode.Why should anyone want to tune this at the firmware level?
It's a board property. You'd set this based on the hardware you've soldered on. If your clock and serdes are good quality, there's no need for the chip to be in retimer mode (it will consume more power and actually make the signal worse). At higher speeds, that situation may change, hence the need for a way to describe that. The chip has a similar function built in, but with only 2 choices of cross-over point.
To tune these parameters (retimer, equalizer), you'll probably have to take your equipment to a test facility (like we did). It's not something that end-users would want to tune themselves.
Most of these settings can also be done using pin strapping. I guess it'd be helpful if I added that to the description.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml line 93
Quoted 3 lines
Documentation/devicetree/bindings/display/bridge/ti,tmds181.yaml new file +3
-0+ ti,dvi-mode: + type: boolean + description: Makes the DP159 chip operate in DVI mode.Ditto. Both describe policy, not hardware.
I would set this flag if I've soldered on a DVI connector instead of a HDMI one. I'd consider that hardware.
Do you need to set this if you have DVI monitor attached to the HDMI connector via the passive cable?
In our testing, the setting didn't appear to have any effect on the video signals. Activating the I2C interface blocks the pinstrapping setting of this bit, that's the only reason it's there.
I've been digging through the datasheet. It appears that the DVI mode disables an I2C slave on the DDC bus, when in
HDMI_SELmode the datasheet says: "Device configured for HDMI (Adaptor ID block is readable through I2C or I2C-over-AUX."
Quoted 7 lines
Apparently a better name for the pin would be "disable-adaptor-id-block".
Another approach would be to just always disable it in the driver. It appears to make the retimer "visible" in the DDC path and even allows to change some settings that way (most noticeably, turn it on/off), which will interfere with the driver's functions. If we're directly controlling the device over I2C, one shouldn't be using this secondary interface.
If I understand correctly, it's a part of the DP++ standard, so it might be a good idea to keep it enabled.
Quoted 7 lines
Quoted 4 lines
As for the connector type, you can check it in the .atomic_enable by checking
drm_connector::connector_type.Assuming this is the last bridge, yes. But see above, I suggest removing this from the bindings and just always set it in the driver.
Signature · 2 lines
With best wishes Dmitry
PATCH v4 2/2 drm: bridge: Add TI tmds181 and sn65dp159 driver
In reply to Mike LooijmansThe tmds181 and sn65dp159 are "retimers" and hence can be considered HDMI-to-HDMI bridges. Typical usage is to convert the output of an FPGA into a valid HDMI signal, and it will typically be inserted between an encoder and hdmi-connector.
---
Changes in v4:dev_err_probe, this_module, of_match_ptr
Use fallback compatible
Add vcc-supply and vdd-supply
Changes in v3:
Lower-case hex values and use defines for EYESCAN registers Remove equalizer code (unlikely to be used)
Remove attributes (no longer useful, undocumented) Fix build for 6.17 kernel
Use devm_drm_bridge_alloc
Sort includes and add linux/bitfield.h
Check chip type and complain on mismatch
Changes in v2:
Use atomic_enable/disable
Use #defines for bit fields in registers
Allow HDMI 2 compliance
Filter modes on clock range
Use cross-over pixel frequency instead of manual overides Devicetree bindings according to standards
drivers/gpu/drm/bridge/Kconfig | 11 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/ti-tmds181.c | 401 ++++++++++++++++++++++++++++ 3 files changed, 413 insertions(+) create mode 100644 drivers/gpu/drm/bridge/ti-tmds181.c
drivers/gpu/drm/bridge/Kconfig +11 -0
@@ -430,6 +430,17 @@ config DRM_TI_SN65DSI86 help Texas Instruments SN65DSI86 DSI to eDP Bridge driver +config DRM_TI_TMDS181 + tristate "TI TMDS181 and SN65DP159 HDMI retimer bridge driver" + depends on OF + select DRM_KMS_HELPER + select REGMAP_I2C + help + Enable this to support the TI TMDS181 and SN65DP159 HDMI retimers. + The SN65DP159 provides output into a cable (source) whereas the + TMDS181 is meant to forward a cable signal into a PCB (sink). Either + can be set up as source or sink though. + config DRM_TI_TPD12S015 tristate "TI TPD12S015 HDMI level shifter and ESD protection" depends on OF
drivers/gpu/drm/bridge/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_DRM_TI_SN65DSI83) += ti-sn65dsi83.o obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TDP158) += ti-tdp158.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o +obj-$(CONFIG_DRM_TI_TMDS181) += ti-tmds181.o obj-$(CONFIG_DRM_TI_TPD12S015) += ti-tpd12s015.o obj-$(CONFIG_DRM_NWL_MIPI_DSI) += nwl-dsi.o obj-$(CONFIG_DRM_ITE_IT66121) += ite-it66121.o
drivers/gpu/drm/bridge/ti-tmds181.c new file +401 -0
401 lines not on this page · raw message
Signature · 18 lines
2.43.0 Met vriendelijke groet / kind regards, Mike Looijmans System Expert TOPIC Embedded Products B.V. Materiaalweg 4, 5681 RJ Best The Netherlands T: +31 (0) 499 33 69 69 E: [email protected] W: www.topic.nl Please consider the environment before printing this e-mail