Skip to contentSkip to conversation

dt-bindings: soc: imx8mp-media-blk-ctrl: Align block controller example name

PATCH Superseded Marek Vasut 3 participants 10 messages Feb 20, 2023 – Feb 21, 2023

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 dt-bindings: soc: imx8mp-media-blk-ctrl: Align block controller example name

Align the block controller example node name with Linux imx8mp.dtsi . No functional change.

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Adjust the label too

---
 .../devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml +1 -1
index dadb6108e3213..71deebe902d52 100644
@@ -94,7 +94,7 @@ examples:
     #include <dt-bindings/clock/imx8mp-clock.h>
     #include <dt-bindings/power/imx8mp-power.h>
 
-    media_blk_ctl: blk-ctl@32ec0000 {
+    media_blk_ctrl: blk-ctrl@32ec0000 {
         compatible = "fsl,imx8mp-media-blk-ctrl", "syscon";
         reg = <0x32ec0000 0x138>;
         power-domains = <&mediamix_pd>, <&mipi_phy1_pd>, <&mipi_phy1_pd>,
Signature · 1 line
2.39.1
#1 lore raw

PATCH v2 2/4 dt-bindings: soc: imx8mp-media-blk-ctrl: Add LDB into DT example

Document the LDB bridge subnode and add the subnode into the example. For the subnode to work, the block control must scan its subnodes and bind drivers to them, do not misuse either simple-bus or simple-mfd here .

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Add RB from Liu

---
 .../soc/imx/fsl,imx8mp-media-blk-ctrl.yaml    | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml +51 -0
index 71deebe902d52..61e6bc731bbb5 100644
@@ -23,6 +23,12 @@ properties:
   reg:
     maxItems: 1
 
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 1
+
   '#power-domain-cells':
     const: 1
 
@@ -78,9 +84,16 @@ properties:
       - const: isp1
       - const: dwe
 
+  bridge@5c:
+    type: object
+    $ref: /schemas/display/bridge/fsl,ldb.yaml#
+    unevaluatedProperties: false
+
 required:
   - compatible
   - reg
+  - '#address-cells'
+  - '#size-cells'
   - '#power-domain-cells'
   - power-domains
   - power-domain-names
@@ -114,5 +127,43 @@ examples:
         clock-names = "apb", "axi", "cam1", "cam2", "disp1", "disp2",
                       "isp", "phy";
         #power-domain-cells = <1>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        bridge@5c {
+            compatible = "fsl,imx8mp-ldb";
+            clocks = <&clk IMX8MP_CLK_MEDIA_LDB>;
+            clock-names = "ldb";
+            reg = <0x5c 0x4>, <0x128 0x4>;
+            reg-names = "ldb", "lvds";
+
+            ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+
+                    ldb_from_lcdif2: endpoint {
+                        remote-endpoint = <&lcdif2_to_ldb>;
+                    };
+                };
+
+                port@1 {
+                    reg = <1>;
+
+                    ldb_lvds_ch0: endpoint {
+                        remote-endpoint = <&ldb_to_lvdsx4panel>;
+                    };
+                };
+
+                port@2 {
+                    reg = <2>;
+
+                    ldb_lvds_ch1: endpoint {
+                    };
+                };
+            };
+        };
     };
 ...
Signature · 1 line
2.39.1
Reviewed-by on v2 2/4
#2 lore raw

Re: [PATCH v2 2/4] dt-bindings: soc: imx8mp-media-blk-ctrl: Add LDB into DT example

Quoted 4 lines · Marek Vasut

Document the LDB bridge subnode and add the subnode into the example. For the subnode to work, the block control must scan its subnodes and bind drivers to them, do not misuse either simple-bus or simple-mfd here .

Drop space before full stop.

Your subject is a bit imprecise. Main feature here is adding LDB child, not to the example but to the schema.

Quoted 63 lines

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Add RB from Liu

---
 .../soc/imx/fsl,imx8mp-media-blk-ctrl.yaml    | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml +13 -0
index 71deebe902d52..61e6bc731bbb5 100644
@@ -23,6 +23,12 @@ properties:
   reg:
     maxItems: 1
 
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 1
+
   '#power-domain-cells':
     const: 1
 
@@ -78,9 +84,16 @@ properties:
       - const: isp1
       - const: dwe
 
+  bridge@5c:
+    type: object
+    $ref: /schemas/display/bridge/fsl,ldb.yaml#
+    unevaluatedProperties: false
+
 required:
   - compatible
   - reg
+  - '#address-cells'
+  - '#size-cells'
   - '#power-domain-cells'
   - power-domains
   - power-domain-names
@@ -114,5 +127,43 @@ examples:
         clock-names = "apb", "axi", "cam1", "cam2", "disp1", "disp2",
                       "isp", "phy";

Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml examples: · line 138

Quoted 10 lines
Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml +9 -0
         #power-domain-cells = <1>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        bridge@5c {
+            compatible = "fsl,imx8mp-ldb";
+            clocks = <&clk IMX8MP_CLK_MEDIA_LDB>;
+            clock-names = "ldb";
+            reg = <0x5c 0x4>, <0x128 0x4>;
+            reg-names = "ldb", "lvds";

Usually reg (and reg-names) is the second property, although depends on the soc subarch coding style.

Anyway, with full-stop fix:

Best regards,
Krzysztof

#3 lore raw

PATCH v2 3/4 soc: imx: imx8m-blk-ctrl: Scan subnodes and bind drivers to them

In reply to Marek Vasut

This particular block can have DT subnodes describing the LVDS LDB bridge. Instead of misusing simple-bus to scan for those nodes, do the scan within the driver.

Fixes 94e6197dadc9 ("arm64: dts: imx8mp: Add LCDIF2 & LDB nodes")

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: - Turn this into 3/4
- Warn and continue in case of error

---
 drivers/soc/imx/imx8m-blk-ctrl.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/soc/imx/imx8m-blk-ctrl.c +9 -0
index 399cb85105a18..4f5736e612fb0 100644
@@ -169,7 +169,9 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 {
 	const struct imx8m_blk_ctrl_data *bc_data;
 	struct device *dev = &pdev->dev;
+	struct platform_device *child;
 	struct imx8m_blk_ctrl *bc;
+	struct device_node *np;
 	void __iomem *base;
 	int i, ret;
 
@@ -310,6 +312,13 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, bc);
 
+	for_each_child_of_node(dev->of_node, np) {
+		child = of_platform_device_create(np, NULL, dev);
+		if (child)
+			continue;
+		dev_warn(dev, "failed to create device for %pOF\n", np);
+	}
+
 	return 0;
 
 cleanup_provider:
Signature · 1 line
2.39.1
Reviewed-by on v2 3/4
#4 lore raw

Re: [PATCH v2 3/4] soc: imx: imx8m-blk-ctrl: Scan subnodes and bind drivers to them

Hi Marek,

Quoted 45 lines · Marek Vasut

This particular block can have DT subnodes describing the LVDS LDB bridge. Instead of misusing simple-bus to scan for those nodes, do the scan within the driver.

Fixes 94e6197dadc9 ("arm64: dts: imx8mp: Add LCDIF2 & LDB nodes")

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: - Turn this into 3/4
- Warn and continue in case of error

---
 drivers/soc/imx/imx8m-blk-ctrl.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/soc/imx/imx8m-blk-ctrl.c +2 -0
index 399cb85105a18..4f5736e612fb0 100644
@@ -169,7 +169,9 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 {
 	const struct imx8m_blk_ctrl_data *bc_data;
 	struct device *dev = &pdev->dev;
+	struct platform_device *child;
 	struct imx8m_blk_ctrl *bc;
+	struct device_node *np;
 	void __iomem *base;
 	int i, ret;
 

drivers/soc/imx/imx8m-blk-ctrl.c static int imx8m_blk_ctrl_probe(struct platform_device *pdev) · line 318

Quoted 7 lines
drivers/soc/imx/imx8m-blk-ctrl.c +4 -0
@@ -310,6 +312,13 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, bc);
 
+	for_each_child_of_node(dev->of_node, np) {
+		child = of_platform_device_create(np, NULL, dev);
+		if (child)
+			continue;

We usually check and handle abnormal cases. So, better to check '!child" and warn in the 'if' clause. Anyway, the logic looks ok. So, kinda

Regards,
Liu Ying

Quoted 6 lines
drivers/soc/imx/imx8m-blk-ctrl.c +3 -0
+		dev_warn(dev, "failed to create device for %pOF\n", np);
+	}
+
 	return 0;
 
 cleanup_provider:
#5 lore raw

Re: [PATCH v2 3/4] soc: imx: imx8m-blk-ctrl: Scan subnodes and bind drivers to them

On 2/20/23 05:34, Liu Ying wrote:
[...]

Quoted 13 lines

drivers/soc/imx/imx8m-blk-ctrl.c static int imx8m_blk_ctrl_probe(struct platform_device *pdev) · line 318

Quoted 8 lines
drivers/soc/imx/imx8m-blk-ctrl.c +4 -0
@@ -310,6 +312,13 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
 
  	dev_set_drvdata(dev, bc);
 
+	for_each_child_of_node(dev->of_node, np) {
+		child = of_platform_device_create(np, NULL, dev);
+		if (child)
+			continue;

We usually check and handle abnormal cases. So, better to check '!child" and warn in the 'if' clause. Anyway, the logic looks ok. So, kinda

Quoted 1 line

The current approach reduces indentation, so I'll leave it as is.

Thanks

#6 lore raw

PATCH v2 4/4 arm64: dts: imx8mp: Drop simple-bus from fsl,imx8mp-media-blk-ctrl

In reply to Marek Vasut

This block should not be compatible with simple-bus and misuse it that way. Instead, the driver should scan its subnodes and bind drivers to them.

Fixes 94e6197dadc9 ("arm64: dts: imx8mp: Add LCDIF2 & LDB nodes")

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Turn this into 4/4

---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +1 -1
index 2dd60e3252f35..ca8093ee4d0e4 100644
@@ -1151,7 +1151,7 @@ lcdif2_to_ldb: endpoint {
 
 			media_blk_ctrl: blk-ctrl@32ec0000 {
 				compatible = "fsl,imx8mp-media-blk-ctrl",
-					     "simple-bus", "syscon";
+					     "syscon";
 				reg = <0x32ec0000 0x10000>;
 				#address-cells = <1>;
 				#size-cells = <1>;
Signature · 1 line
2.39.1
Reviewed-by on v2 4/4
#7 lore raw

Re: [PATCH v2 4/4] arm64: dts: imx8mp: Drop simple-bus from fsl,imx8mp-media-blk-ctrl

Quoted 24 lines · Marek Vasut

This block should not be compatible with simple-bus and misuse it that way. Instead, the driver should scan its subnodes and bind drivers to them.

Fixes 94e6197dadc9 ("arm64: dts: imx8mp: Add LCDIF2 & LDB nodes")

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Turn this into 4/4

Quoted 3 lines
---
 arch/arm64/boot/dts/freescale/imx8mp.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by on v2 1/4
#8 lore raw
In reply to Marek Vasut
Quoted 23 lines · Marek Vasut

Align the block controller example node name with Linux imx8mp.dtsi . No functional change.

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Adjust the label too

Quoted 3 lines
---
 .../devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#9 lore raw
In reply to Marek Vasut
Quoted 32 lines · Marek Vasut

Align the block controller example node name with Linux imx8mp.dtsi . No functional change.

---
Cc: Alexander Stein <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Paul Elder <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Adjust the label too

---
 .../devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml +0 -0
index dadb6108e3213..71deebe902d52 100644

Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml examples: · line 97

Quoted 5 lines
Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml +1 -1
@@ -94,7 +94,7 @@ examples:
     #include <dt-bindings/clock/imx8mp-clock.h>
     #include <dt-bindings/power/imx8mp-power.h>
 
-    media_blk_ctl: blk-ctl@32ec0000 {
+    media_blk_ctrl: blk-ctrl@32ec0000 {

No, because the label is unused. Instead you can just drop it. Unused labels should not be in DT binding examples, although we rarely comment about it.

Best regards,
Krzysztof