Skip to contentSkip to conversation

soc: imx8mp: Add support for HDMI

PATCH Applied Adam Ford 19 participants 65 messages Feb 3, 2024 – Mar 19, 2025

Subsystems (9)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

v8 cover soc: imx8mp: Add support for HDMI

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently,
I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different times and had different amount of retries. In an effort to merge them I used the highest version attempt.

Adam Ford (3):
dt-bindings: soc: imx: add missing clock and power-domains to
imx8mp-hdmi-blk-ctrl
pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix
domain
arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

Lucas Stach (9):
dt-bindings: phy: add binding for the i.MX8MP HDMI PHY
phy: freescale: add Samsung HDMI PHY
arm64: dts: imx8mp: add HDMI power-domains
arm64: dts: imx8mp: add HDMI irqsteer
dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI TX drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
arm64: dts: imx8mp: add HDMI display pipeline

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    |  102 ++
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      |   84 ++
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     |   62 +
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     |   22 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi     |  145 +++
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/bridge/imx/Kconfig            |   18 +
 drivers/gpu/drm/bridge/imx/Makefile           |    2 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c  |  207 ++++
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c   |  154 +++
 drivers/phy/freescale/Kconfig                 |    6 +
 drivers/phy/freescale/Makefile                |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c  | 1075 +++++++++++++++++
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c        |   10 +-
 14 files changed, 1876 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH v8 1/12 dt-bindings: phy: add binding for the i.MX8MP HDMI PHY

From: Lucas Stach <[email protected]>

Add a DT binding for the HDMI PHY found on the i.MX8MP SoC.

---
V3: Removed mintems at the request of Krzysztof and add his
reviewed-by

V2: I tried to help move this along, so I took Lucas' patch and
attempted to apply fixes based on feedback. I don't have all the history, so apologies for that.

Added phy-cells to the required list and fixed an error due to the word 'binding' being in the title.

---
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     | 62 +++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml new file +62 -0
new file mode 100644
index 000000000000..c43e86a8c2e0
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/fsl,imx8mp-hdmi-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP HDMI PHY
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8mp-hdmi-phy
+
+  reg:
+    maxItems: 1
+
+  "#clock-cells":
+    const: 0
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: apb
+      - const: ref
+
+  "#phy-cells":
+    const: 0
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - "#clock-cells"
+  - clocks
+  - clock-names
+  - "#phy-cells"
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    phy@32fdff00 {
+        compatible = "fsl,imx8mp-hdmi-phy";
+        reg = <0x32fdff00 0x100>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_24M>;
+        clock-names = "apb", "ref";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX_PHY>;
+        #clock-cells = <0>;
+        #phy-cells = <0>;
+    };
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH v8 2/12 phy: freescale: add Samsung HDMI PHY

In reply to Adam Ford

From: Lucas Stach <[email protected]>

This adds the driver for the Samsung HDMI PHY found on the i.MX8MP SoC.

---
V4: Make lookup table hex values lower case.

V3: Re-order the Makefile to keep it alphabetical
Remove unused defines

V2: Fixed some whitespace found from checkpatch
Change error handling when enabling apbclk to use dev_err_probe Rebase on Linux-Next

I (Adam) tried to help move this along, so I took Lucas' patch and attempted to apply fixes based on feedback. I don't have all the history, so apologies for that.

---
 drivers/phy/freescale/Kconfig                |    6 +
 drivers/phy/freescale/Makefile               |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 1075 ++++++++++++++++++
 3 files changed, 1082 insertions(+)
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
drivers/phy/freescale/Kconfig +6 -0
index 853958fb2c06..5c2b73042dfc 100644
@@ -35,6 +35,12 @@ config PHY_FSL_IMX8M_PCIE
 	  Enable this to add support for the PCIE PHY as found on
 	  i.MX8M family of SOCs.
 
+config PHY_FSL_SAMSUNG_HDMI_PHY
+	tristate "Samsung HDMI PHY support"
+	depends on OF && HAS_IOMEM
+	help
+	  Enable this to add support for the Samsung HDMI PHY in i.MX8MP.
+
 endif
 
 config PHY_FSL_LYNX_28G
drivers/phy/freescale/Makefile +1 -0
index cedb328bc4d2..79e5f16d3ce8 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_PHY_MIXEL_LVDS_PHY)	+= phy-fsl-imx8qm-lvds-phy.o
 obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY)	+= phy-fsl-imx8-mipi-dphy.o
 obj-$(CONFIG_PHY_FSL_IMX8M_PCIE)	+= phy-fsl-imx8m-pcie.o
 obj-$(CONFIG_PHY_FSL_LYNX_28G)		+= phy-fsl-lynx-28g.o
+obj-$(CONFIG_PHY_FSL_SAMSUNG_HDMI_PHY)  += phy-fsl-samsung-hdmi.o
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +1075 -0

1,075 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#9 lore raw

PATCH v8 3/12 dt-bindings: soc: imx: add missing clock and power-domains to imx8mp-hdmi-blk-ctrl

In reply to Adam Ford

Per guidance from the NXP downstream kernel, if the clock is disabled before HDMI/LCDIF probe, LCDIF will not get pixel clock from HDMI PHY and throw an error:

[CRTC:39:crtc-2] vblank wait timed out

    WARNING: CPU: 2 PID: 9 at drivers/gpu/drm/drm_atomic_helper.c:
        1634 drm_atomic_helper_wait_for_vblanks.part.0+0x23c/0x260

Fix this by adding the fdcc clock to the hdmi_blk_ctrl. This should be safe, since neither this power domain nor the dependent HDMI and LCDIF drivers been enabled or added to the SoC device tree yet.

According to Sandor Yu from NXP, "the FDCC clock is not for HDMITX in desgin, but it is part of HDMI domain that needed by HDMITX. So I think it is reasonable added it to the power domain driver."

The driver also supports two power domains which are missing from the binding that also fix an issue with resuming from suspend.

---
V2: Update commit message to both show error and give a bit more
background.
Add missing power domains hdcp and hdrv as pointed out by Marek Vasut

---
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml +14 -8
index 1be4ce2a45e8..bd1cdaa4f54b 100644
@@ -27,8 +27,8 @@ properties:
     const: 1
 
   power-domains:
-    minItems: 8
-    maxItems: 8
+    minItems: 10
+    maxItems: 10
 
   power-domain-names:
     items:
@@ -40,10 +40,12 @@ properties:
       - const: trng
       - const: hdmi-tx
       - const: hdmi-tx-phy
+      - const: hdcp
+      - const: hrv
 
   clocks:
-    minItems: 4
-    maxItems: 4
+    minItems: 5
+    maxItems: 5
 
   clock-names:
     items:
@@ -51,6 +53,7 @@ properties:
       - const: axi
       - const: ref_266m
       - const: ref_24m
+      - const: fdcc
 
   interconnects:
     maxItems: 3
@@ -82,12 +85,15 @@ examples:
         clocks = <&clk IMX8MP_CLK_HDMI_APB>,
                  <&clk IMX8MP_CLK_HDMI_ROOT>,
                  <&clk IMX8MP_CLK_HDMI_REF_266M>,
-                 <&clk IMX8MP_CLK_HDMI_24M>;
-        clock-names = "apb", "axi", "ref_266m", "ref_24m";
+                 <&clk IMX8MP_CLK_HDMI_24M>,
+                 <&clk IMX8MP_CLK_HDMI_FDCC_TST>;
+        clock-names = "apb", "axi", "ref_266m", "ref_24m", "fdcc";
         power-domains = <&pgc_hdmimix>, <&pgc_hdmimix>, <&pgc_hdmimix>,
                         <&pgc_hdmimix>, <&pgc_hdmimix>, <&pgc_hdmimix>,
-                        <&pgc_hdmimix>, <&pgc_hdmi_phy>;
+                        <&pgc_hdmimix>, <&pgc_hdmi_phy>,
+                        <&pgc_hdmimix>, <&pgc_hdmimix>;
         power-domain-names = "bus", "irqsteer", "lcdif", "pai", "pvi", "trng",
-                             "hdmi-tx", "hdmi-tx-phy";
+                             "hdmi-tx", "hdmi-tx-phy",
+                             "hdcp", "hrv";
         #power-domain-cells = <1>;
     };
Signature · 1 line
2.43.0
author
#11 lore raw

PATCH v8 4/12 pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix domain

In reply to Adam Ford

According to i.MX8MP RM and HDMI ADD, the fdcc clock is part of hdmi rx verification IP that should not enable for HDMI TX. But actually if the clock is disabled before HDMI/LCDIF probe, LCDIF will not get pixel clock from HDMI PHY and print the error logs:

[CRTC:39:crtc-2] vblank wait timed out

WARNING: CPU: 2 PID: 9 at drivers/gpu/drm/drm_atomic_helper.c:1634 drm_atomic_helper_wait_for_vblanks.part.0+0x23c/0x260

Add fdcc clock to LCDIF and HDMI TX power domains to fix the issue.

---
V2: No Change

---
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pmdomain/imx/imx8mp-blk-ctrl.c +5 -5
index e488cf79b800..77e889165eed 100644
@@ -55,7 +55,7 @@ struct imx8mp_blk_ctrl_domain_data {
 	const char *gpc_name;
 };
 
-#define DOMAIN_MAX_CLKS 2
+#define DOMAIN_MAX_CLKS 3
 #define DOMAIN_MAX_PATHS 3
 
 struct imx8mp_blk_ctrl_domain {
@@ -457,8 +457,8 @@ static const struct imx8mp_blk_ctrl_domain_data imx8mp_hdmi_domain_data[] = {
 	},
 	[IMX8MP_HDMIBLK_PD_LCDIF] = {
 		.name = "hdmiblk-lcdif",
-		.clk_names = (const char *[]){ "axi", "apb" },
-		.num_clks = 2,
+		.clk_names = (const char *[]){ "axi", "apb", "fdcc" },
+		.num_clks = 3,
 		.gpc_name = "lcdif",
 		.path_names = (const char *[]){"lcdif-hdmi"},
 		.num_paths = 1,
@@ -483,8 +483,8 @@ static const struct imx8mp_blk_ctrl_domain_data imx8mp_hdmi_domain_data[] = {
 	},
 	[IMX8MP_HDMIBLK_PD_HDMI_TX] = {
 		.name = "hdmiblk-hdmi-tx",
-		.clk_names = (const char *[]){ "apb", "ref_266m" },
-		.num_clks = 2,
+		.clk_names = (const char *[]){ "apb", "ref_266m", "fdcc" },
+		.num_clks = 3,
 		.gpc_name = "hdmi-tx",
 	},
 	[IMX8MP_HDMIBLK_PD_HDMI_TX_PHY] = {
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH v8 5/12 arm64: dts: imx8mp: add HDMI power-domains

In reply to Adam Ford

From: Lucas Stach <[email protected]>

This adds the PGC and HDMI blk-ctrl nodes providing power control for HDMI subsystem peripherals.

---
V2: Add missing power-domains hdcp and hrv

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 38 +++++++++++++++++++++++
 1 file changed, 38 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +38 -0
index 76c73daf546b..5c54073de615 100644
@@ -836,6 +836,23 @@ pgc_mediamix: power-domain@10 {
 							 <&clk IMX8MP_CLK_MEDIA_APB_ROOT>;
 					};
 
+					pgc_hdmimix: power-domains@14 {
+						#power-domain-cells = <0>;
+						reg = <IMX8MP_POWER_DOMAIN_HDMIMIX>;
+						clocks = <&clk IMX8MP_CLK_HDMI_ROOT>,
+							 <&clk IMX8MP_CLK_HDMI_APB>;
+						assigned-clocks = <&clk IMX8MP_CLK_HDMI_AXI>,
+								  <&clk IMX8MP_CLK_HDMI_APB>;
+						assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>,
+									 <&clk IMX8MP_SYS_PLL1_133M>;
+						assigned-clock-rates = <500000000>, <133000000>;
+					};
+
+					pgc_hdmi_phy: power-domains@15 {
+						#power-domain-cells = <0>;
+						reg = <IMX8MP_POWER_DOMAIN_HDMI_PHY>;
+					};
+
 					pgc_mipi_phy2: power-domain@16 {
 						#power-domain-cells = <0>;
 						reg = <IMX8MP_POWER_DOMAIN_MIPI_PHY2>;
@@ -1361,6 +1378,27 @@ eqos: ethernet@30bf0000 {
 				intf_mode = <&gpr 0x4>;
 				status = "disabled";
 			};
+
+			hdmi_blk_ctrl: blk-ctrl@32fc0000 {
+				compatible = "fsl,imx8mp-hdmi-blk-ctrl", "syscon";
+				reg = <0x32fc0000 0x23c>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk IMX8MP_CLK_HDMI_ROOT>,
+					 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+					 <&clk IMX8MP_CLK_HDMI_24M>,
+					 <&clk IMX8MP_CLK_HDMI_FDCC_TST>;
+				clock-names = "apb", "axi", "ref_266m", "ref_24m", "fdcc";
+				power-domains = <&pgc_hdmimix>, <&pgc_hdmimix>,
+						<&pgc_hdmimix>, <&pgc_hdmimix>,
+						<&pgc_hdmimix>, <&pgc_hdmimix>,
+						<&pgc_hdmimix>, <&pgc_hdmi_phy>,
+						<&pgc_hdmimix>, <&pgc_hdmimix>;
+				power-domain-names = "bus", "irqsteer", "lcdif",
+						     "pai", "pvi", "trng",
+						     "hdmi-tx", "hdmi-tx-phy",
+						     "hdcp", "hrv";
+				#power-domain-cells = <1>;
+			};
 		};
 
 		aips5: bus@30c00000 {
Signature · 1 line
2.43.0
author
#15 lore raw

PATCH v8 6/12 arm64: dts: imx8mp: add HDMI irqsteer

In reply to Adam Ford

From: Lucas Stach <[email protected]>

The HDMI irqsteer is a secondary interrupt controller within the HDMI subsystem that maps all HDMI peripheral IRQs into a single upstream IRQ line.

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +13 -0
index 5c54073de615..5e51a766f3d9 100644
@@ -1399,6 +1399,19 @@ hdmi_blk_ctrl: blk-ctrl@32fc0000 {
 						     "hdcp", "hrv";
 				#power-domain-cells = <1>;
 			};
+
+			irqsteer_hdmi: interrupt-controller@32fc2000 {
+				compatible = "fsl,imx-irqsteer";
+				reg = <0x32fc2000 0x44>;
+				interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-controller;
+				#interrupt-cells = <1>;
+				fsl,channel = <1>;
+				fsl,num-irqs = <64>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>;
+				clock-names = "ipg";
+				power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_IRQSTEER>;
+			};
 		};
 
 		aips5: bus@30c00000 {
Signature · 1 line
2.43.0
author
#19 lore raw

PATCH v8 7/12 dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI

In reply to Adam Ford

From: Lucas Stach <[email protected]>

Add binding for the i.MX8MP HDMI parallel video interface block.

---
V8: Add interrupt-parent

V7: No Change

V6: Add s-o-b message for myself (Adam)

V5: I tried to help move this along, so I took Lucas' patch and
attempted to apply fixes based on feedback. I don't have all the history, so apologies for that.
Removed the pipe character from the Description. Increased the register size from 0x40 to 0x44.

---
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml new file +84 -0
new file mode 100644
index 000000000000..56da1636014c
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/imx/fsl,imx8mp-hdmi-pvi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP HDMI Parallel Video Interface
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+description:
+  The HDMI parallel video interface is a timing and sync generator block in the
+  i.MX8MP SoC, that sits between the video source and the HDMI TX controller.
+
+properties:
+  compatible:
+    const: fsl,imx8mp-hdmi-pvi
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Input from the LCDIF controller.
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Output to the HDMI TX controller.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - power-domains
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    display-bridge@32fc4000 {
+        compatible = "fsl,imx8mp-hdmi-pvi";
+        reg = <0x32fc4000 0x44>;
+        interrupt-parent = <&irqsteer_hdmi>;
+        interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PVI>;
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                reg = <0>;
+                pvi_from_lcdif3: endpoint {
+                    remote-endpoint = <&lcdif3_to_pvi>;
+                };
+            };
+
+            port@1 {
+                reg = <1>;
+                pvi_to_hdmi_tx: endpoint {
+                    remote-endpoint = <&hdmi_tx_from_pvi>;
+                };
+            };
+        };
+    };
Signature · 1 line
2.43.0
author
#21 lore raw

PATCH v8 8/12 drm/bridge: imx: add driver for HDMI TX Parallel Video Interface

In reply to Adam Ford

From: Lucas Stach <[email protected]>

This IP block is found in the HDMI subsystem of the i.MX8MP SoC. It has a full timing generator and can switch between different video sources. On the i.MX8MP however the only supported source is the LCDIF. The block just needs to be powered up and told about the polarity of the video sync signals to act in bypass mode.

---
V8: No Change

V7: Re-do some includes to address build issues after rebasing from
Linux-next

V6: No change.

V5: I (Adam) tried to help move this along, so I took Lucas' patch and
attempted to apply fixes based on feedback. I don't have all the history, so apologies for that.
No changes from V4 to V5

---
 drivers/gpu/drm/bridge/imx/Kconfig           |   7 +
 drivers/gpu/drm/bridge/imx/Makefile          |   1 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 207 +++++++++++++++++++
 3 files changed, 215 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
drivers/gpu/drm/bridge/imx/Kconfig +7 -0
index 5a4f3d58501e..a4d13331e320 100644
@@ -3,6 +3,13 @@ if ARCH_MXC || COMPILE_TEST
 config DRM_IMX_LDB_HELPER
 	tristate
 
+config DRM_IMX8MP_HDMI_PVI
+	tristate "Freescale i.MX8MP HDMI PVI bridge support"
+	depends on OF
+	help
+	  Choose this to enable support for the internal HDMI TX Parallel
+	  Video Interface found on the Freescale i.MX8MP SoC.
+
 config DRM_IMX8QM_LDB
 	tristate "Freescale i.MX8QM LVDS display bridge"
 	depends on OF
drivers/gpu/drm/bridge/imx/Makefile +1 -0
index 2b0c2e44aa1b..e2c2106509fa 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
+obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
 obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o
 obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o
 obj-$(CONFIG_DRM_IMX8QXP_PIXEL_COMBINER) += imx8qxp-pixel-combiner.o
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +207 -0

207 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#25 lore raw

PATCH v8 9/12 dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

In reply to Adam Ford

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

---
V3: Change name and location to better idenfity as a bridge and
HDMI 2.0a transmitter

Fix typos and feedback from Rob and added ports.

---
 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +102 -0
new file mode 100644
index 000000000000..3791c9f4ebab
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/fsl,imx8mp-hdmi-tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP DWC HDMI TX Encoder
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+description:
+  The i.MX8MP HDMI transmitter is a Synopsys DesignWare
+  HDMI 2.0a TX controller IP.
+
+allOf:
+  - $ref: /schemas/display/bridge/synopsys,dw-hdmi.yaml#
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8mp-hdmi-tx
+
+  reg-io-width:
+    const: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: iahb
+      - const: isfr
+      - const: cec
+      - const: pix
+
+  power-domains:
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Parallel RGB input port
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: HDMI output port
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - power-domains
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    hdmi@32fd8000 {
+        compatible = "fsl,imx8mp-hdmi-tx";
+        reg = <0x32fd8000 0x7eff>;
+        interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+                 <&clk IMX8MP_CLK_32K>,
+                 <&hdmi_tx_phy>;
+        clock-names = "iahb", "isfr", "cec", "pix";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+        reg-io-width = <1>;
+        ports {
+           #address-cells = <1>;
+           #size-cells = <0>;
+           port@0 {
+             reg = <0>;
+
+             hdmi_tx_from_pvi: endpoint {
+               remote-endpoint = <&pvi_to_hdmi_tx>;
+             };
+          };
+
+          port@1 {
+            reg = <1>;
+              hdmi_tx_out: endpoint {
+                remote-endpoint = <&hdmi0_con>;
+              };
+          };
+        };
+    };
Signature · 1 line
2.43.0
author
#33 lore raw

PATCH v8 10/12 drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI

In reply to Adam Ford

From: Lucas Stach <[email protected]>

Add a simple wrapper driver for the DWC HDMI bridge driver that implements the few bits that are necessary to abstract the i.MX8MP SoC integration.

---
v3: To move this along, I (Adam) took Lucas' V2 and attempted
to address concerns:

Changed name to imx8mp-hdmi-tx
Re-ordered includes to make drm come after linux Removed unused variable build warning
Removed fdcc clock since it's part of the power domain now set the phy_force_vendor = true
Removed comma after sentinel

Also added suspend/resume functions from Marek Vasut

Configured Kconfig to select the PVI and PHY automatically since the HDMI-tx is useless without the other two components

I apologize that don't have the version history prior to V2.

---
 drivers/gpu/drm/bridge/imx/Kconfig          |  11 ++
 drivers/gpu/drm/bridge/imx/Makefile         |   1 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 154 ++++++++++++++++++++
 3 files changed, 166 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
drivers/gpu/drm/bridge/imx/Kconfig +11 -0
index a4d13331e320..5965e8027529 100644
@@ -3,6 +3,17 @@ if ARCH_MXC || COMPILE_TEST
 config DRM_IMX_LDB_HELPER
 	tristate
 
+config DRM_IMX8MP_DW_HDMI_BRIDGE
+	tristate "Freescale i.MX8MP HDMI-TX bridge support"
+	depends on OF
+	depends on COMMON_CLK
+	select DRM_DW_HDMI
+	select DRM_IMX8MP_HDMI_PVI
+	select PHY_FSL_SAMSUNG_HDMI_PHY
+	help
+	  Choose this to enable support for the internal HDMI encoder found
+	  on the i.MX8MP SoC.
+
 config DRM_IMX8MP_HDMI_PVI
 	tristate "Freescale i.MX8MP HDMI PVI bridge support"
 	depends on OF
drivers/gpu/drm/bridge/imx/Makefile +1 -0
index e2c2106509fa..edb0a7b71b30 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_DRM_IMX_LDB_HELPER) += imx-ldb-helper.o
+obj-$(CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE) += imx8mp-hdmi-tx.o
 obj-$(CONFIG_DRM_IMX8MP_HDMI_PVI) += imx8mp-hdmi-pvi.o
 obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o
 obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#48 lore raw

PATCH v8 11/12 arm64: dts: imx8mp: add HDMI display pipeline

In reply to Adam Ford

From: Lucas Stach <[email protected]>

This adds the DT nodes for all the peripherals that make up the HDMI display pipeline.

---
V2: I took this from Lucas' original submission with the following:
Removed extra clock from HDMI-TX since it is now part of the power domain
Added interrupt-parent to PVI
Changed the name of the HDMI tranmitter to fsl,imx8mp-hdmi-tx Added ports to HDMI-tx

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 94 +++++++++++++++++++++++
 1 file changed, 94 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +94 -0
index 5e51a766f3d9..e84b4f40e570 100644
@@ -1412,6 +1412,100 @@ irqsteer_hdmi: interrupt-controller@32fc2000 {
 				clock-names = "ipg";
 				power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_IRQSTEER>;
 			};
+
+			hdmi_pvi: display-bridge@32fc4000 {
+				compatible = "fsl,imx8mp-hdmi-pvi";
+				reg = <0x32fc4000 0x40>;
+				interrupt-parent = <&irqsteer_hdmi>;
+				interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+				power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PVI>;
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+						pvi_from_lcdif3: endpoint {
+							remote-endpoint = <&lcdif3_to_pvi>;
+						};
+					};
+
+					port@1 {
+						reg = <1>;
+						pvi_to_hdmi_tx: endpoint {
+							remote-endpoint = <&hdmi_tx_from_pvi>;
+						};
+					};
+				};
+			};
+
+			lcdif3: display-controller@32fc6000 {
+				compatible = "fsl,imx8mp-lcdif";
+				reg = <0x32fc6000 0x238>;
+				interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-parent = <&irqsteer_hdmi>;
+				clocks = <&hdmi_tx_phy>,
+					 <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk IMX8MP_CLK_HDMI_ROOT>;
+				clock-names = "pix", "axi", "disp_axi";
+				power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_LCDIF>;
+
+				port {
+					lcdif3_to_pvi: endpoint {
+						remote-endpoint = <&pvi_from_lcdif3>;
+					};
+				};
+			};
+
+			hdmi_tx: hdmi@32fd8000 {
+				compatible = "fsl,imx8mp-hdmi-tx";
+				reg = <0x32fd8000 0x7eff>;
+				interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-parent = <&irqsteer_hdmi>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+					 <&clk IMX8MP_CLK_32K>,
+					 <&hdmi_tx_phy>;
+				clock-names = "iahb", "isfr", "cec", "pix";
+				assigned-clocks = <&clk IMX8MP_CLK_HDMI_REF_266M>;
+				assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_266M>;
+				power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+				reg-io-width = <1>;
+				status = "disabled";
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+
+						hdmi_tx_from_pvi: endpoint {
+							remote-endpoint = <&pvi_to_hdmi_tx>;
+						};
+					};
+
+					port@1 {
+						reg = <1>;
+						/* Point endpoint to the HDMI connector */
+					};
+				};
+			};
+
+			hdmi_tx_phy: phy@32fdff00 {
+				compatible = "fsl,imx8mp-hdmi-phy";
+				reg = <0x32fdff00 0x100>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk IMX8MP_CLK_HDMI_24M>;
+				clock-names = "apb", "ref";
+				assigned-clocks = <&clk IMX8MP_CLK_HDMI_24M>;
+				assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
+				power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX_PHY>;
+				#clock-cells = <0>;
+				#phy-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		aips5: bus@30c00000 {
Signature · 1 line
2.43.0
author
#50 lore raw

PATCH v8 12/12 arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

In reply to Adam Ford

The i.MX8M Plus has support for an HDMI transmitter. The video is genereated by lcdif3, routed to the hdmi parallel video interface, then fed to a DW HDMI bridge to support up to 4K video output.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index e6cf3e5d63c3..3e33825f0ed7 100644
@@ -880,6 +880,7 @@ CONFIG_DRM_ANALOGIX_ANX7625=m
 CONFIG_DRM_I2C_ADV7511=m
 CONFIG_DRM_I2C_ADV7511_AUDIO=y
 CONFIG_DRM_CDNS_MHDP8546=m
+CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE=m
 CONFIG_DRM_DW_HDMI_AHB_AUDIO=m
 CONFIG_DRM_DW_HDMI_CEC=m
 CONFIG_DRM_IMX_DCSS=m
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH V8 02/12] phy: freescale: add Samsung HDMI PHY

In reply to Adam Ford

Le 03/02/2024 à 17:52, Adam Ford a écrit :

Quoted 9 lines

From: Lucas Stach <[email protected]>

This adds the driver for the Samsung HDMI PHY found on the i.MX8MP SoC.

---

...

Quoted 45 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +45 -0
+static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
+{
+	struct fsl_samsung_hdmi_phy *phy;
+	int ret;
+
+	phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
+	if (!phy)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, phy);
+	phy->dev = &pdev->dev;
+
+	phy->regs = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(phy->regs))
+		return PTR_ERR(phy->regs);
+
+	phy->apbclk = devm_clk_get(phy->dev, "apb");
+	if (IS_ERR(phy->apbclk))
+		return dev_err_probe(phy->dev, PTR_ERR(phy->apbclk),
+				     "failed to get apb clk\n");
+
+	phy->refclk = devm_clk_get(phy->dev, "ref");
+	if (IS_ERR(phy->refclk))
+		return dev_err_probe(phy->dev, PTR_ERR(phy->refclk),
+				     "failed to get ref clk\n");
+
+	ret = clk_prepare_enable(phy->apbclk);
+	if (ret) {
+		dev_err(phy->dev, "failed to enable apbclk\n");
+		return ret;
+	}
+
+	pm_runtime_get_noresume(phy->dev);
+	pm_runtime_set_active(phy->dev);
+	pm_runtime_enable(phy->dev);
+
+	ret = phy_clk_register(phy);
+	if (ret) {
+		dev_err(&pdev->dev, "register clk failed\n");
+		goto register_clk_failed;
+	}
+
+	pm_runtime_put(phy->dev);
+
+	return 0;

drivers/phy/freescale/phy-fsl-samsung-hdmi.c line 1012

Quoted 10 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +10 -0
+
+register_clk_failed:
+	clk_disable_unprepare(phy->apbclk);
+
+	return ret;
+}
+
+static int fsl_samsung_hdmi_phy_remove(struct platform_device *pdev)
+{
+	of_clk_del_provider(pdev->dev.of_node);

A clk_disable_unprepare(phy->apbclk) call seems to be missing here. Or maybe devm_clk_get_enabled() should be used for 'apbclk'?

CJ

Quoted 3 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +3 -0
+
+	return 0;
+}

...

Signature · 3 lines
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#5 lore raw

Re: [PATCH V8 02/12] phy: freescale: add Samsung HDMI PHY

In reply to Adam Ford
Quoted 103 lines · Adam Ford

From: Lucas Stach <[email protected]>

This adds the driver for the Samsung HDMI PHY found on the i.MX8MP SoC.

---
V4: Make lookup table hex values lower case.

V3: Re-order the Makefile to keep it alphabetical
Remove unused defines

V2: Fixed some whitespace found from checkpatch
Change error handling when enabling apbclk to use dev_err_probe Rebase on Linux-Next

I (Adam) tried to help move this along, so I took Lucas' patch and attempted to apply fixes based on feedback. I don't have all the history, so apologies for that.

---
 drivers/phy/freescale/Kconfig                |    6 +
 drivers/phy/freescale/Makefile               |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 1075 ++++++++++++++++++
 3 files changed, 1082 insertions(+)
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
drivers/phy/freescale/Kconfig +6 -0
index 853958fb2c06..5c2b73042dfc 100644
@@ -35,6 +35,12 @@ config PHY_FSL_IMX8M_PCIE
          Enable this to add support for the PCIE PHY as found on
          i.MX8M family of SOCs.
 
+config PHY_FSL_SAMSUNG_HDMI_PHY
+       tristate "Samsung HDMI PHY support"
+       depends on OF && HAS_IOMEM
+       help
+         Enable this to add support for the Samsung HDMI PHY in i.MX8MP.
+
 endif
 
 config PHY_FSL_LYNX_28G
drivers/phy/freescale/Makefile +1 -0
index cedb328bc4d2..79e5f16d3ce8 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_PHY_MIXEL_LVDS_PHY)        += phy-fsl-imx8qm-lvds-phy.o
 obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY)      += phy-fsl-imx8-mipi-dphy.o
 obj-$(CONFIG_PHY_FSL_IMX8M_PCIE)       += phy-fsl-imx8m-pcie.o
 obj-$(CONFIG_PHY_FSL_LYNX_28G)         += phy-fsl-lynx-28g.o
+obj-$(CONFIG_PHY_FSL_SAMSUNG_HDMI_PHY)  += phy-fsl-samsung-hdmi.o
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +42 -0
new file mode 100644
index 000000000000..bf0e2299d00f
@@ -0,0 +1,1075 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ * Copyright 2022 Pengutronix, Lucas Stach <[email protected]>
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+#define PHY_REG_33             0x84
+#define  REG33_MODE_SET_DONE   BIT(7)
+#define  REG33_FIX_DA          BIT(1)
+
+#define PHY_REG_34             0x88
+#define  REG34_PHY_READY       BIT(7)
+#define  REG34_PLL_LOCK                BIT(6)
+#define  REG34_PHY_CLK_READY   BIT(5)
+
+
+#define PHY_PLL_REGS_NUM 48
+
+struct phy_config {
+       u32     clk_rate;
+       u8 regs[PHY_PLL_REGS_NUM];
+};
+
+const struct phy_config phy_pll_cfg[] = {
+       {       22250000, {
+                       0x00, 0xd1, 0x4b, 0xf1, 0x89, 0x88, 0x80, 0x40,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x15, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,

drivers/phy/freescale/phy-fsl-samsung-hdmi.c line 52

Quoted 10 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +10 -0
+               },
+       }, {
+               23750000, {
+                       0x00, 0xd1, 0x50, 0xf1, 0x86, 0x85, 0x80, 0x40,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x03, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },

Generally I see that these entries contain a high level of duplication. Could you please extract the common part and a rate-dependent part. Next, it would be best if instead of writing the register values via the rate LUT, the driver could calculate those values.
This allows us to support other HDMI modes if the need arises at some point.

Quoted 9 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +9 -0
+       }, {
+               24000000, {
+                       0x00, 0xd1, 0x50, 0xf0, 0x00, 0x00, 0x80, 0x00,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x01, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },
Signature · 2 lines
With best wishes
Dmitry
#16 lore raw

Re: [PATCH V8 06/12] arm64: dts: imx8mp: add HDMI irqsteer

In reply to Adam Ford
Quoted 7 lines · Adam Ford

From: Lucas Stach <[email protected]>

The HDMI irqsteer is a secondary interrupt controller within the HDMI subsystem that maps all HDMI peripheral IRQs into a single upstream IRQ line.

This is missing your signed-off-by, and in other patches of this series your signed-off-by is not the last, as it should be.

Please have a look and fix this and the other instances.

Thanks for this work!

Francesco

author
#17 lore raw

Re: [PATCH V8 06/12] arm64: dts: imx8mp: add HDMI irqsteer

Quoted 11 lines · Francesco Dolcini
Quoted 7 lines · Adam Ford

From: Lucas Stach <[email protected]>

The HDMI irqsteer is a secondary interrupt controller within the HDMI subsystem that maps all HDMI peripheral IRQs into a single upstream IRQ line.

This is missing your signed-off-by, and in other patches of this series

Opps. I thought I caught all those.

Quoted 4 lines

your signed-off-by is not the last, as it should be.

Please have a look and fix this and the other instances.

OK. I have some work to do on some other portions, so I'll clean up that too.

adam

Quoted 1 line

Thanks for this work!

Thanks for the feedback.

adam

Quoted 3 lines

Francesco

#13 lore raw

Re: [PATCH V8 05/12] arm64: dts: imx8mp: add HDMI power-domains

In reply to Adam Ford

Hi Adam,

thanks for working on this.

Am Samstag, 3. Februar 2024, 17:52:45 CET schrieb Adam Ford:

Quoted 19 lines

From: Lucas Stach <[email protected]>

This adds the PGC and HDMI blk-ctrl nodes providing power control for HDMI subsystem peripherals.

---
V2: Add missing power-domains hdcp and hrv

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 38 +++++++++++++++++++++++
 1 file changed, 38 insertions(+)
(quoted diff) +0 -0

b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index
76c73daf546b..5c54073de615 100644

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 836

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
@@ -836,6 +836,23 @@ pgc_mediamix: power-domain@10 {
 							 <&clk 

IMX8MP_CLK_MEDIA_APB_ROOT>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 839

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
 					};
 
+					pgc_hdmimix: power-

domains@14 {

As per Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml the node should be called power-domain@.

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 840

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						#power-domain-

cells = <0>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 841

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						reg = 

<IMX8MP_POWER_DOMAIN_HDMIMIX>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 842

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						clocks = <&clk 

IMX8MP_CLK_HDMI_ROOT>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 843

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+							 <&clk 

IMX8MP_CLK_HDMI_APB>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 844

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						assigned-clocks = 

<&clk IMX8MP_CLK_HDMI_AXI>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 845

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+								

<&clk IMX8MP_CLK_HDMI_APB>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 846

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						assigned-clock-

parents = <&clk IMX8MP_SYS_PLL2_500M>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 847

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+								
	 <&clk IMX8MP_SYS_PLL1_133M>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 848

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						assigned-clock-

rates = <500000000>, <133000000>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
+					};
+
+					pgc_hdmi_phy: power-

domains@15 {

As per Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml the node should be called power-domain@.

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 852

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						#power-domain-

cells = <0>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 853

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						reg = 

<IMX8MP_POWER_DOMAIN_HDMI_PHY>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +2 -0
+					};
+
 					pgc_mipi_phy2: power-

domain@16 {

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 857

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
 						#power-domain-

cells = <0>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 858

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
 						reg = 

<IMX8MP_POWER_DOMAIN_MIPI_PHY2>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1383

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
@@ -1361,6 +1378,27 @@ eqos: ethernet@30bf0000 {
 				intf_mode = <&gpr 0x4>;
 				status = "disabled";
 			};
+
+			hdmi_blk_ctrl: blk-ctrl@32fc0000 {
+				compatible = "fsl,imx8mp-hdmi-blk-

ctrl", "syscon";

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
+				reg = <0x32fc0000 0x23c>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk 

IMX8MP_CLK_HDMI_ROOT>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1387

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+					 <&clk 

IMX8MP_CLK_HDMI_REF_266M>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1389

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +2 -0
+					 <&clk IMX8MP_CLK_HDMI_24M>,
+					 <&clk 

IMX8MP_CLK_HDMI_FDCC_TST>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1390

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				clock-names = "apb", "axi", 

"ref_266m", "ref_24m", "fdcc";

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1391

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				power-domains = <&pgc_hdmimix>, 

<&pgc_hdmimix>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1392

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						<&pgc_hdmimix>, 

<&pgc_hdmimix>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1393

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						<&pgc_hdmimix>, 

<&pgc_hdmimix>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1394

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						<&pgc_hdmimix>, 

<&pgc_hdmi_phy>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1395

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						<&pgc_hdmimix>, 

<&pgc_hdmimix>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1396

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				power-domain-names = "bus", 

"irqsteer", "lcdif",

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1397

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						     "pai", "pvi", 

"trng",

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1398

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						     "hdmi-tx", 

"hdmi-tx-phy",

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1399

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+						     "hdcp", 

"hrv";

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1403

Quoted 4 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +2 -0
+				#power-domain-cells = <1>;
+			};
 		};
 

According to RM this block is part of AIPS4, so it should be below hsio_blk_ctrl.

Best regards,
Alexander

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
 		aips5: bus@30c00000 {
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
#18 lore raw

Re: [PATCH V8 06/12] arm64: dts: imx8mp: add HDMI irqsteer

In reply to Adam Ford

Hi Adam,

thanks for working on this.

Am Samstag, 3. Februar 2024, 17:52:46 CET schrieb Adam Ford:

Quoted 17 lines

From: Lucas Stach <[email protected]>

The HDMI irqsteer is a secondary interrupt controller within the HDMI subsystem that maps all HDMI peripheral IRQs into a single upstream IRQ line.

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
(quoted diff) +0 -0

b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index
5c54073de615..5e51a766f3d9 100644

arch/arm64/boot/dts/freescale/imx8mp.dtsi hdmi_blk_ctrl: blk-ctrl@32fc0000 { · line 1399

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
@@ -1399,6 +1399,19 @@ hdmi_blk_ctrl: blk-ctrl@32fc0000 {
 						     "hdcp", 

"hrv";

arch/arm64/boot/dts/freescale/imx8mp.dtsi hdmi_blk_ctrl: blk-ctrl@32fc0000 {

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +5 -0
 				#power-domain-cells = <1>;
 			};
+
+			irqsteer_hdmi: interrupt-controller@32fc2000 {
+				compatible = "fsl,imx-irqsteer";
+				reg = <0x32fc2000 0x44>;
+				interrupts = <GIC_SPI 43 

IRQ_TYPE_LEVEL_HIGH>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi hdmi_blk_ctrl: blk-ctrl@32fc0000 {

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +7 -0
+				interrupt-controller;
+				#interrupt-cells = <1>;
+				fsl,channel = <1>;
+				fsl,num-irqs = <64>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>;
+				clock-names = "ipg";
+				power-domains = <&hdmi_blk_ctrl 

IMX8MP_HDMIBLK_PD_IRQSTEER>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi hdmi_blk_ctrl: blk-ctrl@32fc0000 { · line 1414

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+			};

According to RM this block is part of HDMI_TX which is part of AIPS4, so it should be below hsio_blk_ctrl.

Best regards,
Alexander

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
 		};
 
 		aips5: bus@30c00000 {
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
#49 lore raw

Re: [PATCH V8 11/12] arm64: dts: imx8mp: add HDMI display pipeline

In reply to Adam Ford

Hi Adam,

thanks for working on this.

Am Samstag, 3. Februar 2024, 17:52:51 CET schrieb Adam Ford:

Quoted 25 lines

From: Lucas Stach <[email protected]>

This adds the DT nodes for all the peripherals that make up the HDMI display pipeline.

---
V2: I took this from Lucas' original submission with the following:
Removed extra clock from HDMI-TX since it is now part of the power domain
Added interrupt-parent to PVI
Changed the name of the HDMI tranmitter to fsl,imx8mp-hdmi-tx Added ports to HDMI-tx

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 94 +++++++++++++++++++++++
 1 file changed, 94 insertions(+)
(quoted diff) +0 -0

b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index
5e51a766f3d9..e84b4f40e570 100644

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1413

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
@@ -1412,6 +1412,100 @@ irqsteer_hdmi: interrupt-controller@32fc2000 {
 				clock-names = "ipg";
 				power-domains = <&hdmi_blk_ctrl 

IMX8MP_HDMIBLK_PD_IRQSTEER>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1420

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +6 -0
 			};
+
+			hdmi_pvi: display-bridge@32fc4000 {
+				compatible = "fsl,imx8mp-hdmi-pvi";
+				reg = <0x32fc4000 0x40>;
+				interrupt-parent = <&irqsteer_hdmi>;
+				interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;

irqsteer_hdmi has #interrupt-cells = <1>, so IRQ flags should be removed. dtbs_check also warns about this.

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1421

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				power-domains = <&hdmi_blk_ctrl 

IMX8MP_HDMIBLK_PD_PVI>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 8 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +8 -0
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+						pvi_from_lcdif3: 

endpoint {

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1430

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+							remote-

endpoint = <&lcdif3_to_pvi>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +6 -0
+						};
+					};
+
+					port@1 {
+						reg = <1>;
+						pvi_to_hdmi_tx: 

endpoint {

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1437

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+							remote-

endpoint = <&hdmi_tx_from_pvi>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1446

Quoted 9 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +9 -0
+						};
+					};
+				};
+			};
+
+			lcdif3: display-controller@32fc6000 {
+				compatible = "fsl,imx8mp-lcdif";
+				reg = <0x32fc6000 0x238>;
+				interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;

irqsteer_hdmi has #interrupt-cells = <1>, so IRQ flags should be removed. dtbs_check also warns about this.

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 4 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +4 -0
+				interrupt-parent = <&irqsteer_hdmi>;
+				clocks = <&hdmi_tx_phy>,
+					 <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk 

IMX8MP_CLK_HDMI_ROOT>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1451

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				clock-names = "pix", "axi", 

"disp_axi";

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1452

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				power-domains = <&hdmi_blk_ctrl 

IMX8MP_HDMIBLK_PD_LCDIF>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 4 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +4 -0
+
+				port {
+					lcdif3_to_pvi: endpoint {
+						remote-endpoint = 

<&pvi_from_lcdif3>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1464

Quoted 8 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +8 -0
+					};
+				};
+			};
+
+			hdmi_tx: hdmi@32fd8000 {
+				compatible = "fsl,imx8mp-hdmi-tx";
+				reg = <0x32fd8000 0x7eff>;
+				interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;

irqsteer_hdmi has #interrupt-cells = <1>, so IRQ flags should be removed. dtbs_check also warns about this.

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
+				interrupt-parent = <&irqsteer_hdmi>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk 

IMX8MP_CLK_HDMI_REF_266M>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
+					 <&clk IMX8MP_CLK_32K>,
+					 <&hdmi_tx_phy>;
+				clock-names = "iahb", "isfr", "cec", 

"pix";

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1471

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				assigned-clocks = <&clk 

IMX8MP_CLK_HDMI_REF_266M>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1472

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				assigned-clock-parents = <&clk 

IMX8MP_SYS_PLL1_266M>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1473

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				power-domains = <&hdmi_blk_ctrl 

IMX8MP_HDMIBLK_PD_HDMI_TX>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 11 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +11 -0
+				reg-io-width = <1>;
+				status = "disabled";
+
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+
+						hdmi_tx_from_pvi: 

endpoint {

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1485

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+							remote-

endpoint = <&pvi_to_hdmi_tx>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +6 -0
+						};
+					};
+
+					port@1 {
+						reg = <1>;
+						/* Point endpoint 

to the HDMI connector */

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 {

Quoted 11 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +11 -0
+					};
+				};
+			};
+
+			hdmi_tx_phy: phy@32fdff00 {
+				compatible = "fsl,imx8mp-hdmi-phy";
+				reg = <0x32fdff00 0x100>;
+				clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+					 <&clk IMX8MP_CLK_HDMI_24M>;
+				clock-names = "apb", "ref";
+				assigned-clocks = <&clk 

IMX8MP_CLK_HDMI_24M>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1503

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				assigned-clock-parents = <&clk 

IMX8MP_CLK_24M>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1504

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+				power-domains = <&hdmi_blk_ctrl 

IMX8MP_HDMIBLK_PD_HDMI_TX_PHY>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi irqsteer_hdmi: interrupt-controller@32fc2000 { · line 1508

Quoted 4 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +4 -0
+				#clock-cells = <0>;
+				#phy-cells = <0>;
+				status = "disabled";
+			};

According to RM these blocks are part of AIPS4, so it should be below hsio_blk_ctrl.

Best regards,
Alexander

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
 		};
 
 		aips5: bus@30c00000 {
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
#6 lore raw

Re: [PATCH V8 02/12] phy: freescale: add Samsung HDMI PHY

In reply to Dmitry Baryshkov
Quoted 112 lines · Dmitry Baryshkov
Quoted 111 lines · Adam Ford

From: Lucas Stach <[email protected]>

This adds the driver for the Samsung HDMI PHY found on the i.MX8MP SoC.

---
V4: Make lookup table hex values lower case.

V3: Re-order the Makefile to keep it alphabetical
Remove unused defines

V2: Fixed some whitespace found from checkpatch
Change error handling when enabling apbclk to use dev_err_probe Rebase on Linux-Next

I (Adam) tried to help move this along, so I took Lucas' patch and attempted to apply fixes based on feedback. I don't have all the history, so apologies for that.

---
 drivers/phy/freescale/Kconfig                |    6 +
 drivers/phy/freescale/Makefile               |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 1075 ++++++++++++++++++
 3 files changed, 1082 insertions(+)
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
drivers/phy/freescale/Kconfig +6 -0
index 853958fb2c06..5c2b73042dfc 100644
@@ -35,6 +35,12 @@ config PHY_FSL_IMX8M_PCIE
          Enable this to add support for the PCIE PHY as found on
          i.MX8M family of SOCs.
 
+config PHY_FSL_SAMSUNG_HDMI_PHY
+       tristate "Samsung HDMI PHY support"
+       depends on OF && HAS_IOMEM
+       help
+         Enable this to add support for the Samsung HDMI PHY in i.MX8MP.
+
 endif
 
 config PHY_FSL_LYNX_28G
drivers/phy/freescale/Makefile +1 -0
index cedb328bc4d2..79e5f16d3ce8 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_PHY_MIXEL_LVDS_PHY)        += phy-fsl-imx8qm-lvds-phy.o
 obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY)      += phy-fsl-imx8-mipi-dphy.o
 obj-$(CONFIG_PHY_FSL_IMX8M_PCIE)       += phy-fsl-imx8m-pcie.o
 obj-$(CONFIG_PHY_FSL_LYNX_28G)         += phy-fsl-lynx-28g.o
+obj-$(CONFIG_PHY_FSL_SAMSUNG_HDMI_PHY)  += phy-fsl-samsung-hdmi.o
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +50 -0
new file mode 100644
index 000000000000..bf0e2299d00f
@@ -0,0 +1,1075 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ * Copyright 2022 Pengutronix, Lucas Stach <[email protected]>
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+#define PHY_REG_33             0x84
+#define  REG33_MODE_SET_DONE   BIT(7)
+#define  REG33_FIX_DA          BIT(1)
+
+#define PHY_REG_34             0x88
+#define  REG34_PHY_READY       BIT(7)
+#define  REG34_PLL_LOCK                BIT(6)
+#define  REG34_PHY_CLK_READY   BIT(5)
+
+
+#define PHY_PLL_REGS_NUM 48
+
+struct phy_config {
+       u32     clk_rate;
+       u8 regs[PHY_PLL_REGS_NUM];
+};
+
+const struct phy_config phy_pll_cfg[] = {
+       {       22250000, {
+                       0x00, 0xd1, 0x4b, 0xf1, 0x89, 0x88, 0x80, 0x40,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x15, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },
+       }, {
+               23750000, {
+                       0x00, 0xd1, 0x50, 0xf1, 0x86, 0x85, 0x80, 0x40,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x03, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Quoted 8 lines

drivers/phy/freescale/phy-fsl-samsung-hdmi.c line 52

Quoted 2 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +2 -0
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },

Generally I see that these entries contain a high level of duplication. Could you please extract the common part and a rate-dependent part. Next, it would be best if instead of writing the register values via the rate LUT, the driver could calculate those values.
This allows us to support other HDMI modes if the need arises at some point.

Hi Adam,

can you please have a look at: https://lore.kernel.org/all/4830698.GXAFRqVoOG@steina-w/

there we have fixed this already. Not sure which version you picked for your work.

Regards,
Marco

Quoted 17 lines
Quoted 10 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +9 -0
+       }, {
+               24000000, {
+                       0x00, 0xd1, 0x50, 0xf0, 0x00, 0x00, 0x80, 0x00,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x01, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },
Signature · 2 lines
With best wishes
Dmitry
maintainer
#26 lore raw

Re: [PATCH V8 09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

In reply to Adam Ford
Quoted 116 lines · Adam Ford

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

---
V3: Change name and location to better idenfity as a bridge and
HDMI 2.0a transmitter

Fix typos and feedback from Rob and added ports.

---
  .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    | 102 ++++++++++++++++++
  1 file changed, 102 insertions(+)

create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +92 -0
new file mode 100644
index 000000000000..3791c9f4ebab
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/fsl,imx8mp-hdmi-tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP DWC HDMI TX Encoder
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+description:
+  The i.MX8MP HDMI transmitter is a Synopsys DesignWare
+  HDMI 2.0a TX controller IP.
+
+allOf:
+  - $ref: /schemas/display/bridge/synopsys,dw-hdmi.yaml#
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8mp-hdmi-tx
+
+  reg-io-width:
+    const: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: iahb
+      - const: isfr
+      - const: cec
+      - const: pix
+
+  power-domains:
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Parallel RGB input port
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: HDMI output port
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - power-domains
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    hdmi@32fd8000 {
+        compatible = "fsl,imx8mp-hdmi-tx";
+        reg = <0x32fd8000 0x7eff>;
+        interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+                 <&clk IMX8MP_CLK_32K>,
+                 <&hdmi_tx_phy>;
+        clock-names = "iahb", "isfr", "cec", "pix";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+        reg-io-width = <1>;
+        ports {
+           #address-cells = <1>;
+           #size-cells = <0>;
+           port@0 {
+             reg = <0>;
+
+             hdmi_tx_from_pvi: endpoint {
+               remote-endpoint = <&pvi_to_hdmi_tx>;
+             };

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 102

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +10 -0
+          };
+
+          port@1 {
+            reg = <1>;
+              hdmi_tx_out: endpoint {
+                remote-endpoint = <&hdmi0_con>;
+              };
+          };
+        };
+    };

I'll apply patches 9 & 10 once this one is properly reviewed

Thanks,
Neil

maintainer Applied
#51 lore raw

Re: (subset) [PATCH V8 00/12] soc: imx8mp: Add support for HDMI

In reply to Adam Ford

Hi,

Quoted 11 lines · Adam Ford

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

[...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)

[07/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI

        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=f490d0cb9360466f6df0def3eccc47fabba9775b
[08/12] drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=059c53e877ca6e723e10490c27c1487a63e66efe
Signature · 1 line
Neil
maintainer Reviewed-by on v8 3/12
#10 lore raw

Re: [PATCH V8 03/12] dt-bindings: soc: imx: add missing clock and power-domains to imx8mp-hdmi-blk-ctrl

In reply to Adam Ford
Quoted 20 lines · Adam Ford

Per guidance from the NXP downstream kernel, if the clock is disabled before HDMI/LCDIF probe, LCDIF will not get pixel clock from HDMI PHY and throw an error:

[CRTC:39:crtc-2] vblank wait timed out

    WARNING: CPU: 2 PID: 9 at drivers/gpu/drm/drm_atomic_helper.c:
        1634 drm_atomic_helper_wait_for_vblanks.part.0+0x23c/0x260

Fix this by adding the fdcc clock to the hdmi_blk_ctrl. This should be safe, since neither this power domain nor the dependent HDMI and LCDIF drivers been enabled or added to the SoC device tree yet.

According to Sandor Yu from NXP, "the FDCC clock is not for HDMITX in desgin, but it is part of HDMI domain that needed by HDMITX. So I think it is reasonable added it to the power domain driver."

The driver also supports two power domains which are missing from the binding that also fix an issue with resuming from suspend.

Quoted 9 lines

---
V2: Update commit message to both show error and give a bit more
background.
Add missing power domains hdcp and hdrv as pointed out by Marek Vasut

---
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
maintainer Reviewed-by on v8 9/12
#27 lore raw

Re: [PATCH V8 09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

In reply to Adam Ford
Quoted 12 lines · Adam Ford

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

---
V3: Change name and location to better idenfity as a bridge and
HDMI 2.0a transmitter

Quoted 6 lines

Fix typos and feedback from Rob and added ports.

---
 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
author
#14 lore raw

Re: [PATCH V8 05/12] arm64: dts: imx8mp: add HDMI power-domains

In reply to Alexander Stein
Quoted 27 lines · Alexander Stein

Hi Adam,

thanks for working on this.

Am Samstag, 3. Februar 2024, 17:52:45 CET schrieb Adam Ford:

Quoted 19 lines

From: Lucas Stach <[email protected]>

This adds the PGC and HDMI blk-ctrl nodes providing power control for HDMI subsystem peripherals.

---
V2: Add missing power-domains hdcp and hrv

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 38 +++++++++++++++++++++++
 1 file changed, 38 insertions(+)
(quoted diff) +0 -0

b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index
76c73daf546b..5c54073de615 100644

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 836

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
@@ -836,6 +836,23 @@ pgc_mediamix: power-domain@10 {
                                                       <&clk

IMX8MP_CLK_MEDIA_APB_ROOT>;

Quoted 5 lines

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 839

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
                                      };
 
+                                     pgc_hdmimix: power-

domains@14 {

Alexander,

Thanks for the feedback.

Quoted 20 lines

As per Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml the node should be called power-domain@.

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 840

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             #power-domain-

cells = <0>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 841

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             reg =

<IMX8MP_POWER_DOMAIN_HDMIMIX>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 842

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             clocks = <&clk

IMX8MP_CLK_HDMI_ROOT>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 843

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                                      <&clk

IMX8MP_CLK_HDMI_APB>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 844

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             assigned-clocks =

<&clk IMX8MP_CLK_HDMI_AXI>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 845

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+

<&clk IMX8MP_CLK_HDMI_APB>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 846

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             assigned-clock-

parents = <&clk IMX8MP_SYS_PLL2_500M>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 847

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+
         <&clk IMX8MP_SYS_PLL1_133M>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 848

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             assigned-clock-
Quoted 8 lines

rates = <500000000>, <133000000>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
+                                     };
+
+                                     pgc_hdmi_phy: power-

domains@15 {

As per Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml the node should be called power-domain@.

Whoops. I totally missed these when I applied them. I'll have them fixed on the next spin.

Quoted 49 lines

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 852

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             #power-domain-

cells = <0>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 853

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             reg =

<IMX8MP_POWER_DOMAIN_HDMI_PHY>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +2 -0
+                                     };
+
                                      pgc_mipi_phy2: power-

domain@16 {

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 857

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
                                              #power-domain-

cells = <0>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi pgc_mediamix: power-domain@10 { · line 858

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
                                              reg =

<IMX8MP_POWER_DOMAIN_MIPI_PHY2>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1383

Quoted 7 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
@@ -1361,6 +1378,27 @@ eqos: ethernet@30bf0000 {
                              intf_mode = <&gpr 0x4>;
                              status = "disabled";
                      };
+
+                     hdmi_blk_ctrl: blk-ctrl@32fc0000 {
+                             compatible = "fsl,imx8mp-hdmi-blk-

ctrl", "syscon";

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 {

Quoted 3 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +3 -0
+                             reg = <0x32fc0000 0x23c>;
+                             clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                                      <&clk

IMX8MP_CLK_HDMI_ROOT>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1387

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                      <&clk

IMX8MP_CLK_HDMI_REF_266M>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1389

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +2 -0
+                                      <&clk IMX8MP_CLK_HDMI_24M>,
+                                      <&clk

IMX8MP_CLK_HDMI_FDCC_TST>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1390

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                             clock-names = "apb", "axi",

"ref_266m", "ref_24m", "fdcc";

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1391

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                             power-domains = <&pgc_hdmimix>,

<&pgc_hdmimix>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1392

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             <&pgc_hdmimix>,

<&pgc_hdmimix>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1393

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             <&pgc_hdmimix>,

<&pgc_hdmimix>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1394

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             <&pgc_hdmimix>,

<&pgc_hdmi_phy>,

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1395

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                             <&pgc_hdmimix>,

<&pgc_hdmimix>;

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1396

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                             power-domain-names = "bus",

"irqsteer", "lcdif",

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1397

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                                  "pai", "pvi",

"trng",

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1398

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                                  "hdmi-tx",

"hdmi-tx-phy",

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1399

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -0
+                                                  "hdcp",
Quoted 8 lines

"hrv";

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1403

Quoted 4 lines
arch/arm64/boot/dts/freescale/imx8mp.dtsi +2 -0
+                             #power-domain-cells = <1>;
+                     };
              };
 

According to RM this block is part of AIPS4, so it should be below hsio_blk_ctrl.

This is how it was when I got it, but I should have caught it. Thanks for that. It looks like the subsequent HDMI, IRQ_steerting, LCDIF and PHY ones are also out of place.

adam

Quoted 14 lines

Best regards,
Alexander

arch/arm64/boot/dts/freescale/imx8mp.dtsi eqos: ethernet@30bf0000 { · line 1404

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mp.dtsi +0 -0
              aips5: bus@30c00000 {

--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/

author
#7 lore raw

Re: [PATCH V8 02/12] phy: freescale: add Samsung HDMI PHY

In reply to Marco Felsch
Quoted 123 lines · Marco Felsch
Quoted 112 lines · Dmitry Baryshkov
Quoted 111 lines · Adam Ford

From: Lucas Stach <[email protected]>

This adds the driver for the Samsung HDMI PHY found on the i.MX8MP SoC.

---
V4: Make lookup table hex values lower case.

V3: Re-order the Makefile to keep it alphabetical
Remove unused defines

V2: Fixed some whitespace found from checkpatch
Change error handling when enabling apbclk to use dev_err_probe Rebase on Linux-Next

I (Adam) tried to help move this along, so I took Lucas' patch and attempted to apply fixes based on feedback. I don't have all the history, so apologies for that.

---
 drivers/phy/freescale/Kconfig                |    6 +
 drivers/phy/freescale/Makefile               |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 1075 ++++++++++++++++++
 3 files changed, 1082 insertions(+)
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
drivers/phy/freescale/Kconfig +6 -0
index 853958fb2c06..5c2b73042dfc 100644
@@ -35,6 +35,12 @@ config PHY_FSL_IMX8M_PCIE
          Enable this to add support for the PCIE PHY as found on
          i.MX8M family of SOCs.
 
+config PHY_FSL_SAMSUNG_HDMI_PHY
+       tristate "Samsung HDMI PHY support"
+       depends on OF && HAS_IOMEM
+       help
+         Enable this to add support for the Samsung HDMI PHY in i.MX8MP.
+
 endif
 
 config PHY_FSL_LYNX_28G
drivers/phy/freescale/Makefile +1 -0
index cedb328bc4d2..79e5f16d3ce8 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_PHY_MIXEL_LVDS_PHY)        += phy-fsl-imx8qm-lvds-phy.o
 obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY)      += phy-fsl-imx8-mipi-dphy.o
 obj-$(CONFIG_PHY_FSL_IMX8M_PCIE)       += phy-fsl-imx8m-pcie.o
 obj-$(CONFIG_PHY_FSL_LYNX_28G)         += phy-fsl-lynx-28g.o
+obj-$(CONFIG_PHY_FSL_SAMSUNG_HDMI_PHY)  += phy-fsl-samsung-hdmi.o
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +50 -0
new file mode 100644
index 000000000000..bf0e2299d00f
@@ -0,0 +1,1075 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 NXP
+ * Copyright 2022 Pengutronix, Lucas Stach <[email protected]>
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+#define PHY_REG_33             0x84
+#define  REG33_MODE_SET_DONE   BIT(7)
+#define  REG33_FIX_DA          BIT(1)
+
+#define PHY_REG_34             0x88
+#define  REG34_PHY_READY       BIT(7)
+#define  REG34_PLL_LOCK                BIT(6)
+#define  REG34_PHY_CLK_READY   BIT(5)
+
+
+#define PHY_PLL_REGS_NUM 48
+
+struct phy_config {
+       u32     clk_rate;
+       u8 regs[PHY_PLL_REGS_NUM];
+};
+
+const struct phy_config phy_pll_cfg[] = {
+       {       22250000, {
+                       0x00, 0xd1, 0x4b, 0xf1, 0x89, 0x88, 0x80, 0x40,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x15, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },
+       }, {
+               23750000, {
+                       0x00, 0xd1, 0x50, 0xf1, 0x86, 0x85, 0x80, 0x40,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x03, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Quoted 8 lines

drivers/phy/freescale/phy-fsl-samsung-hdmi.c line 52

Quoted 2 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +2 -0
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },

Generally I see that these entries contain a high level of duplication. Could you please extract the common part and a rate-dependent part. Next, it would be best if instead of writing the register values via the rate LUT, the driver could calculate those values.
This allows us to support other HDMI modes if the need arises at some point.

Quoted 6 lines

Hi Adam,

can you please have a look at: https://lore.kernel.org/all/4830698.GXAFRqVoOG@steina-w/

there we have fixed this already. Not sure which version you picked for your work.

It must have been an earlier version. I got the list from Fabio, but I might have also gotten it mixed up. I'll look at this version and base my series on it and try to address comments others made. It'll likely take me a few days to catch up.

thanks for the pointer.

adam

Quoted 21 lines

Regards,
Marco

Quoted 17 lines

drivers/phy/freescale/phy-fsl-samsung-hdmi.c line 61

Quoted 10 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +9 -0
+       }, {
+               24000000, {
+                       0x00, 0xd1, 0x50, 0xf0, 0x00, 0x00, 0x80, 0x00,
+                       0x4f, 0x30, 0x33, 0x65, 0x00, 0x01, 0x25, 0x80,
+                       0x6c, 0xf2, 0x67, 0x00, 0x10, 0x8f, 0x30, 0x32,
+                       0x60, 0x8f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0xe0, 0x83, 0x0f, 0x3e, 0xf8, 0x00, 0x00,
+               },

--
With best wishes
Dmitry

maintainer Applied
#52 lore raw

Re: (subset) [PATCH V8 00/12] soc: imx8mp: Add support for HDMI

In reply to Adam Ford

Hi,

Quoted 11 lines · Adam Ford

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

[...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)

[09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=8933d29e7703f6f905bc84186b915b0ab4fe03bb
[10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=1f36d634670d8001a45fe2f2dcae546819f9c7d8
Signature · 1 line
Neil
#53 lore raw
In reply to Adam Ford

- trimmed cc-list

Quoted 50 lines · Adam Ford

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently,
I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different times and had different amount of retries. In an effort to merge them I used the highest version attempt.

Adam Ford (3):
dt-bindings: soc: imx: add missing clock and power-domains to
imx8mp-hdmi-blk-ctrl
pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix
domain
arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

Lucas Stach (9):
dt-bindings: phy: add binding for the i.MX8MP HDMI PHY
phy: freescale: add Samsung HDMI PHY
arm64: dts: imx8mp: add HDMI power-domains
arm64: dts: imx8mp: add HDMI irqsteer
dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI TX drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
arm64: dts: imx8mp: add HDMI display pipeline

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    |  102 ++
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      |   84 ++
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     |   62 +
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     |   22 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi     |  145 +++
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/bridge/imx/Kconfig            |   18 +
 drivers/gpu/drm/bridge/imx/Makefile           |    2 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c  |  207 ++++
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c   |  154 +++
 drivers/phy/freescale/Kconfig                 |    6 +
 drivers/phy/freescale/Makefile                |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c  | 1075 +++++++++++++++++
Quoted 9 lines
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c        |   10 +-
 14 files changed, 1876 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c

Patch 3 and patch 4, applied for next to my pmdomain tree. Patch 3 (DT doc) is also available at the immutable "dt" branch, allowing it to be pulled into the soc maintainer's tree too.

Kind regards
Uffe

#22 lore raw

Re: [PATCH V8 08/12] drm/bridge: imx: add driver for HDMI TX Parallel Video Interface

In reply to Adam Ford

Hi all,

Quoted 19 lines · Adam Ford

From: Lucas Stach <[email protected]>

This IP block is found in the HDMI subsystem of the i.MX8MP SoC. It has a full timing generator and can switch between different video sources. On the i.MX8MP however the only supported source is the LCDIF. The block just needs to be powered up and told about the polarity of the video sync signals to act in bypass mode.

<snip>

Quoted 5 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +0 -0
new file mode 100644
index 000000000000..a76b7669fe8a

...

Quoted 28 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +28 -0
+static void imx8mp_hdmi_pvi_bridge_enable(struct drm_bridge *bridge,
+					  struct drm_bridge_state *bridge_state)
+{
+	struct drm_atomic_state *state = bridge_state->base.state;
+	struct imx8mp_hdmi_pvi *pvi = to_imx8mp_hdmi_pvi(bridge);
+	struct drm_connector_state *conn_state;
+	const struct drm_display_mode *mode;
+	struct drm_crtc_state *crtc_state;
+	struct drm_connector *connector;
+	u32 bus_flags, val;
+
+	connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
+	conn_state = drm_atomic_get_new_connector_state(state, connector);
+	crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
+
+	if (WARN_ON(pm_runtime_resume_and_get(pvi->dev)))
+		return;
+
+	mode = &crtc_state->adjusted_mode;
+
+	val = FIELD_PREP(PVI_CTRL_MODE_MASK, PVI_CTRL_MODE_LCDIF) | PVI_CTRL_EN;
+
+	if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+		val |= PVI_CTRL_OP_VSYNC_POL | PVI_CTRL_INP_VSYNC_POL;
+
+	if (mode->flags & DRM_MODE_FLAG_PHSYNC)
+		val |= PVI_CTRL_OP_HSYNC_POL | PVI_CTRL_INP_HSYNC_POL;
+

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c line 88

Quoted 10 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +10 -0
+	if (pvi->next_bridge->timings)
+		bus_flags = pvi->next_bridge->timings->input_bus_flags;
+	else if (bridge_state)
+		bus_flags = bridge_state->input_bus_cfg.flags;
+
+	if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
+		val |= PVI_CTRL_OP_DE_POL | PVI_CTRL_INP_DE_POL;
+
+	writel(val, pvi->regs + HTX_PVI_CTRL);
+}

Apologies if this has already been reported or fixed, I searched lore and did not find anything. Clang warns (or errors with CONFIG_WERROR=y) for this function:

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:81:11: error: variable 'bus_flags' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
81 | else if (bridge_state)
| ^~~~~~~~~~~~
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:84:6: note: uninitialized use occurs here
84 | if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
| ^~~~~~~~~
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:81:7: note: remove the 'if' if its condition is always true

     81 |         else if (bridge_state)
        |              ^~~~~~~~~~~~~~~~~
     82 |                 bus_flags = bridge_state->input_bus_cfg.flags;
  drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:60:15: note: initialize the variable 'bus_flags' to silence this warning
     60 |         u32 bus_flags, val;
        |                      ^
        |                       = 0

1 error generated.

This seems legitimate. If bridge_state can be NULL, should bus_flags be initialized to zero like it suggests or should that 'else if' be turned into a plain 'else'? I am happy to send a patch with that guidance.

Cheers,
Nathan

reviewer Reviewed-by on v8 1/12
#2 lore raw

Re: [PATCH V8 01/12] dt-bindings: phy: add binding for the i.MX8MP HDMI PHY

In reply to Adam Ford
Quoted 7 lines · On Sat, 3 Feb 2024 10:52:41 -0600 Adam Ford <[email protected]> wrote:

From: Lucas Stach <[email protected]>

Add a DT binding for the HDMI PHY found on the i.MX8MP SoC.

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
reviewer
#8 lore raw

Re: [PATCH V8 02/12] phy: freescale: add Samsung HDMI PHY

In reply to Adam Ford
Quoted 8 lines · On Sat, 3 Feb 2024 10:52:42 -0600 Adam Ford <[email protected]> wrote:

From: Lucas Stach <[email protected]>

This adds the driver for the Samsung HDMI PHY found on the i.MX8MP SoC.

[...]

drivers/phy/freescale/phy-fsl-samsung-hdmi.c line 27

Quoted 10 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +10 -0
+#define PHY_REG_33		0x84
+#define  REG33_MODE_SET_DONE	BIT(7)
+#define  REG33_FIX_DA		BIT(1)
+
+#define PHY_REG_34		0x88
+#define  REG34_PHY_READY	BIT(7)
+#define  REG34_PLL_LOCK		BIT(6)
+#define  REG34_PHY_CLK_READY	BIT(5)
+
+

Nitpick: only one empty line here.

Quoted 1 line

+#define PHY_PLL_REGS_NUM 48

[...]

Quoted 15 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +15 -0
+static int phy_clk_register(struct fsl_samsung_hdmi_phy *phy)
+{
+	struct device *dev = phy->dev;
+	struct device_node *np = dev->of_node;
+	struct clk_init_data init;
+	const char *parent_name;
+	struct clk *phyclk;
+	int ret;
+
+	parent_name = __clk_get_name(phy->refclk);
+
+	init.parent_names = &parent_name;
+	init.num_parents = 1;
+	init.flags = 0;
+	init.name = "hdmi_pclk";

drivers/phy/freescale/phy-fsl-samsung-hdmi.c line 950

Quoted 10 lines
drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file +10 -0
+	init.ops = &phy_clk_ops;
+
+	phy->hw.init = &init;
+
+	phyclk = devm_clk_register(dev, &phy->hw);
+	if (IS_ERR(phyclk))
+		return dev_err_probe(dev, PTR_ERR(phyclk),
+				     "failed to register clock\n");
+
+	ret = of_clk_add_provider(np, of_clk_src_simple_get, phyclk);

Ouch:

Quoted 1 line

This function is *deprecated*. Use of_clk_add_hw_provider() instead.

Appears as an easy replacement though.

Otherwise looks good.

Luca

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
reviewer Reviewed-by on v8 7/12
#20 lore raw

Re: [PATCH V8 07/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI

In reply to Adam Ford

Hi Adam,

Quoted 8 lines · On Sat, 3 Feb 2024 10:52:47 -0600 Adam Ford <[email protected]> wrote:

From: Lucas Stach <[email protected]>

Add binding for the i.MX8MP HDMI parallel video interface block.

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
reviewer Reviewed-by on v8 9/12
#28 lore raw

Re: [PATCH V8 09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

In reply to Adam Ford
Quoted 7 lines · On Sat, 3 Feb 2024 10:52:49 -0600 Adam Ford <[email protected]> wrote:

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

[...]

Quoted 21 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +21 -0
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    hdmi@32fd8000 {
+        compatible = "fsl,imx8mp-hdmi-tx";
+        reg = <0x32fd8000 0x7eff>;
+        interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+                 <&clk IMX8MP_CLK_32K>,
+                 <&hdmi_tx_phy>;
+        clock-names = "iahb", "isfr", "cec", "pix";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+        reg-io-width = <1>;
+        ports {
+           #address-cells = <1>;
+           #size-cells = <0>;
+           port@0 {

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 97

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +10 -0
+             reg = <0>;
+
+             hdmi_tx_from_pvi: endpoint {
+               remote-endpoint = <&pvi_to_hdmi_tx>;
+             };
+          };
+
+          port@1 {
+            reg = <1>;
+              hdmi_tx_out: endpoint {

Two excess indenting spaces on this line (port@0 is correct). Also, I think there should an empty line between properties and nodes.

With these fixed:

Luca

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
reviewer Reviewed-by on v8 10/12
#34 lore raw

Re: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI

In reply to Adam Ford
Quoted 6 lines · On Sat, 3 Feb 2024 10:52:50 -0600 Adam Ford <[email protected]> wrote:

From: Lucas Stach <[email protected]>

Add a simple wrapper driver for the DWC HDMI bridge driver that implements the few bits that are necessary to abstract the i.MX8MP SoC integration.

Quoted 8 lines
Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#23 lore raw

Re: [PATCH V8 08/12] drm/bridge: imx: add driver for HDMI TX Parallel Video Interface

In reply to Nathan Chancellor
Quoted 89 lines · Nathan Chancellor

Hi all,

Quoted 19 lines · Adam Ford

From: Lucas Stach <[email protected]>

This IP block is found in the HDMI subsystem of the i.MX8MP SoC. It has a full timing generator and can switch between different video sources. On the i.MX8MP however the only supported source is the LCDIF. The block just needs to be powered up and told about the polarity of the video sync signals to act in bypass mode.

<snip>

Quoted 5 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +0 -0
new file mode 100644
index 000000000000..a76b7669fe8a

...

Quoted 28 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +28 -0
+static void imx8mp_hdmi_pvi_bridge_enable(struct drm_bridge *bridge,
+                                       struct drm_bridge_state *bridge_state)
+{
+     struct drm_atomic_state *state = bridge_state->base.state;
+     struct imx8mp_hdmi_pvi *pvi = to_imx8mp_hdmi_pvi(bridge);
+     struct drm_connector_state *conn_state;
+     const struct drm_display_mode *mode;
+     struct drm_crtc_state *crtc_state;
+     struct drm_connector *connector;
+     u32 bus_flags, val;
+
+     connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
+     conn_state = drm_atomic_get_new_connector_state(state, connector);
+     crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
+
+     if (WARN_ON(pm_runtime_resume_and_get(pvi->dev)))
+             return;
+
+     mode = &crtc_state->adjusted_mode;
+
+     val = FIELD_PREP(PVI_CTRL_MODE_MASK, PVI_CTRL_MODE_LCDIF) | PVI_CTRL_EN;
+
+     if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+             val |= PVI_CTRL_OP_VSYNC_POL | PVI_CTRL_INP_VSYNC_POL;
+
+     if (mode->flags & DRM_MODE_FLAG_PHSYNC)
+             val |= PVI_CTRL_OP_HSYNC_POL | PVI_CTRL_INP_HSYNC_POL;
+

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c line 88

Quoted 10 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +10 -0
+     if (pvi->next_bridge->timings)
+             bus_flags = pvi->next_bridge->timings->input_bus_flags;
+     else if (bridge_state)
+             bus_flags = bridge_state->input_bus_cfg.flags;
+
+     if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
+             val |= PVI_CTRL_OP_DE_POL | PVI_CTRL_INP_DE_POL;
+
+     writel(val, pvi->regs + HTX_PVI_CTRL);
+}

Apologies if this has already been reported or fixed, I searched lore and did not find anything. Clang warns (or errors with CONFIG_WERROR=y) for this function:

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:81:11: error: variable 'bus_flags' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
81 | else if (bridge_state)
| ^~~~~~~~~~~~
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:84:6: note: uninitialized use occurs here
84 | if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
| ^~~~~~~~~
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:81:7: note: remove the 'if' if its condition is always true

     81 |         else if (bridge_state)
        |              ^~~~~~~~~~~~~~~~~
     82 |                 bus_flags = bridge_state->input_bus_cfg.flags;
  drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:60:15: note: initialize the variable 'bus_flags' to silence this warning
     60 |         u32 bus_flags, val;
        |                      ^
        |                       = 0
Quoted 5 lines

1 error generated.

This seems legitimate. If bridge_state can be NULL, should bus_flags be initialized to zero like it suggests or should that 'else if' be turned into a plain 'else'? I am happy to send a patch with that guidance.

I don't think we can turn the else-if into a blind else, because in order to make bus_flags point to bridge_state->input_bus_cfg.flags, bridge_state must not be NULL, but we could add an additional else to set bus_flags to 0, but I think the simplest thing to do would be to set bus_flags = 0 at the initialization on line 60 as it suggests.

If you agree, I can submit a patch later tonight. I need to fix another issue found by the build-bot [1] to make line 113 return NULL instead of 0 anyway. I figured I could just fix them both at the same time.

adam

[1] - https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 3 lines

Cheers,
Nathan

#24 lore raw

Re: [PATCH V8 08/12] drm/bridge: imx: add driver for HDMI TX Parallel Video Interface

Quoted 102 lines · Adam Ford
Quoted 89 lines · Nathan Chancellor

Hi all,

Quoted 19 lines · Adam Ford

From: Lucas Stach <[email protected]>

This IP block is found in the HDMI subsystem of the i.MX8MP SoC. It has a full timing generator and can switch between different video sources. On the i.MX8MP however the only supported source is the LCDIF. The block just needs to be powered up and told about the polarity of the video sync signals to act in bypass mode.

<snip>

Quoted 5 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +0 -0
new file mode 100644
index 000000000000..a76b7669fe8a

...

Quoted 28 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +28 -0
+static void imx8mp_hdmi_pvi_bridge_enable(struct drm_bridge *bridge,
+                                       struct drm_bridge_state *bridge_state)
+{
+     struct drm_atomic_state *state = bridge_state->base.state;
+     struct imx8mp_hdmi_pvi *pvi = to_imx8mp_hdmi_pvi(bridge);
+     struct drm_connector_state *conn_state;
+     const struct drm_display_mode *mode;
+     struct drm_crtc_state *crtc_state;
+     struct drm_connector *connector;
+     u32 bus_flags, val;
+
+     connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
+     conn_state = drm_atomic_get_new_connector_state(state, connector);
+     crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
+
+     if (WARN_ON(pm_runtime_resume_and_get(pvi->dev)))
+             return;
+
+     mode = &crtc_state->adjusted_mode;
+
+     val = FIELD_PREP(PVI_CTRL_MODE_MASK, PVI_CTRL_MODE_LCDIF) | PVI_CTRL_EN;
+
+     if (mode->flags & DRM_MODE_FLAG_PVSYNC)
+             val |= PVI_CTRL_OP_VSYNC_POL | PVI_CTRL_INP_VSYNC_POL;
+
+     if (mode->flags & DRM_MODE_FLAG_PHSYNC)
+             val |= PVI_CTRL_OP_HSYNC_POL | PVI_CTRL_INP_HSYNC_POL;
+

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c line 88

Quoted 10 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c new file +10 -0
+     if (pvi->next_bridge->timings)
+             bus_flags = pvi->next_bridge->timings->input_bus_flags;
+     else if (bridge_state)
+             bus_flags = bridge_state->input_bus_cfg.flags;
+
+     if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
+             val |= PVI_CTRL_OP_DE_POL | PVI_CTRL_INP_DE_POL;
+
+     writel(val, pvi->regs + HTX_PVI_CTRL);
+}

Apologies if this has already been reported or fixed, I searched lore and did not find anything. Clang warns (or errors with CONFIG_WERROR=y) for this function:

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:81:11: error: variable 'bus_flags' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
81 | else if (bridge_state)
| ^~~~~~~~~~~~
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:84:6: note: uninitialized use occurs here
84 | if (bus_flags & DRM_BUS_FLAG_DE_HIGH)
| ^~~~~~~~~
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:81:7: note: remove the 'if' if its condition is always true

     81 |         else if (bridge_state)
        |              ^~~~~~~~~~~~~~~~~
     82 |                 bus_flags = bridge_state->input_bus_cfg.flags;
  drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c:60:15: note: initialize the variable 'bus_flags' to silence this warning
     60 |         u32 bus_flags, val;
        |                      ^
        |                       = 0
Quoted 5 lines

1 error generated.

This seems legitimate. If bridge_state can be NULL, should bus_flags be initialized to zero like it suggests or should that 'else if' be turned into a plain 'else'? I am happy to send a patch with that guidance.

I don't think we can turn the else-if into a blind else, because in order to make bus_flags point to bridge_state->input_bus_cfg.flags, bridge_state must not be NULL, but we could add an additional else to set bus_flags to 0, but I think the simplest thing to do would be to set bus_flags = 0 at the initialization on line 60 as it suggests.

Quoted 6 lines

If you agree, I can submit a patch later tonight. I need to fix another issue found by the build-bot [1] to make line 113 return NULL instead of 0 anyway. I figured I could just fix them both at the same time.

[1] - https://lore.kernel.org/oe-kbuild-all/[email protected]/

Seems reasonable to me, thanks!

Nathan

Tested-by on the v8 series
#54 lore raw
In reply to Adam Ford
Quoted 10 lines

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

Quoted 5 lines

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently, I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different

times and had different amount of retries. In an effort to merge them

Quoted 1 line

I used the highest version attempt.

Tested on Toradex Verdin-iMX8MP.

Thanks!

Regards,
Joao Paulo Goncalves

#29 lore raw

Re: [PATCH V8 09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

In reply to Adam Ford

Hi all,

Am Samstag, 3. Februar 2024, 17:52:49 CET schrieb Adam Ford:

Quoted 72 lines

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

---
V3: Change name and location to better idenfity as a bridge and
HDMI 2.0a transmitter

Fix typos and feedback from Rob and added ports.

---
 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file mode 100644
index 000000000000..3791c9f4ebab
--- /dev/null
+++
b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +44 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/fsl,imx8mp-hdmi-tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP DWC HDMI TX Encoder
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+description:
+  The i.MX8MP HDMI transmitter is a Synopsys DesignWare
+  HDMI 2.0a TX controller IP.
+
+allOf:
+  - $ref: /schemas/display/bridge/synopsys,dw-hdmi.yaml#
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8mp-hdmi-tx
+
+  reg-io-width:
+    const: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: iahb
+      - const: isfr
+      - const: cec
+      - const: pix
+
+  power-domains:
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 54

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +10 -0
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Parallel RGB input port
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: HDMI output port
+
+    required:
+      - port@0
+      - port@1

Is this really correct that port@1 is required? AFAICS this host already supports HPD and DDC by itself, so there is no need for a dedicated HDMI connector.
With the current state of the drivers this output port is completely ignored anyway. Yet it works for a lot of people.

Best regards,
Alexander

Quoted 48 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +48 -0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - power-domains
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    hdmi@32fd8000 {
+        compatible = "fsl,imx8mp-hdmi-tx";
+        reg = <0x32fd8000 0x7eff>;
+        interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+                 <&clk IMX8MP_CLK_32K>,
+                 <&hdmi_tx_phy>;
+        clock-names = "iahb", "isfr", "cec", "pix";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+        reg-io-width = <1>;
+        ports {
+           #address-cells = <1>;
+           #size-cells = <0>;
+           port@0 {
+             reg = <0>;
+
+             hdmi_tx_from_pvi: endpoint {
+               remote-endpoint = <&pvi_to_hdmi_tx>;
+             };
+          };
+
+          port@1 {
+            reg = <1>;
+              hdmi_tx_out: endpoint {
+                remote-endpoint = <&hdmi0_con>;
+              };
+          };
+        };
+    };
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
#30 lore raw

Re: [PATCH V8 09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

Quoted 81 lines · Alexander Stein

Hi all,

Am Samstag, 3. Februar 2024, 17:52:49 CET schrieb Adam Ford:

Quoted 78 lines

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

---
V3: Change name and location to better idenfity as a bridge and
HDMI 2.0a transmitter

Fix typos and feedback from Rob and added ports.

---
 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file mode 100644
index 000000000000..3791c9f4ebab
--- /dev/null
+++
b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +50 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/fsl,imx8mp-hdmi-tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP DWC HDMI TX Encoder
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+description:
+  The i.MX8MP HDMI transmitter is a Synopsys DesignWare
+  HDMI 2.0a TX controller IP.
+
+allOf:
+  - $ref: /schemas/display/bridge/synopsys,dw-hdmi.yaml#
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8mp-hdmi-tx
+
+  reg-io-width:
+    const: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: iahb
+      - const: isfr
+      - const: cec
+      - const: pix
+
+  power-domains:
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Parallel RGB input port
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: HDMI output port
Quoted 8 lines

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 54

Quoted 4 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +4 -0
+
+    required:
+      - port@0
+      - port@1

Is this really correct that port@1 is required? AFAICS this host already supports HPD and DDC by itself, so there is no need for a dedicated HDMI connector.

The chip has an HDMI output, so there's an output port.

Quoted 2 lines

With the current state of the drivers this output port is completely ignored anyway. Yet it works for a lot of people.

DT bindings describe the hardware. From a DT point of view, tt's fine for drivers to ignore the port (that may or may not be true from a DRM point of view, but that's a separate discussion).

Quoted 48 lines
Quoted 48 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +48 -0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - power-domains
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    hdmi@32fd8000 {
+        compatible = "fsl,imx8mp-hdmi-tx";
+        reg = <0x32fd8000 0x7eff>;
+        interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+                 <&clk IMX8MP_CLK_32K>,
+                 <&hdmi_tx_phy>;
+        clock-names = "iahb", "isfr", "cec", "pix";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+        reg-io-width = <1>;
+        ports {
+           #address-cells = <1>;
+           #size-cells = <0>;
+           port@0 {
+             reg = <0>;
+
+             hdmi_tx_from_pvi: endpoint {
+               remote-endpoint = <&pvi_to_hdmi_tx>;
+             };
+          };
+
+          port@1 {
+            reg = <1>;
+              hdmi_tx_out: endpoint {
+                remote-endpoint = <&hdmi0_con>;
+              };
+          };
+        };
+    };
Signature · 3 lines
Regards,

Laurent Pinchart
author
#31 lore raw

Re: [PATCH V8 09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

In reply to Alexander Stein
Quoted 84 lines · Alexander Stein

Hi all,

Am Samstag, 3. Februar 2024, 17:52:49 CET schrieb Adam Ford:

Quoted 80 lines

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

---
V3: Change name and location to better idenfity as a bridge and
HDMI 2.0a transmitter

Fix typos and feedback from Rob and added ports.

---
 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file mode 100644
index 000000000000..3791c9f4ebab
--- /dev/null
+++
b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +52 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/fsl,imx8mp-hdmi-tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX8MP DWC HDMI TX Encoder
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+description:
+  The i.MX8MP HDMI transmitter is a Synopsys DesignWare
+  HDMI 2.0a TX controller IP.
+
+allOf:
+  - $ref: /schemas/display/bridge/synopsys,dw-hdmi.yaml#
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8mp-hdmi-tx
+
+  reg-io-width:
+    const: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: iahb
+      - const: isfr
+      - const: cec
+      - const: pix
+
+  power-domains:
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Parallel RGB input port
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: HDMI output port
+
+    required:
Quoted 8 lines

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 54

Quoted 2 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +2 -0
+      - port@0
+      - port@1

Is this really correct that port@1 is required? AFAICS this host already supports HPD and DDC by itself, so there is no need for a dedicated HDMI connector.
With the current state of the drivers this output port is completely ignored anyway. Yet it works for a lot of people.

One of the feedback responses Lucas got was that it was missing the reference to the HDMI connector, so I added it as a response to that feedback. I have tried device trees with and without it, and it doesn't impact anything, but It seems like there may be a requirement for it.

adam

Quoted 61 lines

Best regards,
Alexander

Quoted 38 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +38 -0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - power-domains
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    hdmi@32fd8000 {
+        compatible = "fsl,imx8mp-hdmi-tx";
+        reg = <0x32fd8000 0x7eff>;
+        interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+                 <&clk IMX8MP_CLK_32K>,
+                 <&hdmi_tx_phy>;
+        clock-names = "iahb", "isfr", "cec", "pix";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+        reg-io-width = <1>;
+        ports {
+           #address-cells = <1>;
+           #size-cells = <0>;
+           port@0 {
+             reg = <0>;
+
+             hdmi_tx_from_pvi: endpoint {
+               remote-endpoint = <&pvi_to_hdmi_tx>;
+             };

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 102

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +10 -0
+          };
+
+          port@1 {
+            reg = <1>;
+              hdmi_tx_out: endpoint {
+                remote-endpoint = <&hdmi0_con>;
+              };
+          };
+        };
+    };

--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/

#32 lore raw

Re: [PATCH V8 09/12] dt-bindings: display: imx: add binding for i.MX8MP HDMI TX

Am Freitag, 16. Februar 2024, 12:31:12 CET schrieb Adam Ford:

Quoted 103 lines

On Fri, Feb 16, 2024 at 3:05 AM Alexander Stein

Quoted 91 lines · <[email protected]> wrote:

Hi all,

Am Samstag, 3. Februar 2024, 17:52:49 CET schrieb Adam Ford:

Quoted 88 lines

From: Lucas Stach <[email protected]>

The HDMI TX controller on the i.MX8MP SoC is a Synopsys designware IP core with a little bit of SoC integration around it.

---
V3: Change name and location to better idenfity as a bridge and

HDMI 2.0a transmitter

Fix typos and feedback from Rob and added ports.

---

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.ya ml b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.ya ml
new file mode 100644
index 000000000000..3791c9f4ebab
--- /dev/null
+++
b/Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.ya ml

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +4 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:

http://devicetree.org/schemas/display/bridge/fsl,imx8mp-hdmi-tx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +47 -0
+
+title: Freescale i.MX8MP DWC HDMI TX Encoder
+
+maintainers:
+  - Lucas Stach <[email protected]>
+
+description:
+  The i.MX8MP HDMI transmitter is a Synopsys DesignWare
+  HDMI 2.0a TX controller IP.
+
+allOf:
+  - $ref: /schemas/display/bridge/synopsys,dw-hdmi.yaml#
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8mp-hdmi-tx
+
+  reg-io-width:
+    const: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: iahb
+      - const: isfr
+      - const: cec
+      - const: pix
+
+  power-domains:
+    maxItems: 1
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Parallel RGB input port
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: HDMI output port
+
+    required:
Quoted 8 lines

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 54

Quoted 2 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +2 -0
+      - port@0
+      - port@1

Is this really correct that port@1 is required? AFAICS this host already supports HPD and DDC by itself, so there is no need for a dedicated HDMI connector.
With the current state of the drivers this output port is completely ignored anyway. Yet it works for a lot of people.

Quoted 5 lines

One of the feedback responses Lucas got was that it was missing the reference to the HDMI connector, so I added it as a response to that feedback. I have tried device trees with and without it, and it doesn't impact anything, but It seems like there may be a requirement for it.

Yes, I noticed as well. A specified connector is completely ignored. One reason is that dw_hdmi_plat_data.output_port is unsed in drivers/gpu/drm/ bridge/imx/imx8mp-hdmi-tx.c. Another one is that without DRM_BRIDGE_ATTACH_NO_CONNECTOR support in drivers/gpu/drm/mxsfb/lcdif_drv.c nothing changes.

Best regards,
Alexander

Quoted 59 lines

adam

Quoted 57 lines

Best regards,
Alexander

Quoted 38 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +38 -0
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - power-domains
+  - ports
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/power/imx8mp-power.h>
+
+    hdmi@32fd8000 {
+        compatible = "fsl,imx8mp-hdmi-tx";
+        reg = <0x32fd8000 0x7eff>;
+        interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
+        clocks = <&clk IMX8MP_CLK_HDMI_APB>,
+                 <&clk IMX8MP_CLK_HDMI_REF_266M>,
+                 <&clk IMX8MP_CLK_32K>,
+                 <&hdmi_tx_phy>;
+        clock-names = "iahb", "isfr", "cec", "pix";
+        power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>;
+        reg-io-width = <1>;
+        ports {
+           #address-cells = <1>;
+           #size-cells = <0>;
+           port@0 {
+             reg = <0>;
+
+             hdmi_tx_from_pvi: endpoint {
+               remote-endpoint = <&pvi_to_hdmi_tx>;
+             };

Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml line 102

Quoted 10 lines
Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml new file +10 -0
+          };
+
+          port@1 {
+            reg = <1>;
+              hdmi_tx_out: endpoint {
+                remote-endpoint = <&hdmi0_con>;
+              };
+          };
+        };
+    };

--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/

Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
Tested-by on the v8 series
#55 lore raw
In reply to Adam Ford

Hi Adam, Lucas,
Thanks for this series.

This series make HDMI work on evk.
All is working properly on my side.

Tested on: Linux imx8mp-lpddr4-evk 6.9.0-rc1.
Hope this help.

Thanks & Regards,
Tommaso

Quoted 62 lines · Adam Ford

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently,
I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different times and had different amount of retries. In an effort to merge them I used the highest version attempt.

Adam Ford (3):
dt-bindings: soc: imx: add missing clock and power-domains to
imx8mp-hdmi-blk-ctrl
pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix
domain
arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

Lucas Stach (9):
dt-bindings: phy: add binding for the i.MX8MP HDMI PHY
phy: freescale: add Samsung HDMI PHY
arm64: dts: imx8mp: add HDMI power-domains
arm64: dts: imx8mp: add HDMI irqsteer
dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI TX drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
arm64: dts: imx8mp: add HDMI display pipeline

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    |  102 ++
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      |   84 ++
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     |   62 +
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     |   22 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi     |  145 +++
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/bridge/imx/Kconfig            |   18 +
 drivers/gpu/drm/bridge/imx/Makefile           |    2 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c  |  207 ++++
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c   |  154 +++
 drivers/phy/freescale/Kconfig                 |    6 +
 drivers/phy/freescale/Makefile                |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c  | 1075 +++++++++++++++++
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c        |   10 +-
 14 files changed, 1876 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
Signature · 1 line
2.43.0
#56 lore raw

Hi Tommaso,

Quoted 10 lines · Tommaso Merciai

Hi Adam, Lucas,
Thanks for this series.

This series make HDMI work on evk.
All is working properly on my side.

Tested on: Linux imx8mp-lpddr4-evk 6.9.0-rc1.
Hope this help.

The DRM side has been merged already. The only missing patches are for the PHY, and the latest version can be found in
https://lore.kernel.org/linux-phy/[email protected]/.
You can test that series and send a Tested-by tag. I'm crossing my fingers and hoping it will be merged in v6.10.

Quoted 58 lines · Adam Ford
Quoted 57 lines

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently,
I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different times and had different amount of retries. In an effort to merge them I used the highest version attempt.

Adam Ford (3):
dt-bindings: soc: imx: add missing clock and power-domains to
imx8mp-hdmi-blk-ctrl
pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix
domain
arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

Lucas Stach (9):
dt-bindings: phy: add binding for the i.MX8MP HDMI PHY
phy: freescale: add Samsung HDMI PHY
arm64: dts: imx8mp: add HDMI power-domains
arm64: dts: imx8mp: add HDMI irqsteer
dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI TX drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
arm64: dts: imx8mp: add HDMI display pipeline

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    |  102 ++
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      |   84 ++
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     |   62 +
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     |   22 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi     |  145 +++
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/bridge/imx/Kconfig            |   18 +
 drivers/gpu/drm/bridge/imx/Makefile           |    2 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c  |  207 ++++
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c   |  154 +++
 drivers/phy/freescale/Kconfig                 |    6 +
 drivers/phy/freescale/Makefile                |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c  | 1075 +++++++++++++++++
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c        |   10 +-
 14 files changed, 1876 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
Signature · 3 lines
Regards,

Laurent Pinchart
#57 lore raw

Hi Laurent,

Quoted 12 lines · Laurent Pinchart

Hi Tommaso,

Quoted 9 lines · Tommaso Merciai

Hi Adam, Lucas,
Thanks for this series.

This series make HDMI work on evk.
All is working properly on my side.

Tested on: Linux imx8mp-lpddr4-evk 6.9.0-rc1.
Hope this help.

Quoted 7 lines
Quoted 1 line

The DRM side has been merged already. The only missing patches are for the PHY, and the latest version can be found in
https://lore.kernel.org/linux-phy/[email protected]/.
You can test that series and send a Tested-by tag. I'm crossing my fingers and hoping it will be merged in v6.10.

(same here :) )

Thanks for sharing! :)

To be honest I test all this series rebasing my alvium next branch on top of media_stage/master (6.9.0-rc1) All is working properly on my side.
I found v8 into the commit msg here: https://patches.linaro.org/project/linux-pm/patch/[email protected]/
then I'm thinking this is the latest.

I'm going to switch to your suggestion that looks more recent :)

Thanks again,
Tommaso

Quoted 64 lines
Quoted 59 lines · Adam Ford
Quoted 57 lines

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently,
I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different times and had different amount of retries. In an effort to merge them I used the highest version attempt.

Adam Ford (3):
dt-bindings: soc: imx: add missing clock and power-domains to
imx8mp-hdmi-blk-ctrl
pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix
domain
arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

Lucas Stach (9):
dt-bindings: phy: add binding for the i.MX8MP HDMI PHY
phy: freescale: add Samsung HDMI PHY
arm64: dts: imx8mp: add HDMI power-domains
arm64: dts: imx8mp: add HDMI irqsteer
dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI TX drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
arm64: dts: imx8mp: add HDMI display pipeline

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    |  102 ++
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      |   84 ++
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     |   62 +
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     |   22 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi     |  145 +++
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/bridge/imx/Kconfig            |   18 +
 drivers/gpu/drm/bridge/imx/Makefile           |    2 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c  |  207 ++++
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c   |  154 +++
 drivers/phy/freescale/Kconfig                 |    6 +
 drivers/phy/freescale/Makefile                |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c  | 1075 +++++++++++++++++
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c        |   10 +-
 14 files changed, 1876 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c
Signature · 3 lines
Regards,

Laurent Pinchart
author
#58 lore raw
Quoted 25 lines · Tommaso Merciai

Hi Laurent,

Quoted 12 lines · Laurent Pinchart

Hi Tommaso,

Quoted 9 lines · Tommaso Merciai

Hi Adam, Lucas,
Thanks for this series.

This series make HDMI work on evk.
All is working properly on my side.

Tested on: Linux imx8mp-lpddr4-evk 6.9.0-rc1.
Hope this help.

Quoted 7 lines
Quoted 1 line

The DRM side has been merged already. The only missing patches are for the PHY, and the latest version can be found in
https://lore.kernel.org/linux-phy/[email protected]/.
You can test that series and send a Tested-by tag. I'm crossing my fingers and hoping it will be merged in v6.10.

(same here :) )

Quoted 8 lines

Thanks for sharing! :)

To be honest I test all this series rebasing my alvium next branch on top of media_stage/master (6.9.0-rc1) All is working properly on my side.
I found v8 into the commit msg here: https://patches.linaro.org/project/linux-pm/patch/[email protected]/
then I'm thinking this is the latest.

I'm going to switch to your suggestion that looks more recent :)

Sorry about the confusion. I was confused by the versioning too when I pulled from different parts of Lucas' stuff. Since varying components were applied at different times, and the remaining part was based on the wrong starting point and not applied, I reverted back to the versioning of the PHY which was the only remaining part other than device tree stuff.

adam

Quoted 68 lines

Thanks again,
Tommaso

Quoted 64 lines
Quoted 51 lines · Adam Ford
Quoted 49 lines

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently,
I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different times and had different amount of retries. In an effort to merge them I used the highest version attempt.

Adam Ford (3):
dt-bindings: soc: imx: add missing clock and power-domains to
imx8mp-hdmi-blk-ctrl
pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix
domain
arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

Lucas Stach (9):
dt-bindings: phy: add binding for the i.MX8MP HDMI PHY
phy: freescale: add Samsung HDMI PHY
arm64: dts: imx8mp: add HDMI power-domains
arm64: dts: imx8mp: add HDMI irqsteer
dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI TX drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
arm64: dts: imx8mp: add HDMI display pipeline

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    |  102 ++
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      |   84 ++
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     |   62 +
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     |   22 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi     |  145 +++
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/bridge/imx/Kconfig            |   18 +
 drivers/gpu/drm/bridge/imx/Makefile           |    2 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c  |  207 ++++
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c   |  154 +++
 drivers/phy/freescale/Kconfig                 |    6 +
 drivers/phy/freescale/Makefile                |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c  | 1075 +++++++++++++++++
Quoted 8 lines
Quoted 8 lines
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c        |   10 +-
 14 files changed, 1876 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c

--
Regards,

Laurent Pinchart

#59 lore raw

Hi Adam,

Quoted 33 lines · Adam Ford
Quoted 32 lines · Tommaso Merciai

Hi Laurent,

Quoted 12 lines · Laurent Pinchart

Hi Tommaso,

Quoted 9 lines · Tommaso Merciai

Hi Adam, Lucas,
Thanks for this series.

This series make HDMI work on evk.
All is working properly on my side.

Tested on: Linux imx8mp-lpddr4-evk 6.9.0-rc1.
Hope this help.

Quoted 7 lines
Quoted 1 line

The DRM side has been merged already. The only missing patches are for the PHY, and the latest version can be found in
https://lore.kernel.org/linux-phy/[email protected]/.
You can test that series and send a Tested-by tag. I'm crossing my fingers and hoping it will be merged in v6.10.

(same here :) )

Thanks for sharing! :)

To be honest I test all this series rebasing my alvium next branch on top of media_stage/master (6.9.0-rc1) All is working properly on my side.
I found v8 into the commit msg here: https://patches.linaro.org/project/linux-pm/patch/[email protected]/
then I'm thinking this is the latest.

Quoted 8 lines
Quoted 1 line

I'm going to switch to your suggestion that looks more recent :)

Sorry about the confusion. I was confused by the versioning too when I pulled from different parts of Lucas' stuff. Since varying components were applied at different times, and the remaining part was based on the wrong starting point and not applied, I reverted back to the versioning of the PHY which was the only remaining part other than device tree stuff.

No problem, thanks for clarify :)

Thanks & Regards,
Tommaso

Quoted 70 lines

adam

Quoted 68 lines

Thanks again,
Tommaso

Quoted 64 lines
Quoted 51 lines · Adam Ford
Quoted 49 lines

The i.MX8M Plus has an HDMI controller, but it depends on two other systems, the Parallel Video Interface (PVI) and the HDMI PHY from Samsung. The LCDIF controller generates the display and routes it to the PVI which converts passes the parallel video to the HDMI bridge. The HDMI system has a corresponding power domain controller whose driver was partially written, but the device tree for it was never applied, so some changes to the power domain should be harmless because they've not really been used yet.

This series is adapted from multiple series from Lucas Stach with edits and suggestions from feedback from various series, but it since it's difficult to use and test them independently,
I merged them into on unified series. The version history is a bit ambiguous since different components were submitted at different times and had different amount of retries. In an effort to merge them I used the highest version attempt.

Adam Ford (3):
dt-bindings: soc: imx: add missing clock and power-domains to
imx8mp-hdmi-blk-ctrl
pmdomain: imx8mp-blk-ctrl: imx8mp_blk: Add fdcc clock to hdmimix
domain
arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module

Lucas Stach (9):
dt-bindings: phy: add binding for the i.MX8MP HDMI PHY
phy: freescale: add Samsung HDMI PHY
arm64: dts: imx8mp: add HDMI power-domains
arm64: dts: imx8mp: add HDMI irqsteer
dt-bindings: display: imx: add binding for i.MX8MP HDMI PVI drm/bridge: imx: add driver for HDMI TX Parallel Video Interface
dt-bindings: display: imx: add binding for i.MX8MP HDMI TX drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI
arm64: dts: imx8mp: add HDMI display pipeline

 .../display/bridge/fsl,imx8mp-hdmi-tx.yaml    |  102 ++
 .../display/imx/fsl,imx8mp-hdmi-pvi.yaml      |   84 ++
 .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml     |   62 +
 .../soc/imx/fsl,imx8mp-hdmi-blk-ctrl.yaml     |   22 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi     |  145 +++
 arch/arm64/configs/defconfig                  |    1 +
 drivers/gpu/drm/bridge/imx/Kconfig            |   18 +
 drivers/gpu/drm/bridge/imx/Makefile           |    2 +
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c  |  207 ++++
 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c   |  154 +++
 drivers/phy/freescale/Kconfig                 |    6 +
 drivers/phy/freescale/Makefile                |    1 +
 drivers/phy/freescale/phy-fsl-samsung-hdmi.c  | 1075 +++++++++++++++++
Quoted 8 lines
Quoted 8 lines
 drivers/pmdomain/imx/imx8mp-blk-ctrl.c        |   10 +-
 14 files changed, 1876 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx8mp-hdmi-tx.yaml
 create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx8mp-hdmi-pvi.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c
 create mode 100644 drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c
 create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c

--
Regards,

Laurent Pinchart

#35 lore raw

drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

In reply to Adam Ford

Adam Ford wrote on Sat, Feb 03, 2024 at 10:52:50AM -0600:

Quoted 5 lines

From: Lucas Stach <[email protected]>

Add a simple wrapper driver for the DWC HDMI bridge driver that implements the few bits that are necessary to abstract the i.MX8MP SoC integration.

Hi Lucas, Adam,
(trimmed ccs a bit)

First, thank you for the effort of upstreaming all of this!! It's really appreciated, and with display working I'll really be wanting to upstream our DTS as well as soon as I have time (which is going to be a while, but better late than never ?)

Until then, it's been a few months but I've got a question on this bit:

Quoted 11 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +6 -0
new file mode 100644
index 000000000000..89fc432ac611
+static enum drm_mode_status
+imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
+		       const struct drm_display_info *info,
+		       const struct drm_display_mode *mode)
+{
+	struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c line 35

Quoted 10 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +10 -0
+
+	if (mode->clock < 13500)
+		return MODE_CLOCK_LOW;
+
+	if (mode->clock > 297000)
+		return MODE_CLOCK_HIGH;
+
+	if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
+	    mode->clock * 1000)
+		return MODE_CLOCK_RANGE;

Do you know why such a check is here?

When plugging in a screen with no frequency identically supported in its EDID this check causes the screen to stay black, and we've been telling customers to override the EDID but it's a huge pain.

Commit 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY") already "fixed" the samsung hdmi phy driver to return the next frequency if an exact match hasn't been found (NXP tree's match frequencies exactly, but this gets the first clock with pixclk <= rate), so if this check is also relaxed our displays would work out of the box.

I also don't see any other bridge doing this kind of check. drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c has a similar check with a 0.5% leeway, and all the other drivers don't check anything. If you want to add some level of safety, I think we could make this work with a 5% margin easily... Printing a warning in dmesg could work if you're worried about artifacts, but litteraly anything is better than a black screen with no error message in my opinion.

In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box.

For reference, the output of edid-decode is as follow:
---
edid-decode /sys/devices/platform/display-subsystem/drm/car d1/card1-HDMI-A-1/edid
edid-decode (hex):

00 ff ff ff ff ff ff 00 3a 49 03 00 01 00 00 00
20 1e 01 03 80 10 09 00 0a 00 00 00 00 00 00 00
00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 00 14 00 40 41 58 23 20 a0 20
c8 00 9a 56 00 00 00 18 00 00 00 10 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9a

----------------

Block 0, Base EDID:
EDID Structure Version & Revision: 1.3
Vendor & Product Identification:
Manufacturer: NRI
Model: 3
Serial Number: 1
Made in: week 32 of 2020
Basic Display Parameters & Features:
Digital display
Maximum image size: 16 cm x 9 cm
Gamma: 1.00
RGB color display
First detailed timing is the preferred timing
Color Characteristics:

    Red  : 0.0000, 0.0000
    Green: 0.0000, 0.0000
    Blue : 0.0000, 0.0000
    White: 0.0000, 0.0000
  Established Timings I & II: none
  Standard Timings: none
  Detailed Timing Descriptors:
    DTD 1:  1024x600    59.993 Hz 128:75   38.095 kHz  51.200 MHz (154 mm x 86 m

m)
Hfront 160 Hsync 32 Hback 128 Hpol N
Vfront 12 Vsync 8 Vback 15 Vpol N
Dummy Descriptor:
Dummy Descriptor:
Dummy Descriptor:
Checksum: 0x9a
---

Thanks,

Signature · 8 lines
Dominique Martinet



-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
author
#36 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Quoted 33 lines · Dominique MARTINET

Adam Ford wrote on Sat, Feb 03, 2024 at 10:52:50AM -0600:

Quoted 5 lines

From: Lucas Stach <[email protected]>

Add a simple wrapper driver for the DWC HDMI bridge driver that implements the few bits that are necessary to abstract the i.MX8MP SoC integration.

Hi Lucas, Adam,
(trimmed ccs a bit)

First, thank you for the effort of upstreaming all of this!! It's really appreciated, and with display working I'll really be wanting to upstream our DTS as well as soon as I have time (which is going to be a while, but better late than never ?)

Until then, it's been a few months but I've got a question on this bit:

Quoted 15 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +10 -0
new file mode 100644
index 000000000000..89fc432ac611
+static enum drm_mode_status
+imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
+                    const struct drm_display_info *info,
+                    const struct drm_display_mode *mode)
+{
+     struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;
+
+     if (mode->clock < 13500)
+             return MODE_CLOCK_LOW;
+
Quoted 8 lines

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c line 35

Quoted 6 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +6 -0
+     if (mode->clock > 297000)
+             return MODE_CLOCK_HIGH;
+
+     if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
+         mode->clock * 1000)
+             return MODE_CLOCK_RANGE;

Do you know why such a check is here?

I didn't write the original code, so I'll defer to Lucas here. I just tried to edit/fix issues as they were identified to get it pushed upstream.

Quoted 10 lines

When plugging in a screen with no frequency identically supported in its EDID this check causes the screen to stay black, and we've been telling customers to override the EDID but it's a huge pain.

Commit 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY") already "fixed" the samsung hdmi phy driver to return the next frequency if an exact match hasn't been found (NXP tree's match frequencies exactly, but this gets the first clock with pixclk <= rate), so if this check is also relaxed our displays would work out of the box.

Are you proposing to replace 'return MODE_CLOCK_RANGE' with a printed warning?

Quoted 10 lines

I also don't see any other bridge doing this kind of check. drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c has a similar check with a 0.5% leeway, and all the other drivers don't check anything. If you want to add some level of safety, I think we could make this work with a 5% margin easily... Printing a warning in dmesg could work if you're worried about artifacts, but litteraly anything is better than a black screen with no error message in my opinion.

Quoted 4 lines

In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box.

I wonder if the HDMI PHY could be improved to better dynamically calculate values instead of the look tables.

adam

Quoted 60 lines

For reference, the output of edid-decode is as follow:
---
edid-decode /sys/devices/platform/display-subsystem/drm/car d1/card1-HDMI-A-1/edid
edid-decode (hex):

00 ff ff ff ff ff ff 00 3a 49 03 00 01 00 00 00
20 1e 01 03 80 10 09 00 0a 00 00 00 00 00 00 00
00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 00 14 00 40 41 58 23 20 a0 20
c8 00 9a 56 00 00 00 18 00 00 00 10 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9a

----------------

Block 0, Base EDID:
EDID Structure Version & Revision: 1.3
Vendor & Product Identification:
Manufacturer: NRI
Model: 3
Serial Number: 1
Made in: week 32 of 2020
Basic Display Parameters & Features:
Digital display
Maximum image size: 16 cm x 9 cm
Gamma: 1.00
RGB color display
First detailed timing is the preferred timing
Color Characteristics:

    Red  : 0.0000, 0.0000
    Green: 0.0000, 0.0000
    Blue : 0.0000, 0.0000
    White: 0.0000, 0.0000
  Established Timings I & II: none
  Standard Timings: none
  Detailed Timing Descriptors:
    DTD 1:  1024x600    59.993 Hz 128:75   38.095 kHz  51.200 MHz (154 mm x 86 m

m)
Hfront 160 Hsync 32 Hback 128 Hpol N
Vfront 12 Vsync 8 Vback 15 Vpol N
Dummy Descriptor:
Dummy Descriptor:
Dummy Descriptor:
Checksum: 0x9a
---

Thanks,
--
Dominique Martinet

--
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy

#37 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

In reply to Dominique MARTINET

Hi Dominique,

Am Montag, dem 17.06.2024 um 15:16 +0900 schrieb Dominique MARTINET:

Quoted 32 lines

Adam Ford wrote on Sat, Feb 03, 2024 at 10:52:50AM -0600:

Quoted 5 lines

From: Lucas Stach <[email protected]>

Add a simple wrapper driver for the DWC HDMI bridge driver that implements the few bits that are necessary to abstract the i.MX8MP SoC integration.

Hi Lucas, Adam,
(trimmed ccs a bit)

First, thank you for the effort of upstreaming all of this!! It's really appreciated, and with display working I'll really be wanting to upstream our DTS as well as soon as I have time (which is going to be a while, but better late than never ?)

Until then, it's been a few months but I've got a question on this bit:

Quoted 15 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +10 -0
new file mode 100644
index 000000000000..89fc432ac611
+static enum drm_mode_status
+imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
+		       const struct drm_display_info *info,
+		       const struct drm_display_mode *mode)
+{
+	struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;
+
+	if (mode->clock < 13500)
+		return MODE_CLOCK_LOW;
+
Quoted 8 lines

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c line 35

Quoted 6 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +6 -0
+	if (mode->clock > 297000)
+		return MODE_CLOCK_HIGH;
+
+	if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
+	    mode->clock * 1000)
+		return MODE_CLOCK_RANGE;

Do you know why such a check is here?

Sending a HDMI signal with a different rate than what the display expects rarely ends well, so this check avoids that.

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

Quoted 20 lines

When plugging in a screen with no frequency identically supported in its EDID this check causes the screen to stay black, and we've been telling customers to override the EDID but it's a huge pain.

Commit 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY") already "fixed" the samsung hdmi phy driver to return the next frequency if an exact match hasn't been found (NXP tree's match frequencies exactly, but this gets the first clock with pixclk <= rate), so if this check is also relaxed our displays would work out of the box.

I also don't see any other bridge doing this kind of check. drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c has a similar check with a 0.5% leeway, and all the other drivers don't check anything. If you want to add some level of safety, I think we could make this work with a 5% margin easily... Printing a warning in dmesg could work if you're worried about artifacts, but litteraly anything is better than a black screen with no error message in my opinion.

Quoted 4 lines

In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box.

For rate mismatches larger than the 0.5% allowed by the HDMI spec it would be better to actually add PHY PLL parameters matching those rates.

We could potentially add some more leeway for displays like yours that aren't actually HDMI (as it doesn't seem to have a standard HDMI resolution). But that's more of a last resort option, as it may introduce other problems for displays that aren't as tolerant with their input rates. Remember the mode_valid call is used to filter modes that aren't compatible with the source, so for a display with multiple modes allowing too much leeway may lead to incompatible modes not getting tossed, in turn allowing userspace to set a mode that the display may not like due to too much rate deviation, instead of only presenting a list of valid modes. This again would present the user with a black-screen without warning situation.

Regards,
Lucas

Quoted 51 lines

For reference, the output of edid-decode is as follow:
---
edid-decode /sys/devices/platform/display-subsystem/drm/car d1/card1-HDMI-A-1/edid
edid-decode (hex):

00 ff ff ff ff ff ff 00 3a 49 03 00 01 00 00 00
20 1e 01 03 80 10 09 00 0a 00 00 00 00 00 00 00
00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 00 14 00 40 41 58 23 20 a0 20
c8 00 9a 56 00 00 00 18 00 00 00 10 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9a

----------------

Block 0, Base EDID:
EDID Structure Version & Revision: 1.3
Vendor & Product Identification:
Manufacturer: NRI
Model: 3
Serial Number: 1
Made in: week 32 of 2020
Basic Display Parameters & Features:
Digital display
Maximum image size: 16 cm x 9 cm
Gamma: 1.00
RGB color display
First detailed timing is the preferred timing
Color Characteristics:

    Red  : 0.0000, 0.0000
    Green: 0.0000, 0.0000
    Blue : 0.0000, 0.0000
    White: 0.0000, 0.0000
  Established Timings I & II: none
  Standard Timings: none
  Detailed Timing Descriptors:
    DTD 1:  1024x600    59.993 Hz 128:75   38.095 kHz  51.200 MHz (154 mm x 86 m

m)
Hfront 160 Hsync 32 Hback 128 Hpol N
Vfront 12 Vsync 8 Vback 15 Vpol N
Dummy Descriptor:
Dummy Descriptor:
Dummy Descriptor:
Checksum: 0x9a
---

Thanks,

#38 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Thanks for the replies, replying to both mails at once.

Adam Ford wrote on Mon, Jun 17, 2024 at 08:28:58AM -0500:

Quoted 7 lines
Quoted 5 lines

Commit 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY") already "fixed" the samsung hdmi phy driver to return the next frequency if an exact match hasn't been found (NXP tree's match frequencies exactly, but this gets the first clock with pixclk <= rate), so if this check is also relaxed our displays would work out of the box.

Are you proposing to replace 'return MODE_CLOCK_RANGE' with a printed warning?

Yes, something like that.

The imx93-mipi-dsi.c code has a check that's a bit more complex that might be closer to what we want if you think the check is useful:

        if ((bridge->ops & DRM_BRIDGE_OP_DETECT) &&
            (bridge->ops & DRM_BRIDGE_OP_EDID)) {
                unsigned long pixel_clock_rate = mode->clock * 1000;
                unsigned long rounded_rate;

                /* Allow +/-0.5% pixel clock rate deviation */
                rounded_rate = clk_round_rate(dsi->clk_pixel, pixel_clock_rate);
                if (rounded_rate < pixel_clock_rate * 995 / 1000 ||
                    rounded_rate > pixel_clock_rate * 1005 / 1000) {
                        dev_dbg(dsi->dev, "failed to round clock for mode " DRM_MODE_FMT "\n",
                                DRM_MODE_ARG(mode));
                        return MODE_NOCLOCK;
                }
        }

However, for my particular case 0.5% wouldn't be enough to get something to display unfortunately :/

Quoted 7 lines
Quoted 4 lines

In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box.

I wonder if the HDMI PHY could be improved to better dynamically calculate values instead of the look tables.

That would probably be ideal, right... If we could do that we could likely compute something within 0.5% of the required freq.

The original code from NXP was full of what seemed at the time magic values, but with the new code it seems quite a bit clearer... At least the values that are left seem to somewhat make sense:
https://gaia.codewreck.org/local/linux/hdmi/plot-combined.svg
https://gaia.codewreck.org/local/linux/hdmi/plot-1.svg
-> dented linear values, per the intervals defined in fsl_samsung_hdmi_phy_configure_pixclk()
https://gaia.codewreck.org/local/linux/hdmi/plot-2.svg
-> constant for each intervals?
https://gaia.codewreck.org/local/linux/hdmi/plot-3.svg
https://gaia.codewreck.org/local/linux/hdmi/plot-4.svg
these don't really make sense to me...
https://gaia.codewreck.org/local/linux/hdmi/plot-5.svg
that one 0 value at 154000000 looks odd,
but that aside we could probably get away with constant 0x80 if the value matters at all...
https://gaia.codewreck.org/local/linux/hdmi/plot-6.svg
weird as well

I'm thinking the last few values just affect a very small % of the values, but would need to check with a proper scope if I can get a hold of the clock line...
Does any of you happen to have any datasheet for these registers, or should we consider them to be magic values?

Lucas Stach wrote on Mon, Jun 17, 2024 at 06:32:45PM +0200:

Quoted 8 lines
Quoted 1 line

Do you know why such a check is here?

Sending a HDMI signal with a different rate than what the display expects rarely ends well, so this check avoids that.

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

I'd expect displays to be tolerant to quite a few percents, but I didn't know the spec defined something like that... iirc the HDMI spec isn't public?

Quoted 9 lines
Quoted 4 lines

In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box.

For rate mismatches larger than the 0.5% allowed by the HDMI spec it would be better to actually add PHY PLL parameters matching those rates.

Quoted 11 lines

We could potentially add some more leeway for displays like yours that aren't actually HDMI (as it doesn't seem to have a standard HDMI resolution). But that's more of a last resort option, as it may introduce other problems for displays that aren't as tolerant with their input rates. Remember the mode_valid call is used to filter modes that aren't compatible with the source, so for a display with multiple modes allowing too much leeway may lead to incompatible modes not getting tossed, in turn allowing userspace to set a mode that the display may not like due to too much rate deviation, instead of only presenting a list of valid modes. This again would present the user with a black-screen without warning situation.

Ah, that's a very good point, if other modes are valid then we don't want to present modes that are less likely to work, we should only allow bigger variations if no other mode worked...
I don't think we have this info at validation time though?

I think that Adam's suggestion of making this more dynamic would be great, if we can just generate finer frequencies for a reasonable range then it wouldn't be a problem to limit the check to 0.5%.

Short of something really dynamic I can add a value for our particular display based on what I've seen above (just pick a couple of points along the lines for the two values I understood and whatever value neighbors have for the rest & check with a scope it's somewhat close), but I honestly would rather not get too far down this hole, we can't cover all the quirky hardwares that exist manually...

Cheers,

Signature · 1 line
Dominique
#39 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Dominique MARTINET wrote on Tue, Jun 18, 2024 at 08:45:38AM +0900:

Quoted 5 lines

I'm thinking the last few values just affect a very small % of the values, but would need to check with a proper scope if I can get a hold of the clock line...
Does any of you happen to have any datasheet for these registers, or should we consider them to be magic values?

Answering to myself on this point, the registers are properly described in the iMX8MP reference manual...
I don't make much sense of it at this point (what's SDC..?), but I guess it does sound likely we could generate the values with some work.

I'll wait for replies a bit first in case one of you understands this better than I (which is quite likely!), but can give this a few more hours to help.

Signature · 1 line
Dominique
#40 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

In reply to Lucas Stach

Hi Dominique, hi Lucas,

Quoted 44 lines · Lucas Stach

Hi Dominique,

Am Montag, dem 17.06.2024 um 15:16 +0900 schrieb Dominique MARTINET:

Quoted 32 lines

Adam Ford wrote on Sat, Feb 03, 2024 at 10:52:50AM -0600:

Quoted 5 lines

From: Lucas Stach <[email protected]>

Add a simple wrapper driver for the DWC HDMI bridge driver that implements the few bits that are necessary to abstract the i.MX8MP SoC integration.

Hi Lucas, Adam,
(trimmed ccs a bit)

First, thank you for the effort of upstreaming all of this!! It's really appreciated, and with display working I'll really be wanting to upstream our DTS as well as soon as I have time (which is going to be a while, but better late than never ?)

Until then, it's been a few months but I've got a question on this bit:

Quoted 15 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +10 -0
new file mode 100644
index 000000000000..89fc432ac611
+static enum drm_mode_status
+imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
+		       const struct drm_display_info *info,
+		       const struct drm_display_mode *mode)
+{
+	struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;
+
+	if (mode->clock < 13500)
+		return MODE_CLOCK_LOW;
+
Quoted 8 lines

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c line 35

Quoted 6 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +6 -0
+	if (mode->clock > 297000)
+		return MODE_CLOCK_HIGH;
+
+	if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
+	    mode->clock * 1000)
+		return MODE_CLOCK_RANGE;

Do you know why such a check is here?

Quoted 6 lines

Sending a HDMI signal with a different rate than what the display expects rarely ends well, so this check avoids that.

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

I checked with a 1080p display that reports 23 possible modes via EDID. Out of these 15 are accepted by the driver with the strict check.

Two more would be accepted with a relaxed check that allows a 0.5% margin.

For the remaining six modes, the pixel clock would deviate up to ~5% from what the display expects. Still, if I remove the check altogether, all 23 modes seem to work just fine.

Quoted 20 lines
Quoted 20 lines

When plugging in a screen with no frequency identically supported in its EDID this check causes the screen to stay black, and we've been telling customers to override the EDID but it's a huge pain.

Commit 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY") already "fixed" the samsung hdmi phy driver to return the next frequency if an exact match hasn't been found (NXP tree's match frequencies exactly, but this gets the first clock with pixclk <= rate), so if this check is also relaxed our displays would work out of the box.

I also don't see any other bridge doing this kind of check. drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c has a similar check with a 0.5% leeway, and all the other drivers don't check anything. If you want to add some level of safety, I think we could make this work with a 5% margin easily... Printing a warning in dmesg could work if you're worried about artifacts, but litteraly anything is better than a black screen with no error message in my opinion.

Quoted 8 lines
Quoted 4 lines

In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box.

For rate mismatches larger than the 0.5% allowed by the HDMI spec it would be better to actually add PHY PLL parameters matching those rates.

I'd really like to be able to add more PHY PLL setpoints for displays that use non-CEA-861 modes. Unfortunately I didn't manage to figure out the fractional-n PLL parameter calculation so far.

The i.MX8MP Reference Manual provides formulas to calculate the parameters based on the register values and I tried to make sense of it using the existing register values in the driver. But somehow it doesn't add up for me.

Lucas, did you already work with the PLL parameters? By any chance, do you now how the math behind them works?

Quoted 12 lines

We could potentially add some more leeway for displays like yours that aren't actually HDMI (as it doesn't seem to have a standard HDMI resolution). But that's more of a last resort option, as it may introduce other problems for displays that aren't as tolerant with their input rates. Remember the mode_valid call is used to filter modes that aren't compatible with the source, so for a display with multiple modes allowing too much leeway may lead to incompatible modes not getting tossed, in turn allowing userspace to set a mode that the display may not like due to too much rate deviation, instead of only presenting a list of valid modes. This again would present the user with a black-screen without warning situation.

What about adding some option to relax or remove the check for debugging purposes? Maybe combined with printing a warning message?

I agree that we should prevent incompatible modes from passing the filter, but it would be really helpful if people had an easy way to relax/remove the check to see whether their display could potentially work without them needing to modify and recompile the kernel.

Thanks
Frieder

author
#41 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Quoted 97 lines · Frieder Schrempf

Hi Dominique, hi Lucas,

Quoted 44 lines · Lucas Stach

Hi Dominique,

Am Montag, dem 17.06.2024 um 15:16 +0900 schrieb Dominique MARTINET:

Quoted 32 lines

Adam Ford wrote on Sat, Feb 03, 2024 at 10:52:50AM -0600:

Quoted 5 lines

From: Lucas Stach <[email protected]>

Add a simple wrapper driver for the DWC HDMI bridge driver that implements the few bits that are necessary to abstract the i.MX8MP SoC integration.

Hi Lucas, Adam,
(trimmed ccs a bit)

First, thank you for the effort of upstreaming all of this!! It's really appreciated, and with display working I'll really be wanting to upstream our DTS as well as soon as I have time (which is going to be a while, but better late than never ?)

Until then, it's been a few months but I've got a question on this bit:

Quoted 15 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +10 -0
new file mode 100644
index 000000000000..89fc432ac611
+static enum drm_mode_status
+imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data,
+                  const struct drm_display_info *info,
+                  const struct drm_display_mode *mode)
+{
+   struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data;
+
+   if (mode->clock < 13500)
+           return MODE_CLOCK_LOW;
+
Quoted 8 lines

drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c line 35

Quoted 6 lines
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c new file +6 -0
+   if (mode->clock > 297000)
+           return MODE_CLOCK_HIGH;
+
+   if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) !=
+       mode->clock * 1000)
+           return MODE_CLOCK_RANGE;

Do you know why such a check is here?

Quoted 6 lines

Sending a HDMI signal with a different rate than what the display expects rarely ends well, so this check avoids that.

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

I checked with a 1080p display that reports 23 possible modes via EDID. Out of these 15 are accepted by the driver with the strict check.

Two more would be accepted with a relaxed check that allows a 0.5% margin.

For the remaining six modes, the pixel clock would deviate up to ~5% from what the display expects. Still, if I remove the check altogether, all 23 modes seem to work just fine.

Quoted 20 lines
Quoted 20 lines

When plugging in a screen with no frequency identically supported in its EDID this check causes the screen to stay black, and we've been telling customers to override the EDID but it's a huge pain.

Commit 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY") already "fixed" the samsung hdmi phy driver to return the next frequency if an exact match hasn't been found (NXP tree's match frequencies exactly, but this gets the first clock with pixclk <= rate), so if this check is also relaxed our displays would work out of the box.

I also don't see any other bridge doing this kind of check. drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c has a similar check with a 0.5% leeway, and all the other drivers don't check anything. If you want to add some level of safety, I think we could make this work with a 5% margin easily... Printing a warning in dmesg could work if you're worried about artifacts, but litteraly anything is better than a black screen with no error message in my opinion.

Quoted 8 lines
Quoted 4 lines

In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box.

For rate mismatches larger than the 0.5% allowed by the HDMI spec it would be better to actually add PHY PLL parameters matching those rates.

I'd really like to be able to add more PHY PLL setpoints for displays that use non-CEA-861 modes. Unfortunately I didn't manage to figure out the fractional-n PLL parameter calculation so far.

Quoted 7 lines

The i.MX8MP Reference Manual provides formulas to calculate the parameters based on the register values and I tried to make sense of it using the existing register values in the driver. But somehow it doesn't add up for me.

Lucas, did you already work with the PLL parameters? By any chance, do you now how the math behind them works?

I spent a little time trying to understand it a bit. I created a PMS calculator similar to the one used on the DSI controller, except that the M seems to be fixed at a value of 62 per the data sheet, so it's more of a PS calculator.

Anyway, When I run my P-S calculator to generate the 'best rate' I get a value that's usually 0.2% variance from nominal, but I only verified a handful of values:

Several which were +0.2%
297600000 vs 297000000 (4k@30)
148800000 vs 148500000 (1080p60)
74400 vs 74200

One value was -0.16%
24800000 vs 25200000

If the M value was a bit more flexible, we might be able to reduce that variance more.

If / when I get some time, I might play with trying to disable the fractional mode and just use the PMS calculator for simplicity despite the inaccuracy. Maybe we could fall back to using the PMS calculator if the desired frequency isn't in the look-up-table.

adam

Quoted 24 lines
Quoted 13 lines

We could potentially add some more leeway for displays like yours that aren't actually HDMI (as it doesn't seem to have a standard HDMI resolution). But that's more of a last resort option, as it may introduce other problems for displays that aren't as tolerant with their input rates. Remember the mode_valid call is used to filter modes that aren't compatible with the source, so for a display with multiple modes allowing too much leeway may lead to incompatible modes not getting tossed, in turn allowing userspace to set a mode that the display may not like due to too much rate deviation, instead of only presenting a list of valid modes. This again would present the user with a black-screen without warning situation.

What about adding some option to relax or remove the check for debugging purposes? Maybe combined with printing a warning message?

I agree that we should prevent incompatible modes from passing the filter, but it would be really helpful if people had an easy way to relax/remove the check to see whether their display could potentially work without them needing to modify and recompile the kernel.

Thanks
Frieder

#42 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Adam Ford wrote on Tue, Aug 20, 2024 at 09:49:03PM -0500:

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

Quoted 8 lines
Quoted 8 lines

I checked with a 1080p display that reports 23 possible modes via EDID. Out of these 15 are accepted by the driver with the strict check.

Two more would be accepted with a relaxed check that allows a 0.5% margin.

For the remaining six modes, the pixel clock would deviate up to ~5% from what the display expects. Still, if I remove the check altogether, all 23 modes seem to work just fine.

I can confirm the displays I tested also seem pretty tolerant in practice (up to ~3-4% at least), but I agree with Lucas that this isn't something we can rely on for a general purpose driver as having examples of things being tolerant doesn't mean all hardware will be as flexible..

Quoted 9 lines
Quoted 9 lines

I'd really like to be able to add more PHY PLL setpoints for displays that use non-CEA-861 modes. Unfortunately I didn't manage to figure out the fractional-n PLL parameter calculation so far.

The i.MX8MP Reference Manual provides formulas to calculate the parameters based on the register values and I tried to make sense of it using the existing register values in the driver. But somehow it doesn't add up for me.

Quoted 5 lines
Quoted 2 lines

Lucas, did you already work with the PLL parameters? By any chance, do you now how the math behind them works?

I spent a little time trying to understand it a bit. I created a PMS calculator similar to the one used on the DSI controller,

Great! I'll admit this also flies over my head and I don't have the time to study this, so this is much appreciated.

Quoted 3 lines

except that
the M seems to be fixed at a value of 62 per the data sheet, so it's more of a PS calculator.

Hmm... PHY_REG2 in the datasheet only lists '0011_1110b - 62' as example(?) values, but it doesn't say other values are reserved either, I'm not sure what to make of it.
In the current driver PHY_REG_02 (driver macro) is assigned the first field of .pll_div_regs, which goes anywhere from 0x4b to 0x7b -- pretty far from 62(0x3e)...

Since other frequencies have been adjusting this main diviser ratio we actually tried copying neighboring values and adjusting only that reg 2 (so the M if I get this right?), but the end result ended up not synchronizing properly every time... We didn't have time to check with a scope if the generated signal was ugly or if it just didn't lock properly, but the display worked when we just re-used the neighboring values without changing anything despite being ~3-4% off, so we took the easy way out here and didn't dig much further.

Quoted 9 lines

Anyway, When I run my P-S calculator to generate the 'best rate' I get a value that's usually 0.2% variance from nominal, but I only verified a handful of values:

Several which were +0.2%
297600000 vs 297000000 (4k@30)
148800000 vs 148500000 (1080p60)
74400 vs 74200

Quoted 5 lines

One value was -0.16%
24800000 vs 25200000

If the M value was a bit more flexible, we might be able to reduce that variance more.

Yes, I think the M value could be more flexible, but that'd require checking if it actually works, whereas having slightly off frequencies will most likely be OK so I don't think it's worth the effort -- happy to stick to what the datasheet describes.

Quoted 4 lines

If / when I get some time, I might play with trying to disable the fractional mode and just use the PMS calculator for simplicity despite the inaccuracy. Maybe we could fall back to using the PMS calculator if the desired frequency isn't in the look-up-table.

That'd be greatly appreciated, I don't have any strong opinion on whether that should completely replace the table, or only be used if there is no exact match in the table as these are values we know will work; but we can definitely test any patch you can throw at us here.

Cheers,

Signature · 8 lines
Dominique



-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
author
#43 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Quoted 42 lines · Dominique MARTINET

Adam Ford wrote on Tue, Aug 20, 2024 at 09:49:03PM -0500:

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

Quoted 8 lines
Quoted 8 lines

I checked with a 1080p display that reports 23 possible modes via EDID. Out of these 15 are accepted by the driver with the strict check.

Two more would be accepted with a relaxed check that allows a 0.5% margin.

For the remaining six modes, the pixel clock would deviate up to ~5% from what the display expects. Still, if I remove the check altogether, all 23 modes seem to work just fine.

I can confirm the displays I tested also seem pretty tolerant in practice (up to ~3-4% at least), but I agree with Lucas that this isn't something we can rely on for a general purpose driver as having examples of things being tolerant doesn't mean all hardware will be as flexible..

Quoted 9 lines
Quoted 9 lines

I'd really like to be able to add more PHY PLL setpoints for displays that use non-CEA-861 modes. Unfortunately I didn't manage to figure out the fractional-n PLL parameter calculation so far.

The i.MX8MP Reference Manual provides formulas to calculate the parameters based on the register values and I tried to make sense of it using the existing register values in the driver. But somehow it doesn't add up for me.

Quoted 5 lines
Quoted 2 lines

Lucas, did you already work with the PLL parameters? By any chance, do you now how the math behind them works?

I spent a little time trying to understand it a bit. I created a PMS calculator similar to the one used on the DSI controller,

Great! I'll admit this also flies over my head and I don't have the time to study this, so this is much appreciated.

Quoted 3 lines

except that
the M seems to be fixed at a value of 62 per the data sheet, so it's more of a PS calculator.

Quoted 6 lines

Hmm... PHY_REG2 in the datasheet only lists '0011_1110b - 62' as example(?) values, but it doesn't say other values are reserved either, I'm not sure what to make of it.
In the current driver PHY_REG_02 (driver macro) is assigned the first field of .pll_div_regs, which goes anywhere from 0x4b to 0x7b -- pretty far from 62(0x3e)...

OK. I will experiment with increasing the range of M from being fixed at 3e to a range of 3b to 7b to see if my PMS integer calculator can get more accurate.

Quoted 35 lines

Since other frequencies have been adjusting this main diviser ratio we actually tried copying neighboring values and adjusting only that reg 2 (so the M if I get this right?), but the end result ended up not synchronizing properly every time... We didn't have time to check with a scope if the generated signal was ugly or if it just didn't lock properly, but the display worked when we just re-used the neighboring values without changing anything despite being ~3-4% off, so we took the easy way out here and didn't dig much further.

Quoted 9 lines

Anyway, When I run my P-S calculator to generate the 'best rate' I get a value that's usually 0.2% variance from nominal, but I only verified a handful of values:

Several which were +0.2%
297600000 vs 297000000 (4k@30)
148800000 vs 148500000 (1080p60)
74400 vs 74200

Quoted 5 lines

One value was -0.16%
24800000 vs 25200000

If the M value was a bit more flexible, we might be able to reduce that variance more.

Yes, I think the M value could be more flexible, but that'd require checking if it actually works, whereas having slightly off frequencies will most likely be OK so I don't think it's worth the effort -- happy to stick to what the datasheet describes.

Quoted 4 lines

If / when I get some time, I might play with trying to disable the fractional mode and just use the PMS calculator for simplicity despite the inaccuracy. Maybe we could fall back to using the PMS calculator if the desired frequency isn't in the look-up-table.

Quoted 4 lines

That'd be greatly appreciated, I don't have any strong opinion on whether that should completely replace the table, or only be used if there is no exact match in the table as these are values we know will work; but we can definitely test any patch you can throw at us here.

I can't promise it'll be quick. I am not fully certain I understand how the whole thing works, but as a rule, I don't generally like look up tables if they can be calculated dynamically.

adam

Quoted 7 lines

Cheers,
--
Dominique

author
#44 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Quoted 91 lines · Adam Ford
Quoted 42 lines · Dominique MARTINET

Adam Ford wrote on Tue, Aug 20, 2024 at 09:49:03PM -0500:

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

Quoted 8 lines
Quoted 8 lines

I checked with a 1080p display that reports 23 possible modes via EDID. Out of these 15 are accepted by the driver with the strict check.

Two more would be accepted with a relaxed check that allows a 0.5% margin.

For the remaining six modes, the pixel clock would deviate up to ~5% from what the display expects. Still, if I remove the check altogether, all 23 modes seem to work just fine.

I can confirm the displays I tested also seem pretty tolerant in practice (up to ~3-4% at least), but I agree with Lucas that this isn't something we can rely on for a general purpose driver as having examples of things being tolerant doesn't mean all hardware will be as flexible..

Quoted 9 lines
Quoted 9 lines

I'd really like to be able to add more PHY PLL setpoints for displays that use non-CEA-861 modes. Unfortunately I didn't manage to figure out the fractional-n PLL parameter calculation so far.

The i.MX8MP Reference Manual provides formulas to calculate the parameters based on the register values and I tried to make sense of it using the existing register values in the driver. But somehow it doesn't add up for me.

Quoted 5 lines
Quoted 2 lines

Lucas, did you already work with the PLL parameters? By any chance, do you now how the math behind them works?

I spent a little time trying to understand it a bit. I created a PMS calculator similar to the one used on the DSI controller,

Great! I'll admit this also flies over my head and I don't have the time to study this, so this is much appreciated.

Quoted 3 lines

except that
the M seems to be fixed at a value of 62 per the data sheet, so it's more of a PS calculator.

Quoted 6 lines

Hmm... PHY_REG2 in the datasheet only lists '0011_1110b - 62' as example(?) values, but it doesn't say other values are reserved either, I'm not sure what to make of it.
In the current driver PHY_REG_02 (driver macro) is assigned the first field of .pll_div_regs, which goes anywhere from 0x4b to 0x7b -- pretty far from 62(0x3e)...

OK. I will experiment with increasing the range of M from being fixed at 3e to a range of 3b to 7b to see if my PMS integer calculator can get more accurate.

Quoted 35 lines

Since other frequencies have been adjusting this main diviser ratio we actually tried copying neighboring values and adjusting only that reg 2 (so the M if I get this right?), but the end result ended up not synchronizing properly every time... We didn't have time to check with a scope if the generated signal was ugly or if it just didn't lock properly, but the display worked when we just re-used the neighboring values without changing anything despite being ~3-4% off, so we took the easy way out here and didn't dig much further.

Quoted 9 lines

Anyway, When I run my P-S calculator to generate the 'best rate' I get a value that's usually 0.2% variance from nominal, but I only verified a handful of values:

Several which were +0.2%
297600000 vs 297000000 (4k@30)
148800000 vs 148500000 (1080p60)
74400 vs 74200

Quoted 5 lines

One value was -0.16%
24800000 vs 25200000

If the M value was a bit more flexible, we might be able to reduce that variance more.

Yes, I think the M value could be more flexible, but that'd require checking if it actually works, whereas having slightly off frequencies will most likely be OK so I don't think it's worth the effort -- happy to stick to what the datasheet describes.

Quoted 4 lines

If / when I get some time, I might play with trying to disable the fractional mode and just use the PMS calculator for simplicity despite the inaccuracy. Maybe we could fall back to using the PMS calculator if the desired frequency isn't in the look-up-table.

Quoted 8 lines
Quoted 4 lines

That'd be greatly appreciated, I don't have any strong opinion on whether that should completely replace the table, or only be used if there is no exact match in the table as these are values we know will work; but we can definitely test any patch you can throw at us here.

I can't promise it'll be quick. I am not fully certain I understand how the whole thing works, but as a rule, I don't generally like look up tables if they can be calculated dynamically.

I updated my PMS calculator, and I randomly selected 5 resolutions and they all returned an exact clock match, so I'll attempt to use the PMS integer clock instead of the fractional one.

It'll be a little while longer before I can do anything with it.

adam

Quoted 9 lines

adam

Quoted 7 lines

Cheers,
--
Dominique

author
#45 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Quoted 102 lines · Adam Ford
Quoted 91 lines · Adam Ford
Quoted 42 lines · Dominique MARTINET

Adam Ford wrote on Tue, Aug 20, 2024 at 09:49:03PM -0500:

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

Quoted 8 lines
Quoted 8 lines

I checked with a 1080p display that reports 23 possible modes via EDID. Out of these 15 are accepted by the driver with the strict check.

Two more would be accepted with a relaxed check that allows a 0.5% margin.

For the remaining six modes, the pixel clock would deviate up to ~5% from what the display expects. Still, if I remove the check altogether, all 23 modes seem to work just fine.

I can confirm the displays I tested also seem pretty tolerant in practice (up to ~3-4% at least), but I agree with Lucas that this isn't something we can rely on for a general purpose driver as having examples of things being tolerant doesn't mean all hardware will be as flexible..

Quoted 9 lines
Quoted 9 lines

I'd really like to be able to add more PHY PLL setpoints for displays that use non-CEA-861 modes. Unfortunately I didn't manage to figure out the fractional-n PLL parameter calculation so far.

The i.MX8MP Reference Manual provides formulas to calculate the parameters based on the register values and I tried to make sense of it using the existing register values in the driver. But somehow it doesn't add up for me.

Quoted 5 lines
Quoted 2 lines

Lucas, did you already work with the PLL parameters? By any chance, do you now how the math behind them works?

I spent a little time trying to understand it a bit. I created a PMS calculator similar to the one used on the DSI controller,

Great! I'll admit this also flies over my head and I don't have the time to study this, so this is much appreciated.

Quoted 3 lines

except that
the M seems to be fixed at a value of 62 per the data sheet, so it's more of a PS calculator.

Quoted 6 lines

Hmm... PHY_REG2 in the datasheet only lists '0011_1110b - 62' as example(?) values, but it doesn't say other values are reserved either, I'm not sure what to make of it.
In the current driver PHY_REG_02 (driver macro) is assigned the first field of .pll_div_regs, which goes anywhere from 0x4b to 0x7b -- pretty far from 62(0x3e)...

OK. I will experiment with increasing the range of M from being fixed at 3e to a range of 3b to 7b to see if my PMS integer calculator can get more accurate.

Quoted 35 lines

Since other frequencies have been adjusting this main diviser ratio we actually tried copying neighboring values and adjusting only that reg 2 (so the M if I get this right?), but the end result ended up not synchronizing properly every time... We didn't have time to check with a scope if the generated signal was ugly or if it just didn't lock properly, but the display worked when we just re-used the neighboring values without changing anything despite being ~3-4% off, so we took the easy way out here and didn't dig much further.

Quoted 9 lines

Anyway, When I run my P-S calculator to generate the 'best rate' I get a value that's usually 0.2% variance from nominal, but I only verified a handful of values:

Several which were +0.2%
297600000 vs 297000000 (4k@30)
148800000 vs 148500000 (1080p60)
74400 vs 74200

Quoted 5 lines

One value was -0.16%
24800000 vs 25200000

If the M value was a bit more flexible, we might be able to reduce that variance more.

Yes, I think the M value could be more flexible, but that'd require checking if it actually works, whereas having slightly off frequencies will most likely be OK so I don't think it's worth the effort -- happy to stick to what the datasheet describes.

Quoted 4 lines

If / when I get some time, I might play with trying to disable the fractional mode and just use the PMS calculator for simplicity despite the inaccuracy. Maybe we could fall back to using the PMS calculator if the desired frequency isn't in the look-up-table.

Quoted 8 lines
Quoted 4 lines

That'd be greatly appreciated, I don't have any strong opinion on whether that should completely replace the table, or only be used if there is no exact match in the table as these are values we know will work; but we can definitely test any patch you can throw at us here.

I can't promise it'll be quick. I am not fully certain I understand how the whole thing works, but as a rule, I don't generally like look up tables if they can be calculated dynamically.

Quoted 5 lines

I updated my PMS calculator, and I randomly selected 5 resolutions and they all returned an exact clock match, so I'll attempt to use the PMS integer clock instead of the fractional one.

It'll be a little while longer before I can do anything with it.

Frieder,

Using my PMS calculator and Rev 2 of the Tech Ref Manual, I think I can generate you a table entry for 51.2MHz. I don't have the ability to test it. I am still working on figuring out an algorithm to calculate the fractional divider, but 51.2MHz x 5 does not' appear to need the fractional clock divider, so I think I can just get away with the standard PMS calculations.

My algorithm showed:
HDMI PHY Best P = 1
HDMI PHY Best M = 64
HDMI PHY Best S = 6
HDMI PHY Best freq = 256000000

I'll try to generate a patch to get these values into the table if you're willing to test it.

All,

I still think it's a good idea to fall back to the PMS calculator if the fractional stuff isn't found. We could then determine which clock frequency is closer between the nearest table entry or the PMS calculator until someone can come up with an algorithm for it.

adam

Quoted 11 lines

adam

Quoted 9 lines

adam

Quoted 7 lines

Cheers,
--
Dominique

#46 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Hi Adam,

Quoted 109 lines · Adam Ford
Quoted 102 lines · Adam Ford
Quoted 91 lines · Adam Ford
Quoted 42 lines · Dominique MARTINET

Adam Ford wrote on Tue, Aug 20, 2024 at 09:49:03PM -0500:

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

However, this check is a bit overcautious in that it only allows exact rate matches. IIRC HDMI allows a rate mismatch of +- 0.5%, so this check could be relaxed quite a bit to allow for that.

Quoted 8 lines
Quoted 8 lines

I checked with a 1080p display that reports 23 possible modes via EDID. Out of these 15 are accepted by the driver with the strict check.

Two more would be accepted with a relaxed check that allows a 0.5% margin.

For the remaining six modes, the pixel clock would deviate up to ~5% from what the display expects. Still, if I remove the check altogether, all 23 modes seem to work just fine.

I can confirm the displays I tested also seem pretty tolerant in practice (up to ~3-4% at least), but I agree with Lucas that this isn't something we can rely on for a general purpose driver as having examples of things being tolerant doesn't mean all hardware will be as flexible..

Quoted 9 lines
Quoted 9 lines

I'd really like to be able to add more PHY PLL setpoints for displays that use non-CEA-861 modes. Unfortunately I didn't manage to figure out the fractional-n PLL parameter calculation so far.

The i.MX8MP Reference Manual provides formulas to calculate the parameters based on the register values and I tried to make sense of it using the existing register values in the driver. But somehow it doesn't add up for me.

Quoted 5 lines
Quoted 2 lines

Lucas, did you already work with the PLL parameters? By any chance, do you now how the math behind them works?

I spent a little time trying to understand it a bit. I created a PMS calculator similar to the one used on the DSI controller,

Great! I'll admit this also flies over my head and I don't have the time to study this, so this is much appreciated.

Quoted 3 lines

except that
the M seems to be fixed at a value of 62 per the data sheet, so it's more of a PS calculator.

Quoted 6 lines

Hmm... PHY_REG2 in the datasheet only lists '0011_1110b - 62' as example(?) values, but it doesn't say other values are reserved either, I'm not sure what to make of it.
In the current driver PHY_REG_02 (driver macro) is assigned the first field of .pll_div_regs, which goes anywhere from 0x4b to 0x7b -- pretty far from 62(0x3e)...

OK. I will experiment with increasing the range of M from being fixed at 3e to a range of 3b to 7b to see if my PMS integer calculator can get more accurate.

Quoted 35 lines

Since other frequencies have been adjusting this main diviser ratio we actually tried copying neighboring values and adjusting only that reg 2 (so the M if I get this right?), but the end result ended up not synchronizing properly every time... We didn't have time to check with a scope if the generated signal was ugly or if it just didn't lock properly, but the display worked when we just re-used the neighboring values without changing anything despite being ~3-4% off, so we took the easy way out here and didn't dig much further.

Quoted 9 lines

Anyway, When I run my P-S calculator to generate the 'best rate' I get a value that's usually 0.2% variance from nominal, but I only verified a handful of values:

Several which were +0.2%
297600000 vs 297000000 (4k@30)
148800000 vs 148500000 (1080p60)
74400 vs 74200

Quoted 5 lines

One value was -0.16%
24800000 vs 25200000

If the M value was a bit more flexible, we might be able to reduce that variance more.

Yes, I think the M value could be more flexible, but that'd require checking if it actually works, whereas having slightly off frequencies will most likely be OK so I don't think it's worth the effort -- happy to stick to what the datasheet describes.

Quoted 4 lines

If / when I get some time, I might play with trying to disable the fractional mode and just use the PMS calculator for simplicity despite the inaccuracy. Maybe we could fall back to using the PMS calculator if the desired frequency isn't in the look-up-table.

Quoted 8 lines
Quoted 4 lines

That'd be greatly appreciated, I don't have any strong opinion on whether that should completely replace the table, or only be used if there is no exact match in the table as these are values we know will work; but we can definitely test any patch you can throw at us here.

I can't promise it'll be quick. I am not fully certain I understand how the whole thing works, but as a rule, I don't generally like look up tables if they can be calculated dynamically.

Quoted 5 lines

I updated my PMS calculator, and I randomly selected 5 resolutions and they all returned an exact clock match, so I'll attempt to use the PMS integer clock instead of the fractional one.

It'll be a little while longer before I can do anything with it.

Quoted 8 lines

Frieder,

Using my PMS calculator and Rev 2 of the Tech Ref Manual, I think I can generate you a table entry for 51.2MHz. I don't have the ability to test it. I am still working on figuring out an algorithm to calculate the fractional divider, but 51.2MHz x 5 does not' appear to need the fractional clock divider, so I think I can just get away with the standard PMS calculations.

Thanks Adam for all the efforts. The initial request for the 51.2 MHz clock was from Dominique, not me. I was just jumping onto the bandwagon with my own use-cases.

Quoted 9 lines

My algorithm showed:
HDMI PHY Best P = 1
HDMI PHY Best M = 64
HDMI PHY Best S = 6
HDMI PHY Best freq = 256000000

I'll try to generate a patch to get these values into the table if you're willing to test it.

Any chance you can share your algorithm, so I can try to generate some table entries for the missing frequencies I encounter?

If we could figure out the calculation of the fractional divider, we could generate table entries for arbitrary frequencies, which would be an easy way to add support for any strange displays out there.

Quoted 7 lines

All,

I still think it's a good idea to fall back to the PMS calculator if the fractional stuff isn't found. We could then determine which clock frequency is closer between the nearest table entry or the PMS calculator until someone can come up with an algorithm for it.

Yes, I think that's a good idea.

Thanks
Frieder

#47 lore raw

Re: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI)

Frieder Schrempf wrote on Tue, Aug 27, 2024 at 09:00:34AM +0200:

Quoted 10 lines
Quoted 6 lines

Using my PMS calculator and Rev 2 of the Tech Ref Manual, I think I can generate you a table entry for 51.2MHz. I don't have the ability to test it. I am still working on figuring out an algorithm to calculate the fractional divider, but 51.2MHz x 5 does not' appear to need the fractional clock divider, so I think I can just get away with the standard PMS calculations.

Thanks Adam for all the efforts. The initial request for the 51.2 MHz clock was from Dominique, not me. I was just jumping onto the bandwagon with my own use-cases.

We still have that 51.2 MHz display around, so happy to test -- might take a little bit of time as this already has a workaround but it's definitely something I'd like to clean up so more than happy to help.

Quoted 6 lines
Quoted 4 lines

I still think it's a good idea to fall back to the PMS calculator if the fractional stuff isn't found. We could then determine which clock frequency is closer between the nearest table entry or the PMS calculator until someone can come up with an algorithm for it.

Yes, I think that's a good idea.

Seconded; we can keep the code as fallback of the table at first and if it works well maybe even remove the table altogether later, but just having fallback first would be great.

Signature · 1 line
Dominique
#60 lore raw

imx8mp: HDMI display blank/black problems

In reply to Adam Ford

Hey,
We had some problems with the hdmi on the imx8mp and wanted to leave, what we found out about it, somewhere for others to find it.

The problem was that our hdmi display sometimes stayed blank after hot plugging and sometimes at startup. On older kernel versions 6.6 we did not have the problem with the not mainlined hdmi patches. We tracked the commit down that introduced the problem for us. It was the following “driver core: Enable fw_devlink=rpm by default” https://lore.kernel.org/lkml/[email protected]/
So we switched back to FW_DEVLINK_FLAGS_ON via kernel parameter. Don’t really understand what the problem with RPM is.

So, this information is just for reference. Maybe someone has an idea what is going on here. And how to fix the problem in a more proper way.

Best regards Johannes

#61 lore raw

Re: imx8mp: HDMI display blank/black problems

Hi Johannes,

Quoted 10 lines · On 25.10.24 10:05 AM, [email protected] wrote:

[Sie erhalten nicht häufig E-Mails von [email protected]. Weitere Informationen, warum dies wichtig ist, finden Sie unter https://aka.ms/LearnAboutSenderIdentification ]

Hey,
We had some problems with the hdmi on the imx8mp and wanted to leave, what we found out about it, somewhere for others to find it.

The problem was that our hdmi display sometimes stayed blank after hot plugging and sometimes at startup. On older kernel versions 6.6 we did not have the problem with the not mainlined hdmi patches. We tracked the commit down that introduced the problem for us. It was the following “driver core: Enable fw_devlink=rpm by default” https://lore.kernel.org/lkml/[email protected]/
So we switched back to FW_DEVLINK_FLAGS_ON via kernel parameter. Don’t really understand what the problem with RPM is.

So, this information is just for reference. Maybe someone has an idea what is going on here. And how to fix the problem in a more proper way.

Thanks for investigating and sharing your results!

I'm seeing the same symptoms and previously found out that this is related to LCDIF underrun errors. See [1] for more information.

Adam has also started this thread: [2].

Anyway, knowing that this is related to fw_devlink=rpm is really helpful. I just tried with fw_devlink=on and wasn't able to see any issues anymore. So this confirms your findings.

I hope that some of the driver framework and runtime PM experts can help to find out what is actually wrong and how the correct fix might look like.

I'm also CC-ing Saravana who authored the change from fw_devlink=on to fw_devlink=rpm to see if they have anything to add.

Thanks
Frieder

[1]
https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/#26014057
[2]
https://lore.kernel.org/imx/[email protected]/T/

author
#62 lore raw

Re: imx8mp: HDMI display blank/black problems

Quoted 17 lines · Frieder Schrempf

Hi Johannes,

Quoted 10 lines · On 25.10.24 10:05 AM, [email protected] wrote:

[Sie erhalten nicht häufig E-Mails von [email protected]. Weitere Informationen, warum dies wichtig ist, finden Sie unter https://aka.ms/LearnAboutSenderIdentification ]

Hey,
We had some problems with the hdmi on the imx8mp and wanted to leave, what we found out about it, somewhere for others to find it.

The problem was that our hdmi display sometimes stayed blank after hot plugging and sometimes at startup. On older kernel versions 6.6 we did not have the problem with the not mainlined hdmi patches. We tracked the commit down that introduced the problem for us. It was the following “driver core: Enable fw_devlink=rpm by default” https://lore.kernel.org/lkml/[email protected]/
So we switched back to FW_DEVLINK_FLAGS_ON via kernel parameter. Don’t really understand what the problem with RPM is.

So, this information is just for reference. Maybe someone has an idea what is going on here. And how to fix the problem in a more proper way.

Thanks for investigating and sharing your results!

Quoted 8 lines

I'm seeing the same symptoms and previously found out that this is related to LCDIF underrun errors. See [1] for more information.

Adam has also started this thread: [2].

Anyway, knowing that this is related to fw_devlink=rpm is really helpful. I just tried with fw_devlink=on and wasn't able to see any issues anymore. So this confirms your findings.

I was off in the weeds thinking there was something wrong in timing and/or a race condition around the PLL or something. This is good news.
Please forgive my ignorance, what does fw_devlink do? Is there something we can do in the driver itself to force its behavior?

adam

Quoted 14 lines

I hope that some of the driver framework and runtime PM experts can help to find out what is actually wrong and how the correct fix might look like.

I'm also CC-ing Saravana who authored the change from fw_devlink=on to fw_devlink=rpm to see if they have anything to add.

Thanks
Frieder

[1]
https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/#26014057
[2]
https://lore.kernel.org/imx/[email protected]/T/

#63 lore raw

Re: imx8mp: HDMI display blank/black problems

Quoted 29 lines · Adam Ford
Quoted 17 lines · Frieder Schrempf

Hi Johannes,

Quoted 10 lines · On 25.10.24 10:05 AM, [email protected] wrote:

[Sie erhalten nicht häufig E-Mails von [email protected]. Weitere Informationen, warum dies wichtig ist, finden Sie unter https://aka.ms/LearnAboutSenderIdentification ]

Hey,
We had some problems with the hdmi on the imx8mp and wanted to leave, what we found out about it, somewhere for others to find it.

The problem was that our hdmi display sometimes stayed blank after hot plugging and sometimes at startup. On older kernel versions 6.6 we did not have the problem with the not mainlined hdmi patches. We tracked the commit down that introduced the problem for us. It was the following “driver core: Enable fw_devlink=rpm by default” https://lore.kernel.org/lkml/[email protected]/
So we switched back to FW_DEVLINK_FLAGS_ON via kernel parameter. Don’t really understand what the problem with RPM is.

So, this information is just for reference. Maybe someone has an idea what is going on here. And how to fix the problem in a more proper way.

Thanks for investigating and sharing your results!

Quoted 8 lines

I'm seeing the same symptoms and previously found out that this is related to LCDIF underrun errors. See [1] for more information.

Adam has also started this thread: [2].

Anyway, knowing that this is related to fw_devlink=rpm is really helpful. I just tried with fw_devlink=on and wasn't able to see any issues anymore. So this confirms your findings.

Quoted 5 lines

I was off in the weeds thinking there was something wrong in timing and/or a race condition around the PLL or something. This is good news.
Please forgive my ignorance, what does fw_devlink do? Is there something we can do in the driver itself to force its behavior?

fw_devlink figures out supplier/consumer dependencies between devices and creates device links between them. This ensures proper probe/suspend/resume/shutdown/runtime PM ordering.

fw_devlink=rpm vs on means "enforce all of these" vs "enforce all of these except runtime PM".

Quoted 7 lines

adam

Quoted 6 lines

I hope that some of the driver framework and runtime PM experts can help to find out what is actually wrong and how the correct fix might look like.

I'm also CC-ing Saravana who authored the change from fw_devlink=on to fw_devlink=rpm to see if they have anything to add.

When fw_devlink=rpm, you'll have device links created between consumers and suppliers with the DL_FLAG_PM_RUNTIME flag set. So before your device is runtime resumed, it'll make sure all your suppliers are resumed first.

My guess is that there is some issue in the runtime PM handling in these drivers. I don't have enough context to provide further insight.

-Saravana

Quoted 8 lines
Quoted 8 lines

Thanks
Frieder

[1]
https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/#26014057
[2]
https://lore.kernel.org/imx/[email protected]/T/

#64 lore raw

Re: imx8mp: HDMI display blank/black problems

Am 30.10.24 um 9:20 PM schrieb Saravana Kannan:

Quoted 51 lines · Adam Ford
Quoted 29 lines
Quoted 17 lines · Frieder Schrempf

Hi Johannes,

Quoted 10 lines · On 25.10.24 10:05 AM, [email protected] wrote:

[Sie erhalten nicht häufig E-Mails von [email protected]. Weitere Informationen, warum dies wichtig ist, finden Sie unter https://aka.ms/LearnAboutSenderIdentification ]

Hey,
We had some problems with the hdmi on the imx8mp and wanted to leave, what we found out about it, somewhere for others to find it.

The problem was that our hdmi display sometimes stayed blank after hot plugging and sometimes at startup. On older kernel versions 6.6 we did not have the problem with the not mainlined hdmi patches. We tracked the commit down that introduced the problem for us. It was the following “driver core: Enable fw_devlink=rpm by default” https://lore.kernel.org/lkml/[email protected]/
So we switched back to FW_DEVLINK_FLAGS_ON via kernel parameter. Don’t really understand what the problem with RPM is.

So, this information is just for reference. Maybe someone has an idea what is going on here. And how to fix the problem in a more proper way.

Thanks for investigating and sharing your results!

Quoted 8 lines

I'm seeing the same symptoms and previously found out that this is related to LCDIF underrun errors. See [1] for more information.

Adam has also started this thread: [2].

Anyway, knowing that this is related to fw_devlink=rpm is really helpful. I just tried with fw_devlink=on and wasn't able to see any issues anymore. So this confirms your findings.

Quoted 5 lines

I was off in the weeds thinking there was something wrong in timing and/or a race condition around the PLL or something. This is good news.
Please forgive my ignorance, what does fw_devlink do? Is there something we can do in the driver itself to force its behavior?

fw_devlink figures out supplier/consumer dependencies between devices and creates device links between them. This ensures proper probe/suspend/resume/shutdown/runtime PM ordering.

fw_devlink=rpm vs on means "enforce all of these" vs "enforce all of these except runtime PM".

Quoted 7 lines

adam

Quoted 6 lines

I hope that some of the driver framework and runtime PM experts can help to find out what is actually wrong and how the correct fix might look like.

I'm also CC-ing Saravana who authored the change from fw_devlink=on to fw_devlink=rpm to see if they have anything to add.

Quoted 7 lines

When fw_devlink=rpm, you'll have device links created between consumers and suppliers with the DL_FLAG_PM_RUNTIME flag set. So before your device is runtime resumed, it'll make sure all your suppliers are resumed first.

My guess is that there is some issue in the runtime PM handling in these drivers. I don't have enough context to provide further insight.

I bet you are right. I tried to have a closer look but unfortunately I didn't make any progress.

The drivers involved are lcdif_drv.c, imx8mp-hdmi-tx.c and phy-fsl-samsung-hdmi.c.

As we see a "LCDIF Underrun Error" with fw_devlink=rpm my first guess would be that the suppliers of LCDIF are maybe turned on in the wrong order.

Lucas, Marek: As the main authors of these drivers, do you think you could help a little with further debugging? Any ideas?

Thanks!