All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor
@ 2021-12-16 16:34 Jacopo Mondi
  2021-12-16 16:34 ` [PATCH v8 1/7] dt-bindings: media: max9286: Re-indent example Jacopo Mondi
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

Hello,
  v8 is rebased on lates renesas-drivers.

Minor changes compared to v7: address Geert's comments on the 'gpio-poc'
property parsing and power enable/disable routine.

The new property parsing logic reads like

	ret = of_property_read_u32_array();
	if (ret == -EVINAL) {
		/* Use regulator */

		return 0;
	}

	/* Make sure the property is well formed. */
	if (ret || gpio_poc[0] > 1 && (gpio_poc[1] != HIGH/LOW)
		return -EINVAL;

	return 0;

Same as in v7:

I have removed depencies on the post_register() v4l2 subdev operation to have
this integrated separately.

This change upports BSP 5.1 commit
https://github.com/renesas-rcar/linux-bsp/commit/28fdde07b28d5ae17ad6fb472ff4b52a4835cbee

The usual note about condor:

Condor has 2 GMSL channels, something the current version of the MAX9286 driver
does not support. However the DTS integration can be upstreamed but a single
channel can be used at a time.

Integration of the new "maxim,gpio-poc" property required for Eagle/Condor is
fully reviewed and can be eventually fast-tracked.

The series has been tested on Eagle V3H board, while only compile tested for
Condor.

Jacopo Mondi (4):
  dt-bindings: media: max9286: Re-indent example
  dt-bindings: media: max9286: Define 'maxim,gpio-poc'
  media: i2c: max9286: Use "maxim,gpio-poc" property
  arm64: dts: renesas: condor: Enable MAX9286

Kieran Bingham (3):
  arm64: dts: renesas: eagle: Enable MAX9286
  arm64: dts: renesas: Add GMSL cameras .dtsi
  DNI: arm64: dts: renesas: eagle: Include eagle-gmsl

 .../bindings/media/i2c/maxim,max9286.yaml     | 275 +++++++++------
 arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi | 332 ++++++++++++++++++
 .../arm64/boot/dts/renesas/r8a77970-eagle.dts | 112 ++++++
 .../boot/dts/renesas/r8a77980-condor.dts      | 193 ++++++++++
 drivers/media/i2c/max9286.c                   | 124 +++++--
 5 files changed, 899 insertions(+), 137 deletions(-)
 create mode 100644 arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi

--
2.33.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v8 1/7] dt-bindings: media: max9286: Re-indent example
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
@ 2021-12-16 16:34 ` Jacopo Mondi
  2021-12-16 16:34 ` [PATCH v8 2/7] dt-bindings: media: max9286: Define 'maxim,gpio-poc' Jacopo Mondi
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree, Rob Herring

The dt-bindings examples are usually indented with 4 spaces.

The maxim,max9286 schema has the example indented with only
2 spaces, re-indent it.

Cosmetic change only.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 .../bindings/media/i2c/maxim,max9286.yaml     | 214 +++++++++---------
 1 file changed, 107 insertions(+), 107 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
index 02f656e78700..ab4e7a620362 100644
--- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
@@ -174,140 +174,140 @@ examples:
     #include <dt-bindings/gpio/gpio.h>
 
     i2c@e66d8000 {
-      #address-cells = <1>;
-      #size-cells = <0>;
+        #address-cells = <1>;
+        #size-cells = <0>;
 
-      reg = <0 0xe66d8000>;
+        reg = <0 0xe66d8000>;
 
-      gmsl-deserializer@2c {
-        compatible = "maxim,max9286";
-        reg = <0x2c>;
-        poc-supply = <&camera_poc_12v>;
-        enable-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
+        gmsl-deserializer@2c {
+            compatible = "maxim,max9286";
+            reg = <0x2c>;
+            poc-supply = <&camera_poc_12v>;
+            enable-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
 
-        gpio-controller;
-        #gpio-cells = <2>;
+            gpio-controller;
+            #gpio-cells = <2>;
 
-        maxim,reverse-channel-microvolt = <170000>;
+            maxim,reverse-channel-microvolt = <170000>;
 
-        ports {
-          #address-cells = <1>;
-          #size-cells = <0>;
+            ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
 
-          port@0 {
-            reg = <0>;
+                port@0 {
+                    reg = <0>;
 
-            max9286_in0: endpoint {
-              remote-endpoint = <&rdacm20_out0>;
-            };
-          };
-
-          port@1 {
-            reg = <1>;
-
-            max9286_in1: endpoint {
-              remote-endpoint = <&rdacm20_out1>;
-            };
-          };
-
-          port@2 {
-            reg = <2>;
-
-            max9286_in2: endpoint {
-              remote-endpoint = <&rdacm20_out2>;
-            };
-          };
+                    max9286_in0: endpoint {
+                        remote-endpoint = <&rdacm20_out0>;
+                    };
+                };
 
-          port@3 {
-            reg = <3>;
+                port@1 {
+                    reg = <1>;
 
-            max9286_in3: endpoint {
-              remote-endpoint = <&rdacm20_out3>;
-            };
-          };
+                    max9286_in1: endpoint {
+                        remote-endpoint = <&rdacm20_out1>;
+                    };
+                };
 
-          port@4 {
-            reg = <4>;
+                port@2 {
+                    reg = <2>;
 
-            max9286_out: endpoint {
-              data-lanes = <1 2 3 4>;
-              remote-endpoint = <&csi40_in>;
-            };
-          };
-        };
+                    max9286_in2: endpoint {
+                        remote-endpoint = <&rdacm20_out2>;
+                    };
+                };
 
-        i2c-mux {
-          #address-cells = <1>;
-          #size-cells = <0>;
+                port@3 {
+                    reg = <3>;
 
-          i2c@0 {
-            #address-cells = <1>;
-            #size-cells = <0>;
-            reg = <0>;
+                    max9286_in3: endpoint {
+                        remote-endpoint = <&rdacm20_out3>;
+                    };
+                };
 
-            camera@51 {
-              compatible = "imi,rdacm20";
-              reg = <0x51>, <0x61>;
+                port@4 {
+                    reg = <4>;
 
-              port {
-                rdacm20_out0: endpoint {
-                  remote-endpoint = <&max9286_in0>;
+                    max9286_out: endpoint {
+                        data-lanes = <1 2 3 4>;
+                        remote-endpoint = <&csi40_in>;
+                    };
                 };
-              };
-
             };
-          };
-
-          i2c@1 {
-            #address-cells = <1>;
-            #size-cells = <0>;
-            reg = <1>;
 
-            camera@52 {
-              compatible = "imi,rdacm20";
-              reg = <0x52>, <0x62>;
+            i2c-mux {
+                #address-cells = <1>;
+                #size-cells = <0>;
 
-              port {
-                rdacm20_out1: endpoint {
-                  remote-endpoint = <&max9286_in1>;
-                };
-              };
-            };
-          };
+                i2c@0 {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                    reg = <0>;
 
-          i2c@2 {
-            #address-cells = <1>;
-            #size-cells = <0>;
-            reg = <2>;
+                    camera@51 {
+                        compatible = "imi,rdacm20";
+                        reg = <0x51>, <0x61>;
 
-            camera@53 {
-              compatible = "imi,rdacm20";
-              reg = <0x53>, <0x63>;
+                        port {
+                            rdacm20_out0: endpoint {
+                                remote-endpoint = <&max9286_in0>;
+                            };
+                        };
 
-              port {
-                rdacm20_out2: endpoint {
-                  remote-endpoint = <&max9286_in2>;
+                    };
                 };
-              };
-            };
-          };
 
-          i2c@3 {
-            #address-cells = <1>;
-            #size-cells = <0>;
-            reg = <3>;
+                i2c@1 {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                    reg = <1>;
+
+                    camera@52 {
+                        compatible = "imi,rdacm20";
+                        reg = <0x52>, <0x62>;
+
+                        port {
+                            rdacm20_out1: endpoint {
+                                remote-endpoint = <&max9286_in1>;
+                            };
+                        };
+                    };
+                };
 
-            camera@54 {
-              compatible = "imi,rdacm20";
-              reg = <0x54>, <0x64>;
+                i2c@2 {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                    reg = <2>;
+
+                    camera@53 {
+                        compatible = "imi,rdacm20";
+                        reg = <0x53>, <0x63>;
+
+                        port {
+                            rdacm20_out2: endpoint {
+                                remote-endpoint = <&max9286_in2>;
+                            };
+                        };
+                    };
+                };
 
-              port {
-                rdacm20_out3: endpoint {
-                  remote-endpoint = <&max9286_in3>;
+                i2c@3 {
+                    #address-cells = <1>;
+                    #size-cells = <0>;
+                    reg = <3>;
+
+                    camera@54 {
+                        compatible = "imi,rdacm20";
+                        reg = <0x54>, <0x64>;
+
+                        port {
+                            rdacm20_out3: endpoint {
+                                remote-endpoint = <&max9286_in3>;
+                            };
+                        };
+                    };
                 };
-              };
             };
-          };
         };
-      };
     };
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v8 2/7] dt-bindings: media: max9286: Define 'maxim,gpio-poc'
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
  2021-12-16 16:34 ` [PATCH v8 1/7] dt-bindings: media: max9286: Re-indent example Jacopo Mondi
@ 2021-12-16 16:34 ` Jacopo Mondi
  2022-01-17 11:57   ` Kieran Bingham
  2021-12-16 16:34 ` [PATCH v8 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property Jacopo Mondi
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree, Rob Herring

Define a new vendor property in the maxim,max9286 binding schema.

The new property allows to declare that the remote camera
power-over-coax is controlled by one of the MAX9286 gpio lines.

As it is currently not possible to establish a regulator as consumer
of the MAX9286 gpio controller for this purpose, the property allows to
declare that the camera power is controlled by the MAX9286 directly.

The property accepts a gpio-index (0 or 1) and one line polarity
flag as defined by dt-bindings/gpio/gpio.h.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 .../bindings/media/i2c/maxim,max9286.yaml     | 67 ++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
index ab4e7a620362..90315e217003 100644
--- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
@@ -70,6 +70,28 @@ properties:
       a remote serializer whose high-threshold noise immunity is not enabled
       is 100000 micro volts
 
+  maxim,gpio-poc:
+    $ref: '/schemas/types.yaml#/definitions/uint32-array'
+    minItems: 2
+    maxItems: 2
+    description: |
+      Index of the MAX9286 gpio output line (0 or 1) that controls Power over
+      Coax to the cameras and its associated polarity flag.
+
+      The property accepts an array of two unsigned integers, the first being
+      the gpio line index (0 or 1) and the second being the gpio line polarity
+      flag (GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW) as defined in
+      <include/dt-bindings/gpio/gpio.h>.
+
+      When the remote cameras power is controlled by one of the MAX9286 gpio
+      lines, this property has to be used to specify which line among the two
+      available ones controls the remote camera power enablement.
+
+      When this property is used it is not possible to register a gpio
+      controller as the gpio lines are controlled directly by the MAX9286 and
+      not available for consumers, nor the 'poc-supply' property should be
+      specified.
+
   ports:
     $ref: /schemas/graph.yaml#/properties/ports
 
@@ -165,7 +187,16 @@ required:
   - reg
   - ports
   - i2c-mux
-  - gpio-controller
+
+# If 'maxim,gpio-poc' is present, then 'poc-supply' and 'gpio-controller'
+# are not allowed.
+if:
+  required:
+    - maxim,gpio-poc
+then:
+  properties:
+    poc-supply: false
+    gpio-controller: false
 
 additionalProperties: false
 
@@ -310,4 +341,38 @@ examples:
                 };
             };
         };
+
+        /*
+        * Example of a deserializer that controls the camera Power over Coax
+        * through one of its gpio lines.
+        */
+        gmsl-deserializer@6c {
+            compatible = "maxim,max9286";
+            reg = <0x6c>;
+            enable-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+
+            /*
+            * The remote camera power is controlled by MAX9286 GPIO line #0.
+            * No 'poc-supply' nor 'gpio-controller' are specified.
+            */
+            maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
+
+            /*
+            * Do not describe connections as they're the same as in the previous
+            * example.
+            */
+            ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@4 {
+                    reg = <4>;
+                };
+            };
+
+            i2c-mux {
+                #address-cells = <1>;
+                #size-cells = <0>;
+            };
+        };
     };
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v8 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
  2021-12-16 16:34 ` [PATCH v8 1/7] dt-bindings: media: max9286: Re-indent example Jacopo Mondi
  2021-12-16 16:34 ` [PATCH v8 2/7] dt-bindings: media: max9286: Define 'maxim,gpio-poc' Jacopo Mondi
@ 2021-12-16 16:34 ` Jacopo Mondi
  2021-12-16 16:34 ` [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286 Jacopo Mondi
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

The 'maxim,gpio-poc' property is used when the remote camera
power-over-coax is controlled by one of the MAX9286 gpio lines,
to instruct the driver about which line to use and what the line
polarity is.

Add to the max9286 driver support for parsing the newly introduced
property and use it if available in place of the usual supply, as it is
not possible to establish one as consumer of the max9286 gpio
controller.

If the new property is present, no gpio controller is registered and
'poc-supply' is ignored.

In order to maximize code re-use, break out the max9286 gpio handling
function so that they can be used by the gpio controller through the
gpio-consumer API, or directly by the driver code.

Wrap the power up and power down routines to their own function to
be able to use either the gpio line directly or the supply. This will
make it easier to control the remote camera power at run time.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/i2c/max9286.c | 124 ++++++++++++++++++++++++++----------
 1 file changed, 92 insertions(+), 32 deletions(-)

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 7c663fd587bb..e9b7629fb5bc 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -15,6 +15,7 @@
 #include <linux/fwnode.h>
 #include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
+#include <linux/gpio/machine.h>
 #include <linux/i2c.h>
 #include <linux/i2c-mux.h>
 #include <linux/module.h>
@@ -168,6 +169,8 @@ struct max9286_priv {
 	u32 init_rev_chan_mv;
 	u32 rev_chan_mv;
 
+	u32 gpio_poc[2];
+
 	struct v4l2_ctrl_handler ctrls;
 	struct v4l2_ctrl *pixelrate;
 
@@ -1025,20 +1028,27 @@ static int max9286_setup(struct max9286_priv *priv)
 	return 0;
 }
 
-static void max9286_gpio_set(struct gpio_chip *chip,
-			     unsigned int offset, int value)
+static int max9286_gpio_set(struct max9286_priv *priv, unsigned int offset,
+			    int value)
 {
-	struct max9286_priv *priv = gpiochip_get_data(chip);
-
 	if (value)
 		priv->gpio_state |= BIT(offset);
 	else
 		priv->gpio_state &= ~BIT(offset);
 
-	max9286_write(priv, 0x0f, MAX9286_0X0F_RESERVED | priv->gpio_state);
+	return max9286_write(priv, 0x0f,
+			     MAX9286_0X0F_RESERVED | priv->gpio_state);
 }
 
-static int max9286_gpio_get(struct gpio_chip *chip, unsigned int offset)
+static void max9286_gpiochip_set(struct gpio_chip *chip,
+				 unsigned int offset, int value)
+{
+	struct max9286_priv *priv = gpiochip_get_data(chip);
+
+	max9286_gpio_set(priv, offset, value);
+}
+
+static int max9286_gpiochip_get(struct gpio_chip *chip, unsigned int offset)
 {
 	struct max9286_priv *priv = gpiochip_get_data(chip);
 
@@ -1058,13 +1068,10 @@ static int max9286_register_gpio(struct max9286_priv *priv)
 	gpio->of_node = dev->of_node;
 	gpio->ngpio = 2;
 	gpio->base = -1;
-	gpio->set = max9286_gpio_set;
-	gpio->get = max9286_gpio_get;
+	gpio->set = max9286_gpiochip_set;
+	gpio->get = max9286_gpiochip_get;
 	gpio->can_sleep = true;
 
-	/* GPIO values default to high */
-	priv->gpio_state = BIT(0) | BIT(1);
-
 	ret = devm_gpiochip_add_data(dev, gpio, priv);
 	if (ret)
 		dev_err(dev, "Unable to create gpio_chip\n");
@@ -1072,6 +1079,72 @@ static int max9286_register_gpio(struct max9286_priv *priv)
 	return ret;
 }
 
+static int max9286_parse_gpios(struct max9286_priv *priv)
+{
+	struct device *dev = &priv->client->dev;
+	int ret;
+
+	/* GPIO values default to high */
+	priv->gpio_state = BIT(0) | BIT(1);
+
+	/*
+	 * Parse the "gpio-poc" vendor property. If the property is not
+	 * specified the camera power is controlled by a regulator.
+	 */
+	ret = of_property_read_u32_array(dev->of_node, "maxim,gpio-poc",
+					 priv->gpio_poc, 2);
+	if (ret == -EINVAL) {
+		/*
+		 * If gpio lines are not used for the camera power, register
+		 * a gpio controller for consumers.
+		 */
+		ret = max9286_register_gpio(priv);
+		if (ret)
+			return ret;
+
+		priv->regulator = devm_regulator_get(dev, "poc");
+		if (IS_ERR(priv->regulator)) {
+			if (PTR_ERR(priv->regulator) != -EPROBE_DEFER)
+				dev_err(dev,
+					"Unable to get PoC regulator (%ld)\n",
+					PTR_ERR(priv->regulator));
+			return PTR_ERR(priv->regulator);
+		}
+
+		return 0;
+	}
+
+	/* If the property is specified make sure it is well formed. */
+	if (ret || priv->gpio_poc[0] > 1 ||
+	    (priv->gpio_poc[1] != GPIO_ACTIVE_HIGH &&
+	     priv->gpio_poc[1] != GPIO_ACTIVE_LOW)) {
+		dev_err(dev, "Invalid 'gpio-poc' property\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int max9286_poc_enable(struct max9286_priv *priv, bool enable)
+{
+	int ret;
+
+	/* If the regulator is not available, use gpio to control power. */
+	if (!priv->regulator)
+		ret = max9286_gpio_set(priv, priv->gpio_poc[0],
+				       enable ^ priv->gpio_poc[1]);
+	else if (enable)
+		ret = regulator_enable(priv->regulator);
+	else
+		ret = regulator_disable(priv->regulator);
+
+	if (ret < 0)
+		dev_err(&priv->client->dev, "Unable to turn power %s\n",
+			enable ? "on" : "off");
+
+	return ret;
+}
+
 static int max9286_init(struct device *dev)
 {
 	struct max9286_priv *priv;
@@ -1081,17 +1154,14 @@ static int max9286_init(struct device *dev)
 	client = to_i2c_client(dev);
 	priv = i2c_get_clientdata(client);
 
-	/* Enable the bus power. */
-	ret = regulator_enable(priv->regulator);
-	if (ret < 0) {
-		dev_err(&client->dev, "Unable to turn PoC on\n");
+	ret = max9286_poc_enable(priv, true);
+	if (ret)
 		return ret;
-	}
 
 	ret = max9286_setup(priv);
 	if (ret) {
 		dev_err(dev, "Unable to setup max9286\n");
-		goto err_regulator;
+		goto err_poc_disable;
 	}
 
 	/*
@@ -1101,7 +1171,7 @@ static int max9286_init(struct device *dev)
 	ret = max9286_v4l2_register(priv);
 	if (ret) {
 		dev_err(dev, "Failed to register with V4L2\n");
-		goto err_regulator;
+		goto err_poc_disable;
 	}
 
 	ret = max9286_i2c_mux_init(priv);
@@ -1117,8 +1187,8 @@ static int max9286_init(struct device *dev)
 
 err_v4l2_register:
 	max9286_v4l2_unregister(priv);
-err_regulator:
-	regulator_disable(priv->regulator);
+err_poc_disable:
+	max9286_poc_enable(priv, false);
 
 	return ret;
 }
@@ -1289,20 +1359,10 @@ static int max9286_probe(struct i2c_client *client)
 	 */
 	max9286_configure_i2c(priv, false);
 
-	ret = max9286_register_gpio(priv);
+	ret = max9286_parse_gpios(priv);
 	if (ret)
 		goto err_powerdown;
 
-	priv->regulator = devm_regulator_get(&client->dev, "poc");
-	if (IS_ERR(priv->regulator)) {
-		if (PTR_ERR(priv->regulator) != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Unable to get PoC regulator (%ld)\n",
-				PTR_ERR(priv->regulator));
-		ret = PTR_ERR(priv->regulator);
-		goto err_powerdown;
-	}
-
 	ret = max9286_parse_dt(priv);
 	if (ret)
 		goto err_powerdown;
@@ -1329,7 +1389,7 @@ static int max9286_remove(struct i2c_client *client)
 
 	max9286_v4l2_unregister(priv);
 
-	regulator_disable(priv->regulator);
+	max9286_poc_enable(priv, false);
 
 	gpiod_set_value_cansleep(priv->gpiod_pwdn, 0);
 
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
                   ` (2 preceding siblings ...)
  2021-12-16 16:34 ` [PATCH v8 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property Jacopo Mondi
@ 2021-12-16 16:34 ` Jacopo Mondi
  2022-01-17 12:09   ` Kieran Bingham
  2022-01-20  9:14   ` Geert Uytterhoeven
  2021-12-16 16:34 ` [PATCH v8 5/7] arm64: dts: renesas: eagle: " Jacopo Mondi
                   ` (3 subsequent siblings)
  7 siblings, 2 replies; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

Enable the MAX9286 GMSL deserializers on Condor-V3H board.

Connected cameras should be defined in a device-tree overlay or included
after these definitions.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 .../boot/dts/renesas/r8a77980-condor.dts      | 193 ++++++++++++++++++
 1 file changed, 193 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
index 3d6d10c82f48..2eb2b852ddca 100644
--- a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
@@ -6,6 +6,8 @@
  * Copyright (C) 2018 Cogent Embedded, Inc.
  */
 
+#include <dt-bindings/gpio/gpio.h>
+
 /dts-v1/;
 #include "r8a77980.dtsi"
 #include <dt-bindings/gpio/gpio.h>
@@ -108,6 +110,34 @@ channel0 {
 	};
 };
 
+&csi40 {
+	status = "okay";
+
+	ports {
+		port@0 {
+			csi40_in: endpoint {
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&max9286_out0>;
+			};
+		};
+	};
+};
+
+&csi41 {
+	status = "okay";
+
+	ports {
+		port@0 {
+			csi41_in: endpoint {
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&max9286_out1>;
+			};
+		};
+	};
+};
+
 &du {
 	clocks = <&cpg CPG_MOD 724>,
 		 <&x1_clk>;
@@ -200,6 +230,164 @@ adv7511_out: endpoint {
 	};
 };
 
+&i2c1 {
+	pinctrl-0 = <&i2c1_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+	clock-frequency = <400000>;
+
+	gmsl0: gmsl-deserializer@48 {
+		compatible = "maxim,max9286";
+		reg = <0x48>;
+
+		maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
+		enable-gpios = <&io_expander0 0 GPIO_ACTIVE_HIGH>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+			};
+
+			port@1 {
+				reg = <1>;
+			};
+
+			port@2 {
+				reg = <2>;
+			};
+
+			port@3 {
+				reg = <3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				max9286_out0: endpoint {
+					clock-lanes = <0>;
+					data-lanes = <1 2 3 4>;
+					remote-endpoint = <&csi40_in>;
+				};
+			};
+		};
+
+		i2c-mux {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			i2c@0 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0>;
+
+				status = "disabled";
+			};
+
+			i2c@1 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <1>;
+
+				status = "disabled";
+			};
+
+			i2c@2 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <2>;
+
+				status = "disabled";
+			};
+
+			i2c@3 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <3>;
+
+				status = "disabled";
+			};
+		};
+	};
+
+	gmsl1: gmsl-deserializer@4a {
+		compatible = "maxim,max9286";
+		reg = <0x4a>;
+
+		maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
+		enable-gpios = <&io_expander1 0 GPIO_ACTIVE_HIGH>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+			};
+
+			port@1 {
+				reg = <1>;
+			};
+
+			port@2 {
+				reg = <2>;
+			};
+
+			port@3 {
+				reg = <3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				max9286_out1: endpoint {
+					clock-lanes = <0>;
+					data-lanes = <1 2 3 4>;
+					remote-endpoint = <&csi41_in>;
+				};
+			};
+		};
+
+		i2c-mux {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			i2c@0 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0>;
+
+				status = "disabled";
+			};
+
+			i2c@1 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <1>;
+
+				status = "disabled";
+			};
+
+			i2c@2 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <2>;
+
+				status = "disabled";
+			};
+
+			i2c@3 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <3>;
+
+				status = "disabled";
+			};
+		};
+	};
+};
+
 &lvds0 {
 	status = "okay";
 
@@ -256,6 +444,11 @@ i2c0_pins: i2c0 {
 		function = "i2c0";
 	};
 
+	i2c1_pins: i2c1 {
+		groups = "i2c1";
+		function = "i2c1";
+	};
+
 	mmc_pins: mmc {
 		groups = "mmc_data8", "mmc_ctrl", "mmc_ds";
 		function = "mmc";
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v8 5/7] arm64: dts: renesas: eagle: Enable MAX9286
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
                   ` (3 preceding siblings ...)
  2021-12-16 16:34 ` [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286 Jacopo Mondi
@ 2021-12-16 16:34 ` Jacopo Mondi
  2022-01-17 12:00   ` Kieran Bingham
  2022-01-20  9:22   ` Geert Uytterhoeven
  2021-12-16 16:34 ` [PATCH v8 6/7] arm64: dts: renesas: Add GMSL cameras .dtsi Jacopo Mondi
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

From: Kieran Bingham <kieran.bingham@ideasonboard.com>

Enable the MAX9286 GMSL deserializer on the Eagle-V3M board.

Connected cameras should be defined in a device-tree overlay or included
after these definitions.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 .../arm64/boot/dts/renesas/r8a77970-eagle.dts | 104 ++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
index b579d3189a93..91b9fab6afbc 100644
--- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
@@ -6,6 +6,8 @@
  * Copyright (C) 2017 Cogent Embedded, Inc.
  */
 
+#include <dt-bindings/gpio/gpio.h>
+
 /dts-v1/;
 #include "r8a77970.dtsi"
 #include <dt-bindings/gpio/gpio.h>
@@ -200,6 +202,11 @@ i2c0_pins: i2c0 {
 		function = "i2c0";
 	};
 
+	i2c3_pins: i2c3 {
+		groups = "i2c3_a";
+		function = "i2c3";
+	};
+
 	qspi0_pins: qspi0 {
 		groups = "qspi0_ctrl", "qspi0_data4";
 		function = "qspi0";
@@ -278,6 +285,103 @@ &rwdt {
 	status = "okay";
 };
 
+&csi40 {
+	status = "okay";
+
+	ports {
+		port@0 {
+			csi40_in: endpoint {
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&max9286_out0>;
+			};
+		};
+	};
+};
+
+&i2c3 {
+	pinctrl-0 = <&i2c3_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+	clock-frequency = <400000>;
+
+	gmsl0: gmsl-deserializer@48 {
+		compatible = "maxim,max9286";
+		reg = <0x48>;
+
+		maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
+		enable-gpios = <&io_expander 0 GPIO_ACTIVE_HIGH>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+			};
+
+			port@1 {
+				reg = <1>;
+			};
+
+			port@2 {
+				reg = <2>;
+			};
+
+			port@3 {
+				reg = <3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				max9286_out0: endpoint {
+					clock-lanes = <0>;
+					data-lanes = <1 2 3 4>;
+					remote-endpoint = <&csi40_in>;
+				};
+			};
+		};
+
+		i2c-mux {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			i2c@0 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <0>;
+
+				status = "disabled";
+			};
+
+			i2c@1 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <1>;
+
+				status = "disabled";
+			};
+
+			i2c@2 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <2>;
+
+				status = "disabled";
+			};
+
+			i2c@3 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				reg = <3>;
+
+				status = "disabled";
+			};
+		};
+	};
+};
+
 &scif0 {
 	pinctrl-0 = <&scif0_pins>;
 	pinctrl-names = "default";
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v8 6/7] arm64: dts: renesas: Add GMSL cameras .dtsi
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
                   ` (4 preceding siblings ...)
  2021-12-16 16:34 ` [PATCH v8 5/7] arm64: dts: renesas: eagle: " Jacopo Mondi
@ 2021-12-16 16:34 ` Jacopo Mondi
  2022-01-20  9:24   ` Geert Uytterhoeven
  2021-12-16 16:34 ` [PATCH v8 7/7] DNI: arm64: dts: renesas: eagle: Include eagle-gmsl Jacopo Mondi
  2021-12-17 14:30 ` [v8.1 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property Jacopo Mondi
  7 siblings, 1 reply; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

From: Kieran Bingham <kieran.bingham@ideasonboard.com>

Describe the FAKRA connector available on Eagle and Condor boards that
allow to connect GMSL camera modules such as IMI RDACM20 and RDACM21.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi | 332 ++++++++++++++++++
 1 file changed, 332 insertions(+)
 create mode 100644 arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi

diff --git a/arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi b/arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi
new file mode 100644
index 000000000000..d45f072f8cdf
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/gmsl-cameras.dtsi
@@ -0,0 +1,332 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2017 Ideas on Board <kieran.bingham@ideasonboard.com>
+ * Copyright (C) 2021 Jacopo Mondi <jacopo+renesas@jmondi.org>
+ *
+ * Device Tree Source (overlay) that describes GMSL camera connected to
+ * Fakra connectors for the Eagle V3M and Condor V3H (and compatible) boards.
+ *
+ * The following cameras are currently supported: RDACM20 and RDACM21.
+ *
+ * The board .dts file that include this has to select which cameras are in use
+ * by specifying the camera model with:
+ *
+ * #define GMSL_CAMERA_RDACM20
+ * or
+ * #define GMSL_CAMERA_RDACM21
+ *
+ * And which cameras are connected to the board by defining:
+ * for GMSL channel 0:
+ *	   #define GMSL_CAMERA_0
+ *	   #define GMSL_CAMERA_1
+ *	   #define GMSL_CAMERA_2
+ *	   #define GMSL_CAMERA_3
+ *
+ * for GMSL channel 1:
+ *	   #define GMSL_CAMERA_4
+ *	   #define GMSL_CAMERA_5
+ *	   #define GMSL_CAMERA_6
+ *	   #define GMSL_CAMERA_7
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+
+/* Validate the board file settings. */
+#if !defined(GMSL_CAMERA_RDACM20) && !defined(GMSL_CAMERA_RDACM21)
+#error "Camera model should be defined by the board file"
+#endif
+
+#if defined(GMSL_CAMERA_RDACM20) && defined(GMSL_CAMERA_RDACM21)
+#error "A single camera model should be selected"
+#endif
+
+#if !defined(GMSL_CAMERA_0) && !defined(GMSL_CAMERA_1) && \
+    !defined(GMSL_CAMERA_2) && !defined(GMSL_CAMERA_3) && \
+    !defined(GMSL_CAMERA_4) && !defined(GMSL_CAMERA_5) && \
+    !defined(GMSL_CAMERA_6) && !defined(GMSL_CAMERA_7)
+#error "At least one camera should be selected"
+#endif
+
+/* Deduce from the enabled cameras which GMSL channels are active. */
+#if defined(GMSL_CAMERA_0) || defined(GMSL_CAMERA_1) || \
+    defined(GMSL_CAMERA_2) || defined(GMSL_CAMERA_3)
+#define GMSL_0
+#endif
+
+#if defined(GMSL_CAMERA_4) || defined(GMSL_CAMERA_5) || \
+    defined(GMSL_CAMERA_6) || defined(GMSL_CAMERA_7)
+#define GMSL_1
+#endif
+
+/* Deduce the camera model compatible string. */
+#if defined(GMSL_CAMERA_RDACM20)
+#define GMSL_CAMERA_MODEL "imi,rdacm20"
+#elif defined(GMSL_CAMERA_RDACM21)
+#define GMSL_CAMERA_MODEL "imi,rdacm21"
+#endif
+
+#ifdef GMSL_0
+&vin0 {
+	status = "okay";
+};
+
+&vin1 {
+	status = "okay";
+};
+
+&vin2 {
+	status = "okay";
+};
+
+&vin3 {
+	status = "okay";
+};
+
+&gmsl0 {
+	status = "okay";
+
+#if defined(GMSL_CAMERA_RDACM21)
+	maxim,reverse-channel-microvolt = <100000>;
+#endif
+
+	ports {
+#ifdef GMSL_CAMERA_0
+		port@0 {
+			max9286_in0: endpoint {
+				remote-endpoint = <&fakra_con0>;
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_1
+		port@1 {
+			max9286_in1: endpoint{
+				remote-endpoint = <&fakra_con1>;
+			};
+
+		};
+#endif
+
+#ifdef GMSL_CAMERA_2
+		port@2 {
+			max9286_in2: endpoint {
+				remote-endpoint = <&fakra_con2>;
+			};
+
+		};
+#endif
+
+#ifdef GMSL_CAMERA_3
+		port@3 {
+			max9286_in3: endpoint {
+				remote-endpoint = <&fakra_con3>;
+			};
+
+		};
+#endif
+	};
+
+	i2c-mux {
+#ifdef GMSL_CAMERA_0
+		i2c@0 {
+			status = "okay";
+
+			camera@51 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x51>, <0x61>;
+
+				port {
+					fakra_con0: endpoint {
+						remote-endpoint = <&max9286_in0>;
+					};
+				};
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_1
+		i2c@1 {
+			status = "okay";
+
+			camera@52 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x52>, <0x62>;
+
+				port {
+					fakra_con1: endpoint {
+						remote-endpoint = <&max9286_in1>;
+					};
+				};
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_2
+		i2c@2 {
+			status = "okay";
+
+			camera@53 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x53>, <0x63>;
+
+				port {
+					fakra_con2: endpoint {
+						remote-endpoint = <&max9286_in2>;
+					};
+				};
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_3
+		i2c@3 {
+			status = "okay";
+
+			camera@54 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x54>, <0x64>;
+
+				port {
+					fakra_con3: endpoint {
+						remote-endpoint = <&max9286_in3>;
+					};
+				};
+			};
+		};
+#endif
+	};
+};
+#endif /* ifdef GMSL_0 */
+
+#ifdef GMSL_1
+&vin4 {
+	status = "okay";
+};
+
+&vin5 {
+	status = "okay";
+};
+
+&vin6 {
+	status = "okay";
+};
+
+&vin7 {
+	status = "okay";
+};
+
+&gmsl1 {
+	status = "okay";
+
+#if defined(GMSL_CAMERA_RDACM21)
+	maxim,reverse-channel-microvolt = <100000>;
+#endif
+
+	ports {
+#ifdef GMSL_CAMERA_4
+		port@0 {
+			max9286_in4: endpoint {
+				remote-endpoint = <&fakra_con4>;
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_5
+		port@1 {
+			max9286_in5: endpoint{
+				remote-endpoint = <&fakra_con5>;
+			};
+
+		};
+#endif
+
+#ifdef GMSL_CAMERA_6
+		port@2 {
+			max9286_in6: endpoint {
+				remote-endpoint = <&fakra_con6>;
+			};
+
+		};
+#endif
+
+#ifdef GMSL_CAMERA_7
+		port@3 {
+			max9286_in7: endpoint {
+				remote-endpoint = <&fakra_con7>;
+			};
+
+		};
+#endif
+	};
+
+	i2c-mux {
+#ifdef GMSL_CAMERA_4
+		i2c@0 {
+			status = "okay";
+
+			camera@55 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x55>, <0x65>;
+
+				port {
+					fakra_con4: endpoint {
+						remote-endpoint = <&max9286_in4>;
+					};
+				};
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_5
+		i2c@1 {
+			status = "okay";
+
+			camera@56 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x56>, <0x66>;
+
+				port {
+					fakra_con5: endpoint {
+						remote-endpoint = <&max9286_in5>;
+					};
+				};
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_6
+		i2c@2 {
+			status = "okay";
+
+			camera@57 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x57>, <0x67>;
+
+				port {
+					fakra_con6: endpoint {
+						remote-endpoint = <&max9286_in6>;
+					};
+				};
+			};
+		};
+#endif
+
+#ifdef GMSL_CAMERA_7
+		i2c@3 {
+			status = "okay";
+
+			camera@58 {
+				compatible = GMSL_CAMERA_MODEL;
+				reg = <0x58>, <0x68>;
+
+				port {
+					fakra_con7: endpoint {
+						remote-endpoint = <&max9286_in7>;
+					};
+				};
+			};
+		};
+#endif
+	};
+};
+#endif /* ifdef GMSL_1 */
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v8 7/7] DNI: arm64: dts: renesas: eagle: Include eagle-gmsl
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
                   ` (5 preceding siblings ...)
  2021-12-16 16:34 ` [PATCH v8 6/7] arm64: dts: renesas: Add GMSL cameras .dtsi Jacopo Mondi
@ 2021-12-16 16:34 ` Jacopo Mondi
  2021-12-17 14:30 ` [v8.1 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property Jacopo Mondi
  7 siblings, 0 replies; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-16 16:34 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

From: Kieran Bingham <kieran.bingham@ideasonboard.com>

Include the eagle-gmsl.dtsi to enable GMSL camera support on the
Eagle-V3M platform.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 arch/arm64/boot/dts/renesas/r8a77970-eagle.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
index 91b9fab6afbc..288828d4007e 100644
--- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
@@ -388,3 +388,11 @@ &scif0 {
 
 	status = "okay";
 };
+
+/* FAKRA Overlay */
+#define GMSL_CAMERA_RDACM20
+#define GMSL_CAMERA_0
+#define GMSL_CAMERA_1
+#define GMSL_CAMERA_2
+#define GMSL_CAMERA_3
+#include "gmsl-cameras.dtsi"
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [v8.1 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property
  2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
                   ` (6 preceding siblings ...)
  2021-12-16 16:34 ` [PATCH v8 7/7] DNI: arm64: dts: renesas: eagle: Include eagle-gmsl Jacopo Mondi
@ 2021-12-17 14:30 ` Jacopo Mondi
  7 siblings, 0 replies; 16+ messages in thread
From: Jacopo Mondi @ 2021-12-17 14:30 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Laurent Pinchart,
	Kieran Bingham, Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

The 'maxim,gpio-poc' property is used when the remote camera
power-over-coax is controlled by one of the MAX9286 gpio lines,
to instruct the driver about which line to use and what the line
polarity is.

Add to the max9286 driver support for parsing the newly introduced
property and use it if available in place of the usual supply, as it is
not possible to establish one as consumer of the max9286 gpio
controller.

If the new property is present, no gpio controller is registered and
'poc-supply' is ignored.

In order to maximize code re-use, break out the max9286 gpio handling
function so that they can be used by the gpio controller through the
gpio-consumer API, or directly by the driver code.

Wrap the power up and power down routines to their own function to
be able to use either the gpio line directly or the supply. This will
make it easier to control the remote camera power at run time.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---

Changes from v8:
- Use dev_err_probe() instead of open coding it

---
 drivers/media/i2c/max9286.c | 122 ++++++++++++++++++++++++++----------
 1 file changed, 90 insertions(+), 32 deletions(-)

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 18d38db9864c..f06ec0b0a8a8 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -15,6 +15,7 @@
 #include <linux/fwnode.h>
 #include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
+#include <linux/gpio/machine.h>
 #include <linux/i2c.h>
 #include <linux/i2c-mux.h>
 #include <linux/module.h>
@@ -168,6 +169,8 @@ struct max9286_priv {
 	u32 init_rev_chan_mv;
 	u32 rev_chan_mv;

+	u32 gpio_poc[2];
+
 	struct v4l2_ctrl_handler ctrls;
 	struct v4l2_ctrl *pixelrate;

@@ -1041,20 +1044,27 @@ static int max9286_setup(struct max9286_priv *priv)
 	return 0;
 }

-static void max9286_gpio_set(struct gpio_chip *chip,
-			     unsigned int offset, int value)
+static int max9286_gpio_set(struct max9286_priv *priv, unsigned int offset,
+			    int value)
 {
-	struct max9286_priv *priv = gpiochip_get_data(chip);
-
 	if (value)
 		priv->gpio_state |= BIT(offset);
 	else
 		priv->gpio_state &= ~BIT(offset);

-	max9286_write(priv, 0x0f, MAX9286_0X0F_RESERVED | priv->gpio_state);
+	return max9286_write(priv, 0x0f,
+			     MAX9286_0X0F_RESERVED | priv->gpio_state);
 }

-static int max9286_gpio_get(struct gpio_chip *chip, unsigned int offset)
+static void max9286_gpiochip_set(struct gpio_chip *chip,
+				 unsigned int offset, int value)
+{
+	struct max9286_priv *priv = gpiochip_get_data(chip);
+
+	max9286_gpio_set(priv, offset, value);
+}
+
+static int max9286_gpiochip_get(struct gpio_chip *chip, unsigned int offset)
 {
 	struct max9286_priv *priv = gpiochip_get_data(chip);

@@ -1074,13 +1084,10 @@ static int max9286_register_gpio(struct max9286_priv *priv)
 	gpio->of_node = dev->of_node;
 	gpio->ngpio = 2;
 	gpio->base = -1;
-	gpio->set = max9286_gpio_set;
-	gpio->get = max9286_gpio_get;
+	gpio->set = max9286_gpiochip_set;
+	gpio->get = max9286_gpiochip_get;
 	gpio->can_sleep = true;

-	/* GPIO values default to high */
-	priv->gpio_state = BIT(0) | BIT(1);
-
 	ret = devm_gpiochip_add_data(dev, gpio, priv);
 	if (ret)
 		dev_err(dev, "Unable to create gpio_chip\n");
@@ -1088,6 +1095,70 @@ static int max9286_register_gpio(struct max9286_priv *priv)
 	return ret;
 }

+static int max9286_parse_gpios(struct max9286_priv *priv)
+{
+	struct device *dev = &priv->client->dev;
+	int ret;
+
+	/* GPIO values default to high */
+	priv->gpio_state = BIT(0) | BIT(1);
+
+	/*
+	 * Parse the "gpio-poc" vendor property. If the property is not
+	 * specified the camera power is controlled by a regulator.
+	 */
+	ret = of_property_read_u32_array(dev->of_node, "maxim,gpio-poc",
+					 priv->gpio_poc, 2);
+	if (ret == -EINVAL) {
+		/*
+		 * If gpio lines are not used for the camera power, register
+		 * a gpio controller for consumers.
+		 */
+		ret = max9286_register_gpio(priv);
+		if (ret)
+			return ret;
+
+		priv->regulator = devm_regulator_get(dev, "poc");
+		if (IS_ERR(priv->regulator)) {
+			return dev_err_probe(dev, PTR_ERR(priv->regulator),
+					     "Unable to get PoC regulator (%ld)\n",
+					     PTR_ERR(priv->regulator));
+		}
+
+		return 0;
+	}
+
+	/* If the property is specified make sure it is well formed. */
+	if (ret || priv->gpio_poc[0] > 1 ||
+	    (priv->gpio_poc[1] != GPIO_ACTIVE_HIGH &&
+	     priv->gpio_poc[1] != GPIO_ACTIVE_LOW)) {
+		dev_err(dev, "Invalid 'gpio-poc' property\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int max9286_poc_enable(struct max9286_priv *priv, bool enable)
+{
+	int ret;
+
+	/* If the regulator is not available, use gpio to control power. */
+	if (!priv->regulator)
+		ret = max9286_gpio_set(priv, priv->gpio_poc[0],
+				       enable ^ priv->gpio_poc[1]);
+	else if (enable)
+		ret = regulator_enable(priv->regulator);
+	else
+		ret = regulator_disable(priv->regulator);
+
+	if (ret < 0)
+		dev_err(&priv->client->dev, "Unable to turn power %s\n",
+			enable ? "on" : "off");
+
+	return ret;
+}
+
 static int max9286_init(struct device *dev)
 {
 	struct max9286_priv *priv;
@@ -1097,17 +1168,14 @@ static int max9286_init(struct device *dev)
 	client = to_i2c_client(dev);
 	priv = i2c_get_clientdata(client);

-	/* Enable the bus power. */
-	ret = regulator_enable(priv->regulator);
-	if (ret < 0) {
-		dev_err(&client->dev, "Unable to turn PoC on\n");
+	ret = max9286_poc_enable(priv, true);
+	if (ret)
 		return ret;
-	}

 	ret = max9286_setup(priv);
 	if (ret) {
 		dev_err(dev, "Unable to setup max9286\n");
-		goto err_regulator;
+		goto err_poc_disable;
 	}

 	/*
@@ -1117,7 +1185,7 @@ static int max9286_init(struct device *dev)
 	ret = max9286_v4l2_register(priv);
 	if (ret) {
 		dev_err(dev, "Failed to register with V4L2\n");
-		goto err_regulator;
+		goto err_poc_disable;
 	}

 	ret = max9286_i2c_mux_init(priv);
@@ -1133,8 +1201,8 @@ static int max9286_init(struct device *dev)

 err_v4l2_register:
 	max9286_v4l2_unregister(priv);
-err_regulator:
-	regulator_disable(priv->regulator);
+err_poc_disable:
+	max9286_poc_enable(priv, false);

 	return ret;
 }
@@ -1305,20 +1373,10 @@ static int max9286_probe(struct i2c_client *client)
 	 */
 	max9286_configure_i2c(priv, false);

-	ret = max9286_register_gpio(priv);
+	ret = max9286_parse_gpios(priv);
 	if (ret)
 		goto err_powerdown;

-	priv->regulator = devm_regulator_get(&client->dev, "poc");
-	if (IS_ERR(priv->regulator)) {
-		if (PTR_ERR(priv->regulator) != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Unable to get PoC regulator (%ld)\n",
-				PTR_ERR(priv->regulator));
-		ret = PTR_ERR(priv->regulator);
-		goto err_powerdown;
-	}
-
 	ret = max9286_parse_dt(priv);
 	if (ret)
 		goto err_powerdown;
@@ -1345,7 +1403,7 @@ static int max9286_remove(struct i2c_client *client)

 	max9286_v4l2_unregister(priv);

-	regulator_disable(priv->regulator);
+	max9286_poc_enable(priv, false);

 	gpiod_set_value_cansleep(priv->gpiod_pwdn, 0);

--
2.33.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v8 2/7] dt-bindings: media: max9286: Define 'maxim,gpio-poc'
  2021-12-16 16:34 ` [PATCH v8 2/7] dt-bindings: media: max9286: Define 'maxim,gpio-poc' Jacopo Mondi
@ 2022-01-17 11:57   ` Kieran Bingham
  0 siblings, 0 replies; 16+ messages in thread
From: Kieran Bingham @ 2022-01-17 11:57 UTC (permalink / raw)
  To: Geert Uytterhoeven, Jacopo Mondi, Laurent Pinchart, Magnus Damm,
	Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree, Rob Herring

Hi Jacopo,

Quoting Jacopo Mondi (2021-12-16 16:34:34)
> Define a new vendor property in the maxim,max9286 binding schema.
> 
> The new property allows to declare that the remote camera
> power-over-coax is controlled by one of the MAX9286 gpio lines.
> 
> As it is currently not possible to establish a regulator as consumer
> of the MAX9286 gpio controller for this purpose, the property allows to
> declare that the camera power is controlled by the MAX9286 directly.
> 
> The property accepts a gpio-index (0 or 1) and one line polarity
> flag as defined by dt-bindings/gpio/gpio.h.
> 
> Reviewed-by: Rob Herring <robh@kernel.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  .../bindings/media/i2c/maxim,max9286.yaml     | 67 ++++++++++++++++++-
>  1 file changed, 66 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
> index ab4e7a620362..90315e217003 100644
> --- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
> +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml
> @@ -70,6 +70,28 @@ properties:
>        a remote serializer whose high-threshold noise immunity is not enabled
>        is 100000 micro volts
>  
> +  maxim,gpio-poc:
> +    $ref: '/schemas/types.yaml#/definitions/uint32-array'
> +    minItems: 2
> +    maxItems: 2
> +    description: |
> +      Index of the MAX9286 gpio output line (0 or 1) that controls Power over
> +      Coax to the cameras and its associated polarity flag.
> +
> +      The property accepts an array of two unsigned integers, the first being
> +      the gpio line index (0 or 1) and the second being the gpio line polarity
> +      flag (GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW) as defined in
> +      <include/dt-bindings/gpio/gpio.h>.
> +
> +      When the remote cameras power is controlled by one of the MAX9286 gpio
> +      lines, this property has to be used to specify which line among the two
> +      available ones controls the remote camera power enablement.
> +
> +      When this property is used it is not possible to register a gpio
> +      controller as the gpio lines are controlled directly by the MAX9286 and
> +      not available for consumers, nor the 'poc-supply' property should be
> +      specified.
> +
>    ports:
>      $ref: /schemas/graph.yaml#/properties/ports
>  
> @@ -165,7 +187,16 @@ required:
>    - reg
>    - ports
>    - i2c-mux
> -  - gpio-controller
> +
> +# If 'maxim,gpio-poc' is present, then 'poc-supply' and 'gpio-controller'
> +# are not allowed.
> +if:
> +  required:
> +    - maxim,gpio-poc
> +then:
> +  properties:
> +    poc-supply: false
> +    gpio-controller: false
>  
>  additionalProperties: false
>  
> @@ -310,4 +341,38 @@ examples:
>                  };
>              };
>          };
> +
> +        /*
> +        * Example of a deserializer that controls the camera Power over Coax

Indentation seems broken...

> +        * through one of its gpio lines.
> +        */
> +        gmsl-deserializer@6c {
> +            compatible = "maxim,max9286";
> +            reg = <0x6c>;
> +            enable-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
> +
> +            /*
> +            * The remote camera power is controlled by MAX9286 GPIO line #0.
> +            * No 'poc-supply' nor 'gpio-controller' are specified.
> +            */
> +            maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
> +
> +            /*
> +            * Do not describe connections as they're the same as in the previous

Here too,

This seems like a simple way to describe this without hitting the
circular dependency loops I was facing when I looked at this. I'm sorry
it took me until v8 to find this out ;-)

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> +            * example.
> +            */
> +            ports {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                port@4 {
> +                    reg = <4>;
> +                };
> +            };
> +
> +            i2c-mux {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +            };
> +        };
>      };
> -- 
> 2.33.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v8 5/7] arm64: dts: renesas: eagle: Enable MAX9286
  2021-12-16 16:34 ` [PATCH v8 5/7] arm64: dts: renesas: eagle: " Jacopo Mondi
@ 2022-01-17 12:00   ` Kieran Bingham
  2022-01-20  9:22   ` Geert Uytterhoeven
  1 sibling, 0 replies; 16+ messages in thread
From: Kieran Bingham @ 2022-01-17 12:00 UTC (permalink / raw)
  To: Geert Uytterhoeven, Jacopo Mondi, Laurent Pinchart, Magnus Damm,
	Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

Quoting Jacopo Mondi (2021-12-16 16:34:37)
> From: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Enable the MAX9286 GMSL deserializer on the Eagle-V3M board.
> 
> Connected cameras should be defined in a device-tree overlay or included
> after these definitions.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Aha, this looks like it has changed a little from what I would have
originally created, but I think it's good this way.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  .../arm64/boot/dts/renesas/r8a77970-eagle.dts | 104 ++++++++++++++++++
>  1 file changed, 104 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
> index b579d3189a93..91b9fab6afbc 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
> @@ -6,6 +6,8 @@
>   * Copyright (C) 2017 Cogent Embedded, Inc.
>   */
>  
> +#include <dt-bindings/gpio/gpio.h>
> +
>  /dts-v1/;
>  #include "r8a77970.dtsi"
>  #include <dt-bindings/gpio/gpio.h>
> @@ -200,6 +202,11 @@ i2c0_pins: i2c0 {
>                 function = "i2c0";
>         };
>  
> +       i2c3_pins: i2c3 {
> +               groups = "i2c3_a";
> +               function = "i2c3";
> +       };
> +
>         qspi0_pins: qspi0 {
>                 groups = "qspi0_ctrl", "qspi0_data4";
>                 function = "qspi0";
> @@ -278,6 +285,103 @@ &rwdt {
>         status = "okay";
>  };
>  
> +&csi40 {
> +       status = "okay";
> +
> +       ports {
> +               port@0 {
> +                       csi40_in: endpoint {
> +                               clock-lanes = <0>;
> +                               data-lanes = <1 2 3 4>;
> +                               remote-endpoint = <&max9286_out0>;
> +                       };
> +               };
> +       };
> +};
> +
> +&i2c3 {
> +       pinctrl-0 = <&i2c3_pins>;
> +       pinctrl-names = "default";
> +
> +       status = "okay";
> +       clock-frequency = <400000>;
> +
> +       gmsl0: gmsl-deserializer@48 {
> +               compatible = "maxim,max9286";
> +               reg = <0x48>;
> +
> +               maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
> +               enable-gpios = <&io_expander 0 GPIO_ACTIVE_HIGH>;
> +
> +               ports {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       port@0 {
> +                               reg = <0>;
> +                       };
> +
> +                       port@1 {
> +                               reg = <1>;
> +                       };
> +
> +                       port@2 {
> +                               reg = <2>;
> +                       };
> +
> +                       port@3 {
> +                               reg = <3>;
> +                       };
> +
> +                       port@4 {
> +                               reg = <4>;
> +                               max9286_out0: endpoint {
> +                                       clock-lanes = <0>;
> +                                       data-lanes = <1 2 3 4>;
> +                                       remote-endpoint = <&csi40_in>;
> +                               };
> +                       };
> +               };
> +
> +               i2c-mux {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       i2c@0 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <0>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@1 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <1>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@2 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <2>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@3 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <3>;
> +
> +                               status = "disabled";
> +                       };
> +               };
> +       };
> +};
> +
>  &scif0 {
>         pinctrl-0 = <&scif0_pins>;
>         pinctrl-names = "default";
> -- 
> 2.33.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286
  2021-12-16 16:34 ` [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286 Jacopo Mondi
@ 2022-01-17 12:09   ` Kieran Bingham
  2022-01-20  9:14   ` Geert Uytterhoeven
  1 sibling, 0 replies; 16+ messages in thread
From: Kieran Bingham @ 2022-01-17 12:09 UTC (permalink / raw)
  To: Geert Uytterhoeven, Jacopo Mondi, Laurent Pinchart, Magnus Damm,
	Niklas Söderlund
  Cc: Jacopo Mondi, linux-renesas-soc, linux-media, devicetree

Quoting Jacopo Mondi (2021-12-16 16:34:36)
> Enable the MAX9286 GMSL deserializers on Condor-V3H board.
> 
> Connected cameras should be defined in a device-tree overlay or included
> after these definitions.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

This looks good to me. It now enables the CSI2s, and the max9286 will
have no children. Will this create a completed media graph that simply
has no cameras connected? Or will the max9286 return a failure if there
are no devices attached.

I could look this up I guess, but I'm only curious of what potential
side effects there are of having a now successfully probed CSI2
receiver/VIN but without any cameras.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>


> ---
>  .../boot/dts/renesas/r8a77980-condor.dts      | 193 ++++++++++++++++++
>  1 file changed, 193 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
> index 3d6d10c82f48..2eb2b852ddca 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
> @@ -6,6 +6,8 @@
>   * Copyright (C) 2018 Cogent Embedded, Inc.
>   */
>  
> +#include <dt-bindings/gpio/gpio.h>
> +
>  /dts-v1/;
>  #include "r8a77980.dtsi"
>  #include <dt-bindings/gpio/gpio.h>
> @@ -108,6 +110,34 @@ channel0 {
>         };
>  };
>  
> +&csi40 {
> +       status = "okay";
> +
> +       ports {
> +               port@0 {
> +                       csi40_in: endpoint {
> +                               clock-lanes = <0>;
> +                               data-lanes = <1 2 3 4>;
> +                               remote-endpoint = <&max9286_out0>;
> +                       };
> +               };
> +       };
> +};
> +
> +&csi41 {
> +       status = "okay";
> +
> +       ports {
> +               port@0 {
> +                       csi41_in: endpoint {
> +                               clock-lanes = <0>;
> +                               data-lanes = <1 2 3 4>;
> +                               remote-endpoint = <&max9286_out1>;
> +                       };
> +               };
> +       };
> +};
> +
>  &du {
>         clocks = <&cpg CPG_MOD 724>,
>                  <&x1_clk>;
> @@ -200,6 +230,164 @@ adv7511_out: endpoint {
>         };
>  };
>  
> +&i2c1 {
> +       pinctrl-0 = <&i2c1_pins>;
> +       pinctrl-names = "default";
> +
> +       status = "okay";
> +       clock-frequency = <400000>;
> +
> +       gmsl0: gmsl-deserializer@48 {
> +               compatible = "maxim,max9286";
> +               reg = <0x48>;
> +
> +               maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
> +               enable-gpios = <&io_expander0 0 GPIO_ACTIVE_HIGH>;
> +
> +               ports {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       port@0 {
> +                               reg = <0>;
> +                       };
> +
> +                       port@1 {
> +                               reg = <1>;
> +                       };
> +
> +                       port@2 {
> +                               reg = <2>;
> +                       };
> +
> +                       port@3 {
> +                               reg = <3>;
> +                       };
> +
> +                       port@4 {
> +                               reg = <4>;
> +                               max9286_out0: endpoint {
> +                                       clock-lanes = <0>;
> +                                       data-lanes = <1 2 3 4>;
> +                                       remote-endpoint = <&csi40_in>;
> +                               };
> +                       };
> +               };
> +
> +               i2c-mux {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       i2c@0 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <0>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@1 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <1>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@2 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <2>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@3 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <3>;
> +
> +                               status = "disabled";
> +                       };
> +               };
> +       };
> +
> +       gmsl1: gmsl-deserializer@4a {
> +               compatible = "maxim,max9286";
> +               reg = <0x4a>;
> +
> +               maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
> +               enable-gpios = <&io_expander1 0 GPIO_ACTIVE_HIGH>;
> +
> +               ports {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       port@0 {
> +                               reg = <0>;
> +                       };
> +
> +                       port@1 {
> +                               reg = <1>;
> +                       };
> +
> +                       port@2 {
> +                               reg = <2>;
> +                       };
> +
> +                       port@3 {
> +                               reg = <3>;
> +                       };
> +
> +                       port@4 {
> +                               reg = <4>;
> +                               max9286_out1: endpoint {
> +                                       clock-lanes = <0>;
> +                                       data-lanes = <1 2 3 4>;
> +                                       remote-endpoint = <&csi41_in>;
> +                               };
> +                       };
> +               };
> +
> +               i2c-mux {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       i2c@0 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <0>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@1 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <1>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@2 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <2>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@3 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <3>;
> +
> +                               status = "disabled";
> +                       };
> +               };
> +       };
> +};
> +
>  &lvds0 {
>         status = "okay";
>  
> @@ -256,6 +444,11 @@ i2c0_pins: i2c0 {
>                 function = "i2c0";
>         };
>  
> +       i2c1_pins: i2c1 {
> +               groups = "i2c1";
> +               function = "i2c1";
> +       };
> +
>         mmc_pins: mmc {
>                 groups = "mmc_data8", "mmc_ctrl", "mmc_ds";
>                 function = "mmc";
> -- 
> 2.33.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286
  2021-12-16 16:34 ` [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286 Jacopo Mondi
  2022-01-17 12:09   ` Kieran Bingham
@ 2022-01-20  9:14   ` Geert Uytterhoeven
  2022-01-20 10:25     ` Jacopo Mondi
  1 sibling, 1 reply; 16+ messages in thread
From: Geert Uytterhoeven @ 2022-01-20  9:14 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: Magnus Damm, Laurent Pinchart, Kieran Bingham,
	Niklas Söderlund, Linux-Renesas, Linux Media Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Jacopo,

On Thu, Dec 16, 2021 at 5:34 PM Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> Enable the MAX9286 GMSL deserializers on Condor-V3H board.
>
> Connected cameras should be defined in a device-tree overlay or included
> after these definitions.
>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Thanks for your patch!

> --- a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
> @@ -6,6 +6,8 @@
>   * Copyright (C) 2018 Cogent Embedded, Inc.
>   */
>
> +#include <dt-bindings/gpio/gpio.h>

Already included below.

> +
>  /dts-v1/;
>  #include "r8a77980.dtsi"
>  #include <dt-bindings/gpio/gpio.h>

I can fix that while applying, but I'm interested in hearing the answer
to Kieran's question first.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v8 5/7] arm64: dts: renesas: eagle: Enable MAX9286
  2021-12-16 16:34 ` [PATCH v8 5/7] arm64: dts: renesas: eagle: " Jacopo Mondi
  2022-01-17 12:00   ` Kieran Bingham
@ 2022-01-20  9:22   ` Geert Uytterhoeven
  1 sibling, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2022-01-20  9:22 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: Magnus Damm, Laurent Pinchart, Kieran Bingham,
	Niklas Söderlund, Linux-Renesas, Linux Media Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Jacopo, Kieran,

On Thu, Dec 16, 2021 at 5:34 PM Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> From: Kieran Bingham <kieran.bingham@ideasonboard.com>
>
> Enable the MAX9286 GMSL deserializer on the Eagle-V3M board.
>
> Connected cameras should be defined in a device-tree overlay or included
> after these definitions.
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Thanks for your patch!

> --- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
> @@ -6,6 +6,8 @@
>   * Copyright (C) 2017 Cogent Embedded, Inc.
>   */
>
> +#include <dt-bindings/gpio/gpio.h>

Already included below.

> +
>  /dts-v1/;
>  #include "r8a77970.dtsi"
>  #include <dt-bindings/gpio/gpio.h>

> @@ -278,6 +285,103 @@ &rwdt {
>         status = "okay";
>  };
>
> +&csi40 {

Moving up...

> +       status = "okay";
> +
> +       ports {
> +               port@0 {
> +                       csi40_in: endpoint {
> +                               clock-lanes = <0>;
> +                               data-lanes = <1 2 3 4>;
> +                               remote-endpoint = <&max9286_out0>;
> +                       };
> +               };
> +       };
> +};
> +
> +&i2c3 {

Moving up...

> +       pinctrl-0 = <&i2c3_pins>;
> +       pinctrl-names = "default";
> +
> +       status = "okay";
> +       clock-frequency = <400000>;
> +
> +       gmsl0: gmsl-deserializer@48 {
> +               compatible = "maxim,max9286";
> +               reg = <0x48>;
> +
> +               maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
> +               enable-gpios = <&io_expander 0 GPIO_ACTIVE_HIGH>;
> +
> +               ports {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       port@0 {
> +                               reg = <0>;
> +                       };
> +
> +                       port@1 {
> +                               reg = <1>;
> +                       };
> +
> +                       port@2 {
> +                               reg = <2>;
> +                       };
> +
> +                       port@3 {
> +                               reg = <3>;
> +                       };
> +
> +                       port@4 {
> +                               reg = <4>;
> +                               max9286_out0: endpoint {
> +                                       clock-lanes = <0>;
> +                                       data-lanes = <1 2 3 4>;
> +                                       remote-endpoint = <&csi40_in>;
> +                               };
> +                       };
> +               };
> +
> +               i2c-mux {

Should we move i2c-mux before ports, too?

> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +
> +                       i2c@0 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <0>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@1 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <1>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@2 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <2>;
> +
> +                               status = "disabled";
> +                       };
> +
> +                       i2c@3 {
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                               reg = <3>;
> +
> +                               status = "disabled";
> +                       };
> +               };
> +       };
> +};
> +

I can fix all of these while applying.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v8 6/7] arm64: dts: renesas: Add GMSL cameras .dtsi
  2021-12-16 16:34 ` [PATCH v8 6/7] arm64: dts: renesas: Add GMSL cameras .dtsi Jacopo Mondi
@ 2022-01-20  9:24   ` Geert Uytterhoeven
  0 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2022-01-20  9:24 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: Magnus Damm, Laurent Pinchart, Kieran Bingham,
	Niklas Söderlund, Linux-Renesas, Linux Media Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Jacopo, Kieran,

On Thu, Dec 16, 2021 at 5:34 PM Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> From: Kieran Bingham <kieran.bingham@ideasonboard.com>
>
> Describe the FAKRA connector available on Eagle and Condor boards that
> allow to connect GMSL camera modules such as IMI RDACM20 and RDACM21.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

LGTM, so will queue in renesas-devel for v5.18 with 4/7 and 5/7, once
the questions for the latter have been answered.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286
  2022-01-20  9:14   ` Geert Uytterhoeven
@ 2022-01-20 10:25     ` Jacopo Mondi
  0 siblings, 0 replies; 16+ messages in thread
From: Jacopo Mondi @ 2022-01-20 10:25 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jacopo Mondi, Magnus Damm, Laurent Pinchart, Kieran Bingham,
	Niklas Söderlund, Linux-Renesas, Linux Media Mailing List,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

Hi Geert, Kieran,

On Thu, Jan 20, 2022 at 10:14:34AM +0100, Geert Uytterhoeven wrote:
> Hi Jacopo,
>
> On Thu, Dec 16, 2021 at 5:34 PM Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> > Enable the MAX9286 GMSL deserializers on Condor-V3H board.
> >
> > Connected cameras should be defined in a device-tree overlay or included
> > after these definitions.
> >
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
>
> Thanks for your patch!
>
> > --- a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
> > +++ b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
> > @@ -6,6 +6,8 @@
> >   * Copyright (C) 2018 Cogent Embedded, Inc.
> >   */
> >
> > +#include <dt-bindings/gpio/gpio.h>
>
> Already included below.
>
> > +
> >  /dts-v1/;
> >  #include "r8a77980.dtsi"
> >  #include <dt-bindings/gpio/gpio.h>
>
> I can fix that while applying, but I'm interested in hearing the answer
> to Kieran's question first.

I can confirm that without including "gmsl-cameras.dtsi" no media
graph is registered. This is expected as the VINs and GSML device
nodes are enabled in the .dtsi only

        #ifdef GMSL_0
        &vin0 {
                status = "okay";
        };

        &vin1 {
                status = "okay";
        };

        &vin2 {
                status = "okay";
        };

        &vin3 {
                status = "okay";
        };

        &gmsl0 {
                status = "okay";
               ...

I think that's the expected behavior, isn't it ?

Thanks
   j




>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-01-20 10:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 16:34 [PATCH v8 0/7] arm64: dts: renesas: Enable MAX9286 on Eagle and Condor Jacopo Mondi
2021-12-16 16:34 ` [PATCH v8 1/7] dt-bindings: media: max9286: Re-indent example Jacopo Mondi
2021-12-16 16:34 ` [PATCH v8 2/7] dt-bindings: media: max9286: Define 'maxim,gpio-poc' Jacopo Mondi
2022-01-17 11:57   ` Kieran Bingham
2021-12-16 16:34 ` [PATCH v8 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property Jacopo Mondi
2021-12-16 16:34 ` [PATCH v8 4/7] arm64: dts: renesas: condor: Enable MAX9286 Jacopo Mondi
2022-01-17 12:09   ` Kieran Bingham
2022-01-20  9:14   ` Geert Uytterhoeven
2022-01-20 10:25     ` Jacopo Mondi
2021-12-16 16:34 ` [PATCH v8 5/7] arm64: dts: renesas: eagle: " Jacopo Mondi
2022-01-17 12:00   ` Kieran Bingham
2022-01-20  9:22   ` Geert Uytterhoeven
2021-12-16 16:34 ` [PATCH v8 6/7] arm64: dts: renesas: Add GMSL cameras .dtsi Jacopo Mondi
2022-01-20  9:24   ` Geert Uytterhoeven
2021-12-16 16:34 ` [PATCH v8 7/7] DNI: arm64: dts: renesas: eagle: Include eagle-gmsl Jacopo Mondi
2021-12-17 14:30 ` [v8.1 3/7] media: i2c: max9286: Use "maxim,gpio-poc" property Jacopo Mondi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.