From patchwork Wed Apr 14 13:51:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12202939 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD184C433B4 for ; Wed, 14 Apr 2021 13:51:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B467B611C9 for ; Wed, 14 Apr 2021 13:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351666AbhDNNv2 (ORCPT ); Wed, 14 Apr 2021 09:51:28 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:35867 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349137AbhDNNvX (ORCPT ); Wed, 14 Apr 2021 09:51:23 -0400 X-Originating-IP: 93.61.96.190 Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 0281B6000C; Wed, 14 Apr 2021 13:50:58 +0000 (UTC) From: Jacopo Mondi To: Geert Uytterhoeven , Magnus Damm , Laurent Pinchart , Kieran Bingham , Rob Herring Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] dt-bindings: media: max9286: Define 'maxim,gpio-poc' Date: Wed, 14 Apr 2021 15:51:24 +0200 Message-Id: <20210414135128.180980-2-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414135128.180980-1-jacopo+renesas@jmondi.org> References: <20210414135128.180980-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- .../bindings/media/i2c/maxim,max9286.yaml | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml index ee16102fdfe7..480a491f3744 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml @@ -70,6 +70,24 @@ 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: | + Identifier of gpio line that controls Power over Coax to the cameras and + the associated polarity flag (GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW) + as defined in . + + 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 @@ -182,7 +200,6 @@ required: - reg - ports - i2c-mux - - gpio-controller additionalProperties: false @@ -327,4 +344,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>; + }; + }; }; From patchwork Wed Apr 14 13:51:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12202943 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B897C43600 for ; Wed, 14 Apr 2021 13:51:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46CEA613C0 for ; Wed, 14 Apr 2021 13:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351682AbhDNNv3 (ORCPT ); Wed, 14 Apr 2021 09:51:29 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:38185 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349128AbhDNNvZ (ORCPT ); Wed, 14 Apr 2021 09:51:25 -0400 X-Originating-IP: 93.61.96.190 Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 2F61F6000D; Wed, 14 Apr 2021 13:51:00 +0000 (UTC) From: Jacopo Mondi To: Geert Uytterhoeven , Magnus Damm , Laurent Pinchart , Kieran Bingham , Rob Herring Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/5] media: i2c: max9286: Use "maxim,gpio-poc" property Date: Wed, 14 Apr 2021 15:51:25 +0200 Message-Id: <20210414135128.180980-3-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414135128.180980-1-jacopo+renesas@jmondi.org> References: <20210414135128.180980-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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 introduce 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 --- drivers/media/i2c/max9286.c | 125 +++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 29 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 6fd4d59fcc72..0c125f7b3d9b 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +166,9 @@ struct max9286_priv { u32 reverse_channel_mv; + u32 gpio_poc; + u32 gpio_poc_flags; + struct v4l2_ctrl_handler ctrls; struct v4l2_ctrl *pixelrate; @@ -1022,20 +1026,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 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_gpio_get(struct gpio_chip *chip, unsigned int offset) +static int max9286_gpiochip_get(struct gpio_chip *chip, unsigned int offset) { struct max9286_priv *priv = gpiochip_get_data(chip); @@ -1055,8 +1066,8 @@ 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 */ @@ -1069,6 +1080,75 @@ 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; + u32 gpio_poc[2]; + int ret; + + /* + * Parse the "gpio-poc" vendor property. If the camera power is + * controlled by one of the MAX9286 gpio lines, do not register + * the gpio controller and ignore 'poc-supply'. + */ + ret = of_property_read_u32_array(dev->of_node, + "maxim,gpio-poc", gpio_poc, 2); + if (!ret) { + priv->gpio_poc = gpio_poc[0]; + priv->gpio_poc_flags = gpio_poc[1]; + if ((priv->gpio_poc != 0 && priv->gpio_poc != 1) || + (priv->gpio_poc_flags != GPIO_ACTIVE_HIGH && + priv->gpio_poc_flags != GPIO_ACTIVE_LOW)) { + dev_err(dev, "Invalid 'gpio-poc': (%u %u)\n", + priv->gpio_poc, priv->gpio_poc_flags); + return -EINVAL; + } + + /* GPIO values default to high */ + priv->gpio_state = BIT(0) | BIT(1); + priv->regulator = NULL; + + return 0; + } + + 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; +} + +static int max9286_poc_enable(struct max9286_priv *priv, bool enable) +{ + int ret; + + /* If "poc-gpio" is used, toggle the line and do not use regulator. */ + if (!priv->regulator) + return max9286_gpio_set(priv, priv->gpio_poc, + enable ^ priv->gpio_poc_flags); + + /* Otherwise PoC is controlled using a regulator. */ + if (enable) { + ret = regulator_enable(priv->regulator); + if (ret < 0) { + dev_err(&priv->client->dev, "Unable to turn PoC on\n"); + return ret; + } + + return 0; + } + + return regulator_disable(priv->regulator); +} + static int max9286_init(struct device *dev) { struct max9286_priv *priv; @@ -1078,17 +1158,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; } /* @@ -1098,7 +1175,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); @@ -1114,8 +1191,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; } @@ -1286,20 +1363,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; @@ -1326,7 +1393,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); From patchwork Wed Apr 14 13:51:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12202941 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 113DAC43470 for ; Wed, 14 Apr 2021 13:51:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9C4C611EE for ; Wed, 14 Apr 2021 13:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351687AbhDNNv3 (ORCPT ); Wed, 14 Apr 2021 09:51:29 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:56557 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349193AbhDNNv1 (ORCPT ); Wed, 14 Apr 2021 09:51:27 -0400 X-Originating-IP: 93.61.96.190 Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 4D4E360019; Wed, 14 Apr 2021 13:51:03 +0000 (UTC) From: Jacopo Mondi To: Geert Uytterhoeven , Magnus Damm , Laurent Pinchart , Kieran Bingham , Rob Herring Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] arm64: dts: renesas: eagle: Enable MAX9286 Date: Wed, 14 Apr 2021 15:51:26 +0200 Message-Id: <20210414135128.180980-4-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414135128.180980-1-jacopo+renesas@jmondi.org> References: <20210414135128.180980-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Kieran Bingham 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. Signed-off-by: Kieran Bingham Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- .../arm64/boot/dts/renesas/r8a77970-eagle.dts | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts index 874a7fc2730b..d2b6368d1e72 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 + /dts-v1/; #include "r8a77970.dtsi" @@ -188,6 +190,11 @@ i2c0_pins: i2c0 { function = "i2c0"; }; + i2c3_pins: i2c3 { + groups = "i2c3_a"; + function = "i2c3"; + }; + qspi0_pins: qspi0 { groups = "qspi0_ctrl", "qspi0_data4"; function = "qspi0"; @@ -266,6 +273,118 @@ &rwdt { status = "okay"; }; +&csi40 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <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>; + + gmsl: gmsl-deserializer@48 { + compatible = "maxim,max9286"; + reg = <0x48>; + + maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>; + + /* eagle-pca9654-max9286-pwdn */ + enable-gpios = <&io_expander 0 GPIO_ACTIVE_HIGH>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + max9286_in0: endpoint { + }; + }; + + port@1 { + reg = <1>; + max9286_in1: endpoint { + }; + }; + + port@2 { + reg = <2>; + max9286_in2: endpoint { + }; + }; + + port@3 { + reg = <3>; + max9286_in3: endpoint { + }; + }; + + 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"; From patchwork Wed Apr 14 13:51:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12202945 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0BDBC43603 for ; Wed, 14 Apr 2021 13:51:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B483261164 for ; Wed, 14 Apr 2021 13:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351473AbhDNNvc (ORCPT ); Wed, 14 Apr 2021 09:51:32 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:35513 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351670AbhDNNv3 (ORCPT ); Wed, 14 Apr 2021 09:51:29 -0400 X-Originating-IP: 93.61.96.190 Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 5C5736000C; Wed, 14 Apr 2021 13:51:05 +0000 (UTC) From: Jacopo Mondi To: Geert Uytterhoeven , Magnus Damm , Laurent Pinchart , Kieran Bingham , Rob Herring Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/5] arm64: dts: renesas: eagle: Add GMSL .dtsi Date: Wed, 14 Apr 2021 15:51:27 +0200 Message-Id: <20210414135128.180980-5-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414135128.180980-1-jacopo+renesas@jmondi.org> References: <20210414135128.180980-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Kieran Bingham Describe the FAKRA connector available on Eagle board that allows connecting GMSL camera modules such as IMI RDACM20 and RDACM21. Signed-off-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi | 186 ++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi diff --git a/arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi b/arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi new file mode 100644 index 000000000000..1836bca1e8b2 --- /dev/null +++ b/arch/arm64/boot/dts/renesas/eagle-gmsl.dtsi @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Device Tree Source (overlay) for the Eagle V3M GMSL connectors + * + * Copyright (C) 2017 Ideas on Board + * Copyright (C) 2021 Jacopo Mondi + * + * This overlay allows you to define GMSL cameras connected to the FAKRA + * connectors on the Eagle-V3M (or compatible) board. + * + * The following cameras are currently supported: + * "imi,rdacm20" + * "imi,rdacm21" + */ + +#include + +/* + * Select which cameras are in use: + * #define EAGLE_CAMERA0_RDACM20 + * #define EAGLE_CAMERA0_RDACM21 + * + * The two camera modules are configured with different image formats + * and cannot be mixed. + */ +#define EAGLE_CAMERA0_RDACM21 +#define EAGLE_CAMERA1_RDACM21 +#define EAGLE_CAMERA2_RDACM21 +#define EAGLE_CAMERA3_RDACM21 + +/* Set the compatible string based on the camera model. */ +#if defined(EAGLE_CAMERA0_RDACM21) || defined(EAGLE_CAMERA1_RDACM21) || \ + defined(EAGLE_CAMERA2_RDACM21) || defined(EAGLE_CAMERA3_RDACM21) +#define EAGLE_CAMERA_MODEL "imi,rdacm21" +#define EAGLE_USE_RDACM21 +#elif defined(EAGLE_CAMERA0_RDACM20) || defined(EAGLE_CAMERA1_RDACM20) || \ + defined(EAGLE_CAMERA2_RDACM20) || defined(EAGLE_CAMERA3_RDACM20) +#define EAGLE_CAMERA_MODEL "imi,rdacm20" +#define EAGLE_USE_RDACM20 +#endif + +/* Define which cameras are available. */ +#if defined(EAGLE_CAMERA0_RDACM21) || defined(EAGLE_CAMERA0_RDACM20) +#define EAGLE_USE_CAMERA_0 +#endif + +#if defined(EAGLE_CAMERA1_RDACM21) || defined(EAGLE_CAMERA1_RDACM20) +#define EAGLE_USE_CAMERA_1 +#endif + +#if defined(EAGLE_CAMERA2_RDACM21) || defined(EAGLE_CAMERA2_RDACM20) +#define EAGLE_USE_CAMERA_2 +#endif + +#if defined(EAGLE_CAMERA3_RDACM21) || defined(EAGLE_CAMERA3_RDACM20) +#define EAGLE_USE_CAMERA_3 +#endif + +/* Define the endpoint links. */ +#ifdef EAGLE_USE_CAMERA_0 +&max9286_in0 { + remote-endpoint = <&fakra_con0>; +}; +#endif + +#ifdef EAGLE_USE_CAMERA_1 +&max9286_in1 { + remote-endpoint = <&fakra_con1>; +}; +#endif + +#ifdef EAGLE_USE_CAMERA_2 +&max9286_in2 { + remote-endpoint = <&fakra_con2>; +}; +#endif + +#ifdef EAGLE_USE_CAMERA_3 +&max9286_in3 { + remote-endpoint = <&fakra_con3>; +}; +#endif + +/* Populate the GMSL i2c-mux bus with camera nodes. */ +#if defined(EAGLE_USE_RDACM21) || defined(EAGLE_USE_RDACM20) + +#ifdef EAGLE_USE_CAMERA_0 +&vin0 { + status = "okay"; +}; +#endif + +#ifdef EAGLE_USE_CAMERA_1 +&vin1 { + status = "okay"; +}; +#endif + +#ifdef EAGLE_USE_CAMERA_2 +&vin2 { + status = "okay"; +}; +#endif + +#ifdef EAGLE_USE_CAMERA_3 +&vin3 { + status = "okay"; +}; +#endif + +&gmsl { + + status = "okay"; + maxim,reverse-channel-microvolt = <100000>; + + i2c-mux { +#ifdef EAGLE_USE_CAMERA_0 + i2c@0 { + status = "okay"; + + camera@51 { + compatible = EAGLE_CAMERA_MODEL; + reg = <0x51>, <0x61>; + + port { + fakra_con0: endpoint { + remote-endpoint = <&max9286_in0>; + }; + }; + }; + }; +#endif + +#ifdef EAGLE_USE_CAMERA_1 + i2c@1 { + status = "okay"; + + camera@52 { + compatible = EAGLE_CAMERA_MODEL; + reg = <0x52>, <0x62>; + + port { + fakra_con1: endpoint { + remote-endpoint = <&max9286_in1>; + }; + }; + }; + }; +#endif + +#ifdef EAGLE_USE_CAMERA_2 + i2c@2 { + status = "okay"; + + camera@53 { + compatible = EAGLE_CAMERA_MODEL; + reg = <0x53>, <0x63>; + + port { + fakra_con2: endpoint { + remote-endpoint = <&max9286_in2>; + }; + }; + }; + }; +#endif + +#ifdef EAGLE_USE_CAMERA_3 + i2c@3 { + status = "okay"; + + camera@54 { + compatible = EAGLE_CAMERA_MODEL; + reg = <0x54>, <0x64>; + + port { + fakra_con3: endpoint { + remote-endpoint = <&max9286_in3>; + }; + }; + }; + }; +#endif + }; +}; +#endif From patchwork Wed Apr 14 13:51:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12202947 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21C7DC433B4 for ; Wed, 14 Apr 2021 13:51:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E876C61164 for ; Wed, 14 Apr 2021 13:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349210AbhDNNvg (ORCPT ); Wed, 14 Apr 2021 09:51:36 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:55893 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349187AbhDNNvb (ORCPT ); Wed, 14 Apr 2021 09:51:31 -0400 X-Originating-IP: 93.61.96.190 Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 4966B60006; Wed, 14 Apr 2021 13:51:07 +0000 (UTC) From: Jacopo Mondi To: Geert Uytterhoeven , Magnus Damm , Laurent Pinchart , Kieran Bingham , Rob Herring Cc: Jacopo Mondi , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/5] arm64: dts: renesas: eagle: Include eagle-gmsl Date: Wed, 14 Apr 2021 15:51:28 +0200 Message-Id: <20210414135128.180980-6-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210414135128.180980-1-jacopo+renesas@jmondi.org> References: <20210414135128.180980-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Kieran Bingham Include the eagle-gmsl.dtsi to enable GMSL camera support on the Eagle-V3M platform. Signed-off-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- arch/arm64/boot/dts/renesas/r8a77970-eagle.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts index d2b6368d1e72..9b8dfb5132fb 100644 --- a/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts +++ b/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts @@ -391,3 +391,6 @@ &scif0 { status = "okay"; }; + +/* FAKRA Overlay */ +#include "eagle-gmsl.dtsi"