Add generic-display-mux driver and bindings
Subsystems (4)
v2 cover Add generic-display-mux driver and bindings
This is the v2 the mux driver part of v1. This series is developed for and tested on MT8173 board, whose layout looks like:
/-- anx7688
-- MT8173 HDMI bridge -- GPIO mux
\-- native HDMI
v1: https://patchwork.kernel.org/project/dri-devel/cover/[email protected]/
The other drm bridge callbacks is dropped in this version because:
- The non-atomic callbacks are deprecated
- It would be complicated to pass the atomic state to the downstream
- We actually don't have the hardware to test them
Changes in v2:
- Referenced existing dt-binding schemas from graph.yaml
- Added ddc-i2c-bus into the bindings
- Dropped attach/mode_set/enable/disable callbacks
- Fixed style issues
- Removed the special case for the HDMI connector
- Made the driver only read the GPIO status in IRQ handler
- Rebased to drm-misc-next
- Updated the license: "GPL v2" --> "GPL"
Nicolas Boichat (2):
dt-bindings: display: bridge: Add GPIO display mux binding
drm: bridge: Generic GPIO mux driver
.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++ drivers/gpu/drm/bridge/Kconfig | 10 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/generic-gpio-mux.c | 201 ++++++++++++++++++ 4 files changed, 307 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml create mode 100644 drivers/gpu/drm/bridge/generic-gpio-mux.c
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
PATCH v2 1/2 dt-bindings: display: bridge: Add GPIO display mux binding
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
---
Changes in v2:
- Referenced existing dt-binding schemas from graph.yaml
- Added ddc-i2c-bus into the bindings
.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +95 -0
@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1 + input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-mux + + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active output + + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandle + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + }; + + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + };
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
Rob Herring
maintainerRe: [PATCH v2 1/2] dt-bindings: display: bridge: Add GPIO display mux binding
Quoted 35 lines · Pin-yen Lin
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
Signed-off-by Nicolas Boichat <[email protected]>Signed-off-by Pin-yen Lin <[email protected]>---
Changes in v2:
- Referenced existing dt-binding schemas fromgraph.yaml
- Added ddc-i2c-bus into the bindings.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yamlDocumentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +13
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 23
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +10
-0+ input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-mux + + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active output
What are we detecting? That implies an input, but this is selecting the output path, right? Or what does 'mux status is controlled by hardware' mean exactly? Something else? That does not sound very generic.
In any case, we have a common mux binding so any kind of mux control could be used here, not just GPIO. Then you can make this just a generic display mux.
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 27
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandle
This belongs in the connector node(s).
Quoted 71 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +68
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + }; + + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + };Signature · 1 line
2.39.0.314.g84b9a713c41-goog
Re: [PATCH v2 1/2] dt-bindings: display: bridge: Add GPIO display mux binding
Hi Rob,
Thanks for the review.
Quoted 43 lines · Rob Herring
Quoted 41 lines · Pin-yen Lin
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
Signed-off-by Nicolas Boichat <[email protected]>Signed-off-by Pin-yen Lin <[email protected]>---
Changes in v2:
- Referenced existing dt-binding schemas fromgraph.yaml
- Added ddc-i2c-bus into the bindings.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yamlDocumentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +19
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1 + input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-mux
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active outputWhat are we detecting? That implies an input, but this is selecting the output path, right? Or what does 'mux status is controlled by hardware' mean exactly? Something else? That does not sound very generic.
The GPIO (or any kind of MUX) is an input that indicates where the output should go. The actual "output selection" procedure is done in the driver. That is, the driver monitors this GPIO and selects the output path accordingly. In our use case, the GPIO is reported by the embedded controller on the device.
[1] listed other similar bridges that can leverage this driver, so we called this driver "generic".
[1]: https://lore.kernel.org/all/CAJMQK-jGw8kJFNjoHjeZUL+3NCiOS2hgGERnAnMwNsL_cm_J=Q@mail.gmail.com/
Quoted 4 lines
In any case, we have a common mux binding so any kind of mux control could be used here, not just GPIO. Then you can make this just a generic display mux.
Thanks for sharing this, I'll update the binding in the next version.
Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 27
Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandleThis belongs in the connector node(s).
The HDMI bridge before the MUX doesn't (and doesn't have to) know that its next bridge is a MUX. We put it here so that the HDMI bridge can parse the phandle and get the bus node.
Regards,
Pin-yen
Quoted 72 lines
Quoted 72 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +68
-1+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + }; + + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + }; --2.39.0.314.g84b9a713c41-goog
Laurent Pinchart
reviewerRe: [PATCH v2 1/2] dt-bindings: display: bridge: Add GPIO display mux binding
Quoted 74 lines · Pin-yen Lin
Quoted 42 lines · Rob Herring
Quoted 41 lines · Pin-yen Lin
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
Signed-off-by Nicolas Boichat <[email protected]>Signed-off-by Pin-yen Lin <[email protected]>---
Changes in v2:
- Referenced existing dt-binding schemas fromgraph.yaml
- Added ddc-i2c-bus into the bindings.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yamlDocumentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +19
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1 + input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-muxQuoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active outputWhat are we detecting? That implies an input, but this is selecting the output path, right? Or what does 'mux status is controlled by hardware' mean exactly? Something else? That does not sound very generic.
The GPIO (or any kind of MUX) is an input that indicates where the output should go. The actual "output selection" procedure is done in the driver. That is, the driver monitors this GPIO and selects the output path accordingly. In our use case, the GPIO is reported by the embedded controller on the device.
[1] listed other similar bridges that can leverage this driver, so we called this driver "generic".
[1]: https://lore.kernel.org/all/CAJMQK-jGw8kJFNjoHjeZUL+3NCiOS2hgGERnAnMwNsL_cm_J=Q@mail.gmail.com/
Quoted 3 lines
In any case, we have a common mux binding so any kind of mux control could be used here, not just GPIO. Then you can make this just a generic display mux.
Thanks for sharing this, I'll update the binding in the next version.
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandle
Quoted 5 lines
Quoted 1 line
This belongs in the connector node(s).
The HDMI bridge before the MUX doesn't (and doesn't have to) know that its next bridge is a MUX. We put it here so that the HDMI bridge can parse the phandle and get the bus node.
How does that work, does the HDMI encoder driver parse the ddc-i2c-bus property of the next DT node in the OF graph ?
Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +68
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + }; + + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 1/2] dt-bindings: display: bridge: Add GPIO display mux binding
Hi Laurent,
Quoted 76 lines · Laurent Pinchart
Quoted 74 lines · Pin-yen Lin
Quoted 42 lines · Rob Herring
Quoted 41 lines · Pin-yen Lin
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
Signed-off-by Nicolas Boichat <[email protected]>Signed-off-by Pin-yen Lin <[email protected]>---
Changes in v2:
- Referenced existing dt-binding schemas fromgraph.yaml
- Added ddc-i2c-bus into the bindings.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yamlDocumentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +19
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1 + input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-muxQuoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active outputWhat are we detecting? That implies an input, but this is selecting the output path, right? Or what does 'mux status is controlled by hardware' mean exactly? Something else? That does not sound very generic.
The GPIO (or any kind of MUX) is an input that indicates where the output should go. The actual "output selection" procedure is done in the driver. That is, the driver monitors this GPIO and selects the output path accordingly. In our use case, the GPIO is reported by the embedded controller on the device.
[1] listed other similar bridges that can leverage this driver, so we called this driver "generic".
[1]: https://lore.kernel.org/all/CAJMQK-jGw8kJFNjoHjeZUL+3NCiOS2hgGERnAnMwNsL_cm_J=Q@mail.gmail.com/
Quoted 3 lines
In any case, we have a common mux binding so any kind of mux control could be used here, not just GPIO. Then you can make this just a generic display mux.
Thanks for sharing this, I'll update the binding in the next version.
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandle
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
This belongs in the connector node(s).
The HDMI bridge before the MUX doesn't (and doesn't have to) know that its next bridge is a MUX. We put it here so that the HDMI bridge can parse the phandle and get the bus node.
How does that work, does the HDMI encoder driver parse the ddc-i2c-bus property of the next DT node in the OF graph ?
Yes. In our use case, mtk_hdmi.c[2] checks the remote node of its output port to get the bus phandle. sun4i_hdmi_enc.c[3] seems to use a similar approach as well.
[2]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/mediatek/mtk_hdmi.c#L1500
[3]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c#L240
Regards,
Pin-yen
Quoted 74 lines
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +60
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + };Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 95
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +8
-0+ + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + };--
Regards,Laurent Pinchart
Laurent Pinchart
reviewerRe: [PATCH v2 1/2] dt-bindings: display: bridge: Add GPIO display mux binding
Hello Pin-yen,
Quoted 82 lines · Pin-yen Lin
Quoted 81 lines · Laurent Pinchart
Quoted 79 lines · Pin-yen Lin
Quoted 42 lines · Rob Herring
Quoted 41 lines · Pin-yen Lin
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
Signed-off-by Nicolas Boichat <[email protected]>Signed-off-by Pin-yen Lin <[email protected]>---
Changes in v2:
- Referenced existing dt-binding schemas fromgraph.yaml
- Added ddc-i2c-bus into the bindings.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yamlDocumentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +19
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1 + input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-muxQuoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active outputWhat are we detecting? That implies an input, but this is selecting the output path, right? Or what does 'mux status is controlled by hardware' mean exactly? Something else? That does not sound very generic.
The GPIO (or any kind of MUX) is an input that indicates where the output should go. The actual "output selection" procedure is done in the driver. That is, the driver monitors this GPIO and selects the output path accordingly. In our use case, the GPIO is reported by the embedded controller on the device.
[1] listed other similar bridges that can leverage this driver, so we called this driver "generic".
[1]: https://lore.kernel.org/all/CAJMQK-jGw8kJFNjoHjeZUL+3NCiOS2hgGERnAnMwNsL_cm_J=Q@mail.gmail.com/
Quoted 3 lines
In any case, we have a common mux binding so any kind of mux control could be used here, not just GPIO. Then you can make this just a generic display mux.
Thanks for sharing this, I'll update the binding in the next version.
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 27
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandleThis belongs in the connector node(s).
The HDMI bridge before the MUX doesn't (and doesn't have to) know that its next bridge is a MUX. We put it here so that the HDMI bridge can parse the phandle and get the bus node.
Quoted 6 lines
Quoted 2 lines
How does that work, does the HDMI encoder driver parse the ddc-i2c-bus property of the next DT node in the OF graph ?
Yes. In our use case, mtk_hdmi.c[2] checks the remote node of its output port to get the bus phandle. sun4i_hdmi_enc.c[3] seems to use a similar approach as well.
Peeking into nodes of other devices is a bad practice. I don't know how the code you mention below got merged, but I'm pretty sure I would have flagged it if I had reviewed the patches :-)
The ddc-i2c-bus property should instead be specified in the node where it logically belongs (in this case, the connector node), and handled by the connector driver. You can then use drm_bridge operations to tie things together, like done in the drm_bridge_connector helper. I'd recommend using the drm_bridge_connector helper if you can, either as-is, or by extending it.
Quoted 71 lines
[2]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/mediatek/mtk_hdmi.c#L1500
[3]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c#L240Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +68
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + }; + + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 1/2] dt-bindings: display: bridge: Add GPIO display mux binding
Hi Laurent,
Quoted 97 lines · Laurent Pinchart
Hello Pin-yen,
Quoted 82 lines · Pin-yen Lin
Quoted 81 lines · Laurent Pinchart
Quoted 79 lines · Pin-yen Lin
Quoted 42 lines · Rob Herring
Quoted 41 lines · Pin-yen Lin
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
Signed-off-by Nicolas Boichat <[email protected]>Signed-off-by Pin-yen Lin <[email protected]>---
Changes in v2:
- Referenced existing dt-binding schemas fromgraph.yaml
- Added ddc-i2c-bus into the bindings.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yamlDocumentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +19
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1 + input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-muxQuoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active outputWhat are we detecting? That implies an input, but this is selecting the output path, right? Or what does 'mux status is controlled by hardware' mean exactly? Something else? That does not sound very generic.
The GPIO (or any kind of MUX) is an input that indicates where the output should go. The actual "output selection" procedure is done in the driver. That is, the driver monitors this GPIO and selects the output path accordingly. In our use case, the GPIO is reported by the embedded controller on the device.
[1] listed other similar bridges that can leverage this driver, so we called this driver "generic".
[1]: https://lore.kernel.org/all/CAJMQK-jGw8kJFNjoHjeZUL+3NCiOS2hgGERnAnMwNsL_cm_J=Q@mail.gmail.com/
Quoted 3 lines
In any case, we have a common mux binding so any kind of mux control could be used here, not just GPIO. Then you can make this just a generic display mux.
Thanks for sharing this, I'll update the binding in the next version.
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 27
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandleThis belongs in the connector node(s).
The HDMI bridge before the MUX doesn't (and doesn't have to) know that its next bridge is a MUX. We put it here so that the HDMI bridge can parse the phandle and get the bus node.
Quoted 6 lines
Quoted 2 lines
How does that work, does the HDMI encoder driver parse the ddc-i2c-bus property of the next DT node in the OF graph ?
Yes. In our use case, mtk_hdmi.c[2] checks the remote node of its output port to get the bus phandle. sun4i_hdmi_enc.c[3] seems to use a similar approach as well.
Peeking into nodes of other devices is a bad practice. I don't know how the code you mention below got merged, but I'm pretty sure I would have flagged it if I had reviewed the patches :-)
Quoted 6 lines
The ddc-i2c-bus property should instead be specified in the node where it logically belongs (in this case, the connector node), and handled by the connector driver. You can then use
drm_bridgeoperations to tie things together, like done in thedrm_bridge_connectorhelper. I'd recommend using thedrm_bridge_connectorhelper if you can, either as-is, or by extending it.
So, even if the connector does not have its own i2c controller, we should put ddc-i2c-bus property in the connector DT node and tell the DRM core that this bridge (driver) has the ability to read EDID?
If so, I'll fix up the mtk_hdmi.c driver and update the anx7688 driver in the next version.
Regards,
Pin-yen
Quoted 77 lines
Quoted 64 lines
[2]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/mediatek/mtk_hdmi.c#L1500
[3]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c#L240Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
Quoted 60 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +60
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + };Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 95
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +8
-0+ + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + };--
Regards,Laurent Pinchart
Laurent Pinchart
reviewerRe: [PATCH v2 1/2] dt-bindings: display: bridge: Add GPIO display mux binding
Hello Pin-yen,
Quoted 102 lines · Pin-yen Lin
Quoted 94 lines · Laurent Pinchart
Quoted 82 lines · Pin-yen Lin
Quoted 81 lines · Laurent Pinchart
Quoted 79 lines · Pin-yen Lin
Quoted 42 lines · Rob Herring
Quoted 41 lines · Pin-yen Lin
From: Nicolas Boichat <[email protected]>
Add bindings for Generic GPIO mux driver.
Signed-off-by Nicolas Boichat <[email protected]>Signed-off-by Pin-yen Lin <[email protected]>---
Changes in v2:
- Referenced existing dt-binding schemas fromgraph.yaml
- Added ddc-i2c-bus into the bindings.../bindings/display/bridge/gpio-mux.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/gpio-mux.yamlDocumentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +19
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/gpio-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic display mux (1 input, 2 outputs) + +maintainers: + - Nicolas Boichat <[email protected]> + +description: | + This bindings describes a simple display (e.g. HDMI) mux, that has 1 + input, and 2 outputs. The mux status is controlled by hardware, and + its status is read back using a GPIO. + +properties: + compatible: + const: gpio-display-muxQuoted 8 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 23
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + detect-gpios: + maxItems: 1 + description: GPIO that indicates the active outputWhat are we detecting? That implies an input, but this is selecting the output path, right? Or what does 'mux status is controlled by hardware' mean exactly? Something else? That does not sound very generic.
The GPIO (or any kind of MUX) is an input that indicates where the output should go. The actual "output selection" procedure is done in the driver. That is, the driver monitors this GPIO and selects the output path accordingly. In our use case, the GPIO is reported by the embedded controller on the device.
[1] listed other similar bridges that can leverage this driver, so we called this driver "generic".
[1]: https://lore.kernel.org/all/CAJMQK-jGw8kJFNjoHjeZUL+3NCiOS2hgGERnAnMwNsL_cm_J=Q@mail.gmail.com/
Quoted 3 lines
In any case, we have a common mux binding so any kind of mux control could be used here, not just GPIO. Then you can make this just a generic display mux.
Thanks for sharing this, I'll update the binding in the next version.
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml line 27
Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +4
-0+ + ddc-i2c-bus: + description: phandle link to the I2C controller used for DDC EDID probing + $ref: /schemas/types.yaml#/definitions/phandleThis belongs in the connector node(s).
The HDMI bridge before the MUX doesn't (and doesn't have to) know that its next bridge is a MUX. We put it here so that the HDMI bridge can parse the phandle and get the bus node.
Quoted 6 lines
Quoted 2 lines
How does that work, does the HDMI encoder driver parse the ddc-i2c-bus property of the next DT node in the OF graph ?
Yes. In our use case, mtk_hdmi.c[2] checks the remote node of its output port to get the bus phandle. sun4i_hdmi_enc.c[3] seems to use a similar approach as well.
Peeking into nodes of other devices is a bad practice. I don't know how the code you mention below got merged, but I'm pretty sure I would have flagged it if I had reviewed the patches :-)
Quoted 6 lines
The ddc-i2c-bus property should instead be specified in the node where it logically belongs (in this case, the connector node), and handled by the connector driver. You can then use
drm_bridgeoperations to tie things together, like done in thedrm_bridge_connectorhelper. I'd recommend using thedrm_bridge_connectorhelper if you can, either as-is, or by extending it.
Quoted 3 lines
So, even if the connector does not have its own i2c controller, we should put ddc-i2c-bus property in the connector DT node and tell the DRM core that this bridge (driver) has the ability to read EDID?
That's the idea, yes, if the DDC lines are connected to an I2C controller on the SoC. Of course, if the DDC lines are connected directly to an HDMI encoder that has an internal I2C controller, then the ddc-i2c-bus property shouldn't be added, and the DRM bridge driver for the HDMI encoder should report the EDID read ability.
Quoted 2 lines
If so, I'll fix up the
mtk_hdmi.cdriver and update the anx7688 driver in the next version.
Thank you. I had a quick look at the mtk_hdmi driver, ideally support for reading EDID should be dropped from there. As far as I understand, the mtk_hdmi bridge is connected to the mtk_dpi bridge, whose driver uses the drm_bridge_connector helper, so it shouldn't be too difficult.
Quoted 71 lines
Quoted 71 lines
Quoted 71 lines
[2]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/mediatek/mtk_hdmi.c#L1500
[3]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c#L240Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
Quoted 68 lines
Documentation/devicetree/bindings/display/bridge/gpio-mux.yaml new file +68
-0+ + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: | + Video port for input. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: | + 2 video ports for output. + The reg value in the endpoints matches the GPIO status: when + GPIO is asserted, endpoint with reg value <1> is selected. + + required: + - port@0 + - port@1 + +required: + - compatible + - detect-gpios + - ports + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + hdmi_mux: hdmi_mux { + compatible = "gpio-display-mux"; + detect-gpios = <&pio 36 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_mux_pins>; + ddc-i2c-bus = <&hdmiddc0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { /* input */ + reg = <0>; + + hdmi_mux_in: endpoint { + remote-endpoint = <&hdmi0_out>; + }; + }; + + port@1 { /* output */ + reg = <1>; + + #address-cells = <1>; + #size-cells = <0>; + + hdmi_mux_out_anx: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_bridge_in>; + }; + + hdmi_mux_out_hdmi: endpoint@1 { + reg = <1>; + remote-endpoint = <&hdmi_connector_in>; + }; + }; + }; + };
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v2 2/2 drm: bridge: Generic GPIO mux driver
In reply to Pin-yen LinFrom: Nicolas Boichat <[email protected]>
This driver supports single input, 2 output display mux (e.g. HDMI mux), that provide its status via a GPIO.
---
Laurent in v1 pointed out that the driver doesn't support panels as a downstream. IIUC this can be done by using drm_of_find_panel_or_bridge callback, but we don't have the hardware for this use case for testing.
Changes in v2:
- Dropped attach/mode_set/enable/disable callbacks
- Fixed style issues
- Removed the special case for the HDMI connector
- Made the driver only read the GPIO status in IRQ handler
- Rebased to drm-misc-next
- Updated the license: "GPL v2" --> "GPL"
drivers/gpu/drm/bridge/Kconfig | 10 ++ drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/generic-gpio-mux.c | 201 ++++++++++++++++++++++ 3 files changed, 212 insertions(+) create mode 100644 drivers/gpu/drm/bridge/generic-gpio-mux.c
drivers/gpu/drm/bridge/Kconfig +10 -0
@@ -84,6 +84,16 @@ config DRM_FSL_LDB help Support for i.MX8MP DPI-to-LVDS on-SoC encoder. +config DRM_GENERIC_GPIO_MUX + tristate "Generic GPIO-controlled mux" + depends on OF + select DRM_KMS_HELPER + help + This bridge driver models a GPIO-controlled display mux with one + input, 2 outputs (e.g. an HDMI mux). The hardware decides which output + is active, reports it as a GPIO, and the driver redirects calls to the + appropriate downstream bridge (if any). + config DRM_ITE_IT6505 tristate "ITE IT6505 DisplayPort bridge" depends on OF
drivers/gpu/drm/bridge/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o obj-$(CONFIG_DRM_FSL_LDB) += fsl-ldb.o +obj-$(CONFIG_DRM_GENERIC_GPIO_MUX) += generic-gpio-mux.o obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o obj-$(CONFIG_DRM_LONTIUM_LT8912B) += lontium-lt8912b.o obj-$(CONFIG_DRM_LONTIUM_LT9211) += lontium-lt9211.o
drivers/gpu/drm/bridge/generic-gpio-mux.c new file +201 -0
201 lines not on this page · raw message
Signature · 1 line
2.39.0.314.g84b9a713c41-goog