drm: Add support for Cadence MHDP DPI/DP bridge and J721E wrapper.
Subsystems (4)
v5 cover drm: Add support for Cadence MHDP DPI/DP bridge and J721E wrapper.
This patch series adds new DRM driver for Cadence Display Port. The Cadence Display Port is also referred as MHDP (Mobile High Definition Link, High-Definition Multimedia Interface Display Port) Cadence Display Port complies with VESA DisplayPort (DP) and embedded Display Port (eDP) standards. This driver implements Single Stream Transport (SST) support. Adds Texas Instruments SoC J721e specific wrapper and adds the device tree bindings in YAML format.
The patch series has three patches which applies the changes in the below sequence
1. 001-dt-bindings-drm-bridge-Document-Cadence-MHDP-bridge-bindings Documents the bindings in yaml format.
2. 002-drm-bridge-Add-support-for-Cadence-MHDP-bridge
This patch adds new DRM driver for Cadence MHDP Display Port. The patch implements supports for single stream transport mode.
3. 003-drm-mhdp-add-j721e-wrapper
Add Texas Instruments (TI) j721e wrapper for mhdp. The wrapper configures mhdp clocks and muxes as required by SoC.
Version History:
v5:
- Added Signed-off-by: Jyri Sarha <[email protected]> tag to the code patches.
v4:
- Added SPDX dual license tag to YAML bindings.
- Corrected indentation of the child node properties.
- Removed the maxItems in the conditional statement.
- Add Reviewed-by: Rob Herring <[email protected]> tag to the Document Cadence MHDP bridge bindings patch.
- Renamed the DRM driver executable name from mhdp8546 to cdns-mhdp in Makefile.
- Renamed the DRM driver and header file from cdns-mhdp to cdns-mhdp-core.
v3:
- Added if / then clause to validate that the reg length is proper based on the value of the compatible property.
- Updated phy property description in YAML to a generic one.
- Renamed num_lanes and max_bit_rate property strings to cdns,num-lanes and cdns,max-bit-rate based on update in PHY series [2].
v2:
- Use enum in compatible property of YAML file.
- Add reg-names property to YAML file
- Add minItems and maxItems to reg property in YAML.
- Remove cdns_mhdp_link_probe function to remove duplication of reading dpcd capabilities.
This patch series is dependent on PHY DisplayPort configuration patch [1]
[1]
https://lkml.org/lkml/2020/1/6/279
[2]
https://lkml.org/lkml/2020/2/6/15
Yuti Amonkar (3):
dt-bindings: drm/bridge: Document Cadence MHDP bridge bindings.
drm: bridge: Add support for Cadence MHDP DPI/DP bridge
drm: bridge: cdns-mhdp: add j721e wrapper
.../bindings/display/bridge/cdns,mhdp.yaml | 125 + drivers/gpu/drm/bridge/Kconfig | 23 + drivers/gpu/drm/bridge/Makefile | 6 + drivers/gpu/drm/bridge/cdns-mhdp-core.c | 2220 +++++++++++++++++ drivers/gpu/drm/bridge/cdns-mhdp-core.h | 381 +++ drivers/gpu/drm/bridge/cdns-mhdp-j721e.c | 79 + drivers/gpu/drm/bridge/cdns-mhdp-j721e.h | 55 + 7 files changed, 2889 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.c create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.h create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.c create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.h
Signature · 1 line
2.20.1
PATCH v5 1/3 dt-bindings: drm/bridge: Document Cadence MHDP bridge bindings.
Document the bindings used for the Cadence MHDP DPI/DP bridge in yaml format.
--- .../bindings/display/bridge/cdns,mhdp.yaml | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +125 -0
@@ -0,0 +1,125 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/bridge/cdns,mhdp.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Cadence MHDP bridge + +maintainers: + - Swapnil Jakhade <[email protected]> + - Yuti Amonkar <[email protected]> + +properties: + compatible: + enum: + - cdns,mhdp8546 + - ti,j721e-mhdp8546 + + reg: + minItems: 1 + maxItems: 2 + items: + - description: + Register block of mhdptx apb registers upto PHY mapped area(AUX_CONFIG_P). + The AUX and PMA registers are mapped to associated phy driver. + - description: + Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs. + + reg-names: + minItems: 1 + maxItems: 2 + items: + - const: mhdptx + - const: j721e-intg + + clocks: + maxItems: 1 + description: + DP bridge clock, it's used by the IP to know how to translate a number of + clock cycles into a time (which is used to comply with DP standard timings + and delays). + + phys: + description: Phandle to the DisplyPort phy. + + ports: + type: object + description: + Ports as described in Documentation/devicetree/bindings/graph.txt + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + port@0: + type: object + description: + input port representing the DP bridge input + + port@1: + type: object + description: + output port representing the DP bridge output. + + required: + - port@0 + - port@1 + - '#address-cells' + - '#size-cells' + +allOf: + - if: + properties: + compatible: + contains: + const: ti,j721e-mhdp8546 + then: + properties: + reg: + minItems: 2 + reg-names: + minItems: 2 + +required: + - compatible + - clocks + - reg + - reg-names + - phys + - ports + +additionalProperties: false + +examples: + - | + mhdp: dp-bridge@f0fb000000 { + compatible = "cdns,mhdp8546"; + reg = <0xf0 0xfb000000 0x0 0x1000000>; + reg-names = "mhdptx"; + clocks = <&mhdp_clock>; + phys = <&dp_phy>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dp_bridge_input: endpoint { + remote-endpoint = <&xxx_dpi_output>; + }; + }; + + port@1 { + reg = <1>; + dp_bridge_output: endpoint { + remote-endpoint = <&xxx_dp_connector_input>; + }; + }; + }; + }; +...
Signature · 1 line
2.20.1
Re: [PATCH v5 1/3] dt-bindings: drm/bridge: Document Cadence MHDP bridge bindings.
Quoted 30 lines · Yuti Amonkar
Document the bindings used for the Cadence MHDP DPI/DP bridge in yaml format.
Signed-off-by Yuti Amonkar <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/display/bridge/cdns,mhdp.yaml | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+)create mode 100644
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yamlDocumentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +14
-0@@ -0,0 +1,125 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/bridge/cdns,mhdp.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Cadence MHDP bridge + +maintainers: + - Swapnil Jakhade <[email protected]> + - Yuti Amonkar <[email protected]> + +properties: + compatible:
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 24
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +10
-0+ enum: + - cdns,mhdp8546 + - ti,j721e-mhdp8546 + + reg: + minItems: 1 + maxItems: 2 + items: + - description: + Register block of mhdptx apb registers upto PHY mapped area(AUX_CONFIG_P).
"up to". Add space before (.
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +10
-0+ The AUX and PMA registers are mapped to associated phy driver. + - description: + Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs. + + reg-names: + minItems: 1 + maxItems: 2 + items: + - const: mhdptx + - const: j721e-intg
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +10
-0+ + clocks: + maxItems: 1 + description: + DP bridge clock, it's used by the IP to know how to translate a number of + clock cycles into a time (which is used to comply with DP standard timings + and delays). + + phys: + description: Phandle to the DisplyPort phy.
"Display"
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Laurent Pinchart
reviewerRe: [PATCH v5 1/3] dt-bindings: drm/bridge: Document Cadence MHDP bridge bindings.
Hi Yuti,
Thank you for the patch.
Quoted 35 lines · Tomi Valkeinen
Quoted 34 lines · Yuti Amonkar
Document the bindings used for the Cadence MHDP DPI/DP bridge in yaml format.
Signed-off-by Yuti Amonkar <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/display/bridge/cdns,mhdp.yaml | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+)create mode 100644
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yamlDocumentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +18
-0@@ -0,0 +1,125 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/bridge/cdns,mhdp.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Cadence MHDP bridge + +maintainers: + - Swapnil Jakhade <[email protected]> + - Yuti Amonkar <[email protected]> + +properties: + compatible: + enum: + - cdns,mhdp8546 + - ti,j721e-mhdp8546 +
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 24
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +6
-0+ reg: + minItems: 1 + maxItems: 2 + items: + - description: + Register block of mhdptx apb registers upto PHY mapped area(AUX_CONFIG_P)."up to". Add space before (.
Quoted 1 line
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +1
-0+ The AUX and PMA registers are mapped to associated phy driver.
I wouldn't mention driver here, as that's a software concept unrelated to DT bindings. You could write "The AUX and PMA registers are not part of this range, they are instead included in the associated PHY.".
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +6
-0+ - description: + Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs. + + reg-names: + minItems: 1 + maxItems: 2
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 39
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +8
-0+ items: + - const: mhdptx + - const: j721e-intg + + clocks: + maxItems: 1 + description: + DP bridge clock, it's used by the IP to know how to translate a number of
s/it's //
Quoted 7 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 44
Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +5
-0+ clock cycles into a time (which is used to comply with DP standard timings + and delays). + + phys: + description: Phandle to the DisplyPort phy."Display"
And s/Phandle/phandle/, and s/phy/PHY/.
Shouldn't this bridge also have port nodes ?
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Laurent Pinchart
reviewerRe: [PATCH v5 1/3] dt-bindings: drm/bridge: Document Cadence MHDP bridge bindings.
Hi Yuti,
Quoted 74 lines · Laurent Pinchart
Quoted 35 lines · Tomi Valkeinen
Quoted 34 lines · Yuti Amonkar
Document the bindings used for the Cadence MHDP DPI/DP bridge in yaml format.
Signed-off-by Yuti Amonkar <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/display/bridge/cdns,mhdp.yaml | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+)create mode 100644
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yamlDocumentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +18
-0@@ -0,0 +1,125 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/bridge/cdns,mhdp.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Cadence MHDP bridge + +maintainers: + - Swapnil Jakhade <[email protected]> + - Yuti Amonkar <[email protected]> + +properties: + compatible: + enum: + - cdns,mhdp8546 + - ti,j721e-mhdp8546 +Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 24
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +6
-0+ reg: + minItems: 1 + maxItems: 2 + items: + - description: + Register block of mhdptx apb registers upto PHY mapped area(AUX_CONFIG_P)."up to". Add space before (.
Quoted 1 line
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +1
-0+ The AUX and PMA registers are mapped to associated phy driver.I wouldn't mention driver here, as that's a software concept unrelated to DT bindings. You could write "The AUX and PMA registers are not part of this range, they are instead included in the associated PHY.".
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +6
-0+ - description: + Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs. + + reg-names: + minItems: 1 + maxItems: 2Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 39
Quoted 8 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +8
-0+ items: + - const: mhdptx + - const: j721e-intg + + clocks: + maxItems: 1 + description: + DP bridge clock, it's used by the IP to know how to translate a number ofs/it's //
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +5
-0+ clock cycles into a time (which is used to comply with DP standard timings + and delays). + + phys: + description: Phandle to the DisplyPort phy.
Quoted 5 lines
Quoted 1 line
"Display"
And s/Phandle/phandle/, and s/phy/PHY/.
Shouldn't this bridge also have port nodes ?
Oops, sorry, I missed that Tomi's reply has removed part of the original patch. Please disregard this last comment, I'll reply to the original.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v5 1/3] dt-bindings: drm/bridge: Document Cadence MHDP bridge bindings.
In reply to Yuti AmonkarHi Yuti,
Thank you for the patch.
Quoted 67 lines · Yuti Amonkar
Document the bindings used for the Cadence MHDP DPI/DP bridge in yaml format.
Signed-off-by Yuti Amonkar <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/display/bridge/cdns,mhdp.yaml | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yamlDocumentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +51
-0@@ -0,0 +1,125 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/bridge/cdns,mhdp.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Cadence MHDP bridge + +maintainers: + - Swapnil Jakhade <[email protected]> + - Yuti Amonkar <[email protected]> + +properties: + compatible: + enum: + - cdns,mhdp8546 + - ti,j721e-mhdp8546 + + reg: + minItems: 1 + maxItems: 2 + items: + - description: + Register block of mhdptx apb registers upto PHY mapped area(AUX_CONFIG_P). + The AUX and PMA registers are mapped to associated phy driver. + - description: + Register block for DSS_EDP0_INTG_CFG_VP registers in case of TI J7 SoCs. + + reg-names: + minItems: 1 + maxItems: 2 + items: + - const: mhdptx + - const: j721e-intg + + clocks: + maxItems: 1 + description: + DP bridge clock, it's used by the IP to know how to translate a number of + clock cycles into a time (which is used to comply with DP standard timings + and delays). + + phys: + description: Phandle to the DisplyPort phy. + + ports: + type: object + description: + Ports as described in Documentation/devicetree/bindings/graph.txt + + properties:
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 61
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +10
-0+ '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + port@0: + type: object + description: + input port representing the DP bridge input
s/input port/Input port/ and s/bridge input/bridge input./
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 66
Quoted 5 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +5
-0+ + port@1: + type: object + description: + output port representing the DP bridge output.
s/output port/Output port/
Quoted 49 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +49
-0+ + required: + - port@0 + - port@1 + - '#address-cells' + - '#size-cells' + +allOf: + - if: + properties: + compatible: + contains: + const: ti,j721e-mhdp8546 + then: + properties: + reg: + minItems: 2 + reg-names: + minItems: 2 + +required: + - compatible + - clocks + - reg + - reg-names + - phys + - ports + +additionalProperties: false + +examples: + - | + mhdp: dp-bridge@f0fb000000 { + compatible = "cdns,mhdp8546"; + reg = <0xf0 0xfb000000 0x0 0x1000000>; + reg-names = "mhdptx"; + clocks = <&mhdp_clock>; + phys = <&dp_phy>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dp_bridge_input: endpoint { + remote-endpoint = <&xxx_dpi_output>; + }; + };
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml line 125
Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/cdns,mhdp.yaml new file +10
-0+ + port@1 { + reg = <1>; + dp_bridge_output: endpoint { + remote-endpoint = <&xxx_dp_connector_input>; + }; + }; + }; + }; +...
Really good bindings ! With the above comments addressed, as well as he one in reply to Tomi's review,
Signature · 7 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v5 2/3 drm: bridge: Add support for Cadence MHDP DPI/DP bridge
In reply to Yuti AmonkarThis patch adds new DRM driver for Cadence MHDP DPTX IP used on J721e SoC. MHDP DPTX IP is the component that complies with VESA DisplayPort (DP) and embedded Display Port (eDP) standards. It integrates uCPU running the embedded Firmware(FW) interfaced over APB interface. Basically, it takes a DPI stream as input and output it encoded in DP format. Currently, it supports only SST mode.
--- drivers/gpu/drm/bridge/Kconfig | 11 + drivers/gpu/drm/bridge/Makefile | 3 + drivers/gpu/drm/bridge/cdns-mhdp-core.c | 2206 +++++++++++++++++++++++ drivers/gpu/drm/bridge/cdns-mhdp-core.h | 380 ++++ 4 files changed, 2600 insertions(+) create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.c create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-core.h
drivers/gpu/drm/bridge/Kconfig +11 -0
@@ -27,6 +27,17 @@ config DRM_CDNS_DSI Support Cadence DPI to DSI bridge. This is an internal bridge and is meant to be directly embedded in a SoC. +config DRM_CDNS_MHDP + tristate "Cadence DPI/DP bridge" + select DRM_KMS_HELPER + select DRM_PANEL_BRIDGE + depends on OF + help + Support Cadence DPI to DP bridge. This is an internal + bridge and is meant to be directly embedded in a SoC. + It takes a DPI stream as input and output it encoded + in DP format. + config DRM_DUMB_VGA_DAC tristate "Dumb VGA DAC Bridge support" depends on OF
drivers/gpu/drm/bridge/Makefile +3 -0
@@ -15,6 +15,9 @@ obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o +obj-$(CONFIG_DRM_CDNS_MHDP) += cdns-mhdp.o obj-y += analogix/ obj-y += synopsys/ + +cdns-mhdp-objs := cdns-mhdp-core.o
drivers/gpu/drm/bridge/cdns-mhdp-core.c new file +2206 -0
2,206 lines not on this page · raw message
drivers/gpu/drm/bridge/cdns-mhdp-core.h new file +380 -0
380 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v5 2/3] drm: bridge: Add support for Cadence MHDP DPI/DP bridge
Quoted 45 lines · Yuti Amonkar
This patch adds new DRM driver for Cadence MHDP DPTX IP used on J721e SoC. MHDP DPTX IP is the component that complies with VESA DisplayPort (DP) and embedded Display Port (eDP) standards. It integrates uCPU running the embedded Firmware(FW) interfaced over APB interface. Basically, it takes a DPI stream as input and output it encoded in DP format. Currently, it supports only SST mode.
Signed-off-by Yuti Amonkar <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/gpu/drm/bridge/Kconfig | 11 + drivers/gpu/drm/bridge/Makefile | 3 + drivers/gpu/drm/bridge/cdns-mhdp-core.c | 2206 +++++++++++++++++++++++ drivers/gpu/drm/bridge/cdns-mhdp-core.h | 380 ++++ 4 files changed, 2600 insertions(+)create mode 100644
drivers/gpu/drm/bridge/cdns-mhdp-core.ccreate mode 100644drivers/gpu/drm/bridge/cdns-mhdp-core.hdrivers/gpu/drm/bridge/Kconfig +11
-0@@ -27,6 +27,17 @@ config DRM_CDNS_DSI Support Cadence DPI to DSI bridge. This is an internal bridge and is meant to be directly embedded in a SoC. +config DRM_CDNS_MHDP + tristate "Cadence DPI/DP bridge" + select DRM_KMS_HELPER + select DRM_PANEL_BRIDGE + depends on OF + help + Support Cadence DPI to DP bridge. This is an internal + bridge and is meant to be directly embedded in a SoC. + It takes a DPI stream as input and output it encoded + in DP format. + config DRM_DUMB_VGA_DAC tristate "Dumb VGA DAC Bridge support" depends on OFdrivers/gpu/drm/bridge/Makefile +0
-0
drivers/gpu/drm/bridge/Makefile obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o · line 23
Quoted 9 lines
drivers/gpu/drm/bridge/Makefile +3
-0@@ -15,6 +15,9 @@ obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o +obj-$(CONFIG_DRM_CDNS_MHDP) += cdns-mhdp.o obj-y += analogix/ obj-y += synopsys/ + +cdns-mhdp-objs := cdns-mhdp-core.o
I think it's better to keep the two lines added in this change together, instead of having those other obj-y lines in between.
drivers/gpu/drm/bridge/cdns-mhdp-core.c line 7
Quoted 13 lines
drivers/gpu/drm/bridge/cdns-mhdp-core.c new file +7
-0@@ -0,0 +1,2206 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Cadence MHDP DP bridge driver. +* +* Copyright: 2019 Cadence Design Systems, Inc. +* +* Author: Quentin Schulz <[email protected]>
Author is Quentin, but there's no signed-off-by from him? There are also many names in MODULE_AUTHOR, without signed-off-bys.
I think the rule is that you should have signed-off-bys for people who have contributed. I'm not sure how strict that rule is, and what to do if the people cannot be reached anymore.
<snip>
Quoted 192 lines
drivers/gpu/drm/bridge/cdns-mhdp-core.c new file +192
-0+static int mhdp_probe (struct platform_device *pdev) +{ +const struct of_device_id *match; +struct resource *regs; +struct cdns_mhdp_device *mhdp; +struct clk *clk; +int ret; +unsigned long rate; +int irq; +u32 lanes_prop; +unsigned int link_rate; + + mhdp =devm_kzalloc (&pdev->dev,sizeof (struct cdns_mhdp_device ), +GFP_KERNEL ); +if (!mhdp) +return -ENOMEM ; + + clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (clk)) { +dev_err (&pdev->dev,"couldn't get clk: %ld\n" ,PTR_ERR (clk)); +return PTR_ERR (clk); + } + + mhdp->clk = clk; + mhdp->dev = &pdev->dev; + mhdp->conn_bus_flags_defaults =DRM_BUS_FLAG_DE_HIGH ; +mutex_init (&mhdp->mbox_mutex); +spin_lock_init (&mhdp->start_lock); +dev_set_drvdata (&pdev->dev, mhdp); + +drm_dp_aux_init (&mhdp->aux); + mhdp->aux.dev = &pdev->dev; + mhdp->aux.transfer = mhdp_transfer; + + regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + mhdp->regs =devm_ioremap_resource (&pdev->dev, regs); +if (IS_ERR (mhdp->regs)) +return PTR_ERR (mhdp->regs); + + mhdp->phy =devm_of_phy_get_by_index (&pdev->dev, pdev->dev.of_node,0 ); +if (IS_ERR (mhdp->phy)) { +dev_err (&pdev->dev,"no PHY configured\n" ); +return PTR_ERR (mhdp->phy); + } + +platform_set_drvdata (pdev, mhdp); + +clk_prepare_enable (clk); + + match =of_match_device (mhdp_ids, &pdev->dev); +if (!match) +return -ENODEV ; + mhdp->ops = (struct mhdp_platform_ops *)match->data; + +pm_runtime_enable (&pdev->dev); + ret =pm_runtime_get_sync (&pdev->dev); +if (ret <0 ) { +dev_err (&pdev->dev,"pm_runtime_get_sync failed\n" ); +pm_runtime_disable (&pdev->dev); + goto clk_disable; + } + +if (mhdp->ops && mhdp->ops->init) { + ret = mhdp->ops->init (mhdp); +if (ret !=0 ) { +dev_err (&pdev->dev,"MHDP platform initialization failed: %d\n" , + ret); + goto runtime_put; + } + } + + rate =clk_get_rate (clk); +writel (rate %1000000 , mhdp->regs +CDNS_SW_CLK_L ); +writel (rate /1000000 , mhdp->regs +CDNS_SW_CLK_H ); + +dev_dbg (&pdev->dev,"func clk rate %lu Hz\n" , rate); + +writel (~0 , mhdp->regs +CDNS_MB_INT_MASK ); +writel (~0 , mhdp->regs +CDNS_APB_INT_MASK ); + + irq =platform_get_irq (pdev,0 ); + ret =devm_request_threaded_irq (mhdp->dev, irq,NULL , mhdp_irq_handler, +IRQF_ONESHOT ,"mhdp8546" , mhdp); +if (ret) { +dev_err (&pdev->dev,"cannot install IRQ %d\n" , irq); + ret = -EIO ; + goto plat_fini; + } + +/* Read source capabilities, based on PHY's device tree properties. */ + ret =device_property_read_u32 (&mhdp->phy->dev,"cdns,num-lanes" , + &(lanes_prop)); +if (ret) + mhdp->host.lanes_cnt =CDNS_LANE_4 ; +else + mhdp->host.lanes_cnt = lanes_prop; + + ret =device_property_read_u32 (&mhdp->phy->dev,"cdns,max-bit-rate" , + &(link_rate)); +if (ret) + link_rate =drm_dp_bw_code_to_link_rate (DP_LINK_BW_8_1 ); +else +/* PHY uses Mb/s, DRM uses tens of kb/s. */ + link_rate *=100 ; + + mhdp->host.link_rate = link_rate; + mhdp->host.volt_swing =CDNS_VOLT_SWING (3 ); + mhdp->host.pre_emphasis =CDNS_PRE_EMPHASIS (3 ); + mhdp->host.pattern_supp =CDNS_SUPPORT_TPS (1 ) | +CDNS_SUPPORT_TPS (2 ) |CDNS_SUPPORT_TPS (3 ) | +CDNS_SUPPORT_TPS (4 ); + mhdp->host.lane_mapping =CDNS_LANE_MAPPING_NORMAL ; + mhdp->host.fast_link = false; + mhdp->host.enhanced = true; + mhdp->host.scrambler = true; + mhdp->host.ssc = false; + +/* The only currently supported format */ + mhdp->display_fmt.y_only = false; + mhdp->display_fmt.color_format =DRM_COLOR_FORMAT_RGB444 ; + mhdp->display_fmt.bpc =8 ; + + mhdp->bridge.of_node = pdev->dev.of_node; + mhdp->bridge.funcs = &cdns_mhdp_bridge_funcs; + + ret =phy_init (mhdp->phy); +if (ret) { +dev_err (mhdp->dev,"Failed to initialize PHY: %d\n" , ret); + goto runtime_put; + } + + ret =load_firmware (mhdp); +if (ret) + goto phy_exit; + +drm_bridge_add (&mhdp->bridge); + +return 0 ; + +phy_exit: +phy_exit (mhdp->phy); +plat_fini: +if (mhdp->ops && mhdp->ops->exit) + mhdp->ops->exit (mhdp); +runtime_put: +pm_runtime_put_sync (&pdev->dev); +pm_runtime_disable (&pdev->dev); +clk_disable: +clk_disable_unprepare (mhdp->clk); + +return ret; +} + +MODULE_FIRMWARE (FW_NAME ); + +static int mhdp_remove (struct platform_device *pdev) +{ +struct cdns_mhdp_device *mhdp =dev_get_drvdata (&pdev->dev); +unsigned int timeout =10 ; +bool stop_fw = false; +int ret =0 ; + +if (mhdp->ops && mhdp->ops->exit) + mhdp->ops->exit (mhdp); + +drm_bridge_remove (&mhdp->bridge); + +wait_loading: +spin_lock (&mhdp->start_lock); +if (mhdp->hw_state ==MHDP_HW_LOADING && timeout-- >0 ) { +spin_unlock (&mhdp->start_lock); +msleep (100 ); + goto wait_loading; + }else if (mhdp->hw_state ==MHDP_HW_READY ) { + stop_fw = true; + timeout =1 ;/* We were successful even if counter reached 0 */ + } + mhdp->hw_state =MHDP_HW_STOPPED ; +spin_unlock (&mhdp->start_lock); + +if (timeout ==0 ) +dev_err (mhdp->dev,"%s: Timeout waiting for fw loading\n" , + __func__); + +if (stop_fw) { + ret =cdns_mhdp_set_firmware_active (mhdp, false); +if (ret) +dev_err (mhdp->dev,"%s: De-activate FW failed: %d\n" , + __func__, ret); + } + +phy_exit (mhdp->phy);
drivers/gpu/drm/bridge/cdns-mhdp-core.c line 2187
Quoted 10 lines
drivers/gpu/drm/bridge/cdns-mhdp-core.c new file +10
-0+ +pm_runtime_put_sync (&pdev->dev); +pm_runtime_disable (&pdev->dev); + +clk_disable_unprepare (mhdp->clk); + +/* FIXME: check for missing functions */ + +return ret; +}
The sequence here does not match what's done at probe()'s error handling. It probably should.
The FIXME here sounds something that has to be fixed (or removed).
There were also a few FIXMEs in the code, I think think it would be good to review all those, and see if they're still valid, and perhaps add a bit more explanation to each.
drivers/gpu/drm/bridge/cdns-mhdp-core.c line 212
Quoted 3 lines
drivers/gpu/drm/bridge/cdns-mhdp-core.c new file +3
-0+/* mailbox */ +#define MAILBOX_RETRY_US 1000 +#define MAILBOX_TIMEOUT_US 5000000
This is 5 seconds. It sounds pretty long time to wait in a blocking function.
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v5 3/3 drm: bridge: cdns-mhdp: add j721e wrapper
In reply to Yuti AmonkarAdd j721e wrapper for mhdp, which sets up the clock and data muxes.
--- drivers/gpu/drm/bridge/Kconfig | 12 ++++ drivers/gpu/drm/bridge/Makefile | 3 + drivers/gpu/drm/bridge/cdns-mhdp-core.c | 14 +++++ drivers/gpu/drm/bridge/cdns-mhdp-core.h | 1 + drivers/gpu/drm/bridge/cdns-mhdp-j721e.c | 79 ++++++++++++++++++++++++ drivers/gpu/drm/bridge/cdns-mhdp-j721e.h | 55 +++++++++++++++++ 6 files changed, 164 insertions(+) create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.c create mode 100644 drivers/gpu/drm/bridge/cdns-mhdp-j721e.h
drivers/gpu/drm/bridge/Kconfig +12 -0
@@ -38,6 +38,18 @@ config DRM_CDNS_MHDP It takes a DPI stream as input and output it encoded in DP format. +if DRM_CDNS_MHDP + +config DRM_CDNS_MHDP_J721E + bool "J721E Cadence DPI/DP wrapper support" + default y + help + Support J721E Cadence DPI/DP wrapper. This is a wrapper + which adds support for J721E related platform ops. It + initializes the J721e Display Port and sets up the + clock and data muxes. +endif + config DRM_DUMB_VGA_DAC tristate "Dumb VGA DAC Bridge support" depends on OF
drivers/gpu/drm/bridge/Makefile +3 -0
@@ -21,3 +21,6 @@ obj-y += analogix/ obj-y += synopsys/ cdns-mhdp-objs := cdns-mhdp-core.o +ifeq ($(CONFIG_DRM_CDNS_MHDP_J721E),y) + cdns-mhdp-objs += cdns-mhdp-j721e.o +endif
drivers/gpu/drm/bridge/cdns-mhdp-core.c +14 -0
@@ -36,8 +36,22 @@#include "cdns-mhdp-core.h" +#include "cdns-mhdp-j721e.h" + +#ifdef CONFIG_DRM_CDNS_MHDP_J721E +static const struct mhdp_platform_ops mhdp_ti_j721e_ops = { + .init = cdns_mhdp_j721e_init, + .exit = cdns_mhdp_j721e_fini, + .enable = cdns_mhdp_j721e_enable, + .disable = cdns_mhdp_j721e_disable, +}; +#endif +static const struct of_device_id mhdp_ids[] = { { .compatible ="cdns,mhdp8546" , }, +#ifdef CONFIG_DRM_CDNS_MHDP_J721E + { .compatible ="ti,j721e-mhdp8546" , .data = &mhdp_ti_j721e_ops }, +#endif {/* sentinel */ } };MODULE_DEVICE_TABLE (of, mhdp_ids);
drivers/gpu/drm/bridge/cdns-mhdp-core.h +1 -0
@@ -335,6 +335,7 @@ struct mhdp_platform_ops {struct cdns_mhdp_device {void __iomem *regs; +void __iomem *j721e_regs;struct device *dev;struct clk *clk;
drivers/gpu/drm/bridge/cdns-mhdp-j721e.c new file +79 -0
79 lines not on this page · raw message
drivers/gpu/drm/bridge/cdns-mhdp-j721e.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v5 3/3] drm: bridge: cdns-mhdp: add j721e wrapper
Quoted 12 lines · Yuti Amonkar
Add j721e wrapper for mhdp, which sets up the clock and data muxes.
Signed-off-by Yuti Amonkar <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/gpu/drm/bridge/Kconfig | 12 ++++ drivers/gpu/drm/bridge/Makefile | 3 + drivers/gpu/drm/bridge/cdns-mhdp-core.c | 14 +++++ drivers/gpu/drm/bridge/cdns-mhdp-core.h | 1 + drivers/gpu/drm/bridge/cdns-mhdp-j721e.c | 79 ++++++++++++++++++++++++ drivers/gpu/drm/bridge/cdns-mhdp-j721e.h | 55 +++++++++++++++++ 6 files changed, 164 insertions(+)
Quoted 2 lines
create mode 100644
drivers/gpu/drm/bridge/cdns-mhdp-j721e.ccreate mode 100644drivers/gpu/drm/bridge/cdns-mhdp-j721e.h
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel