From patchwork Mon Nov 16 13:52:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 324867 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=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 7E208C63798 for ; Mon, 16 Nov 2020 13:53:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 533E2222B9 for ; Mon, 16 Nov 2020 13:53:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729575AbgKPNxb (ORCPT ); Mon, 16 Nov 2020 08:53:31 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:37101 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbgKPNxb (ORCPT ); Mon, 16 Nov 2020 08:53:31 -0500 X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 5B9514000B; Mon, 16 Nov 2020 13:53:26 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org, robh@kernel.org, devicetree@vger.kernel.org Cc: Jacopo Mondi , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Hyun Kwon , Manivannan Sadhasivam , sergei.shtylyov@gmail.com Subject: [PATCH v5 2/8] dt-bindings: media: max9286: Document 'maxim, initial-reverse-channel-mV' Date: Mon, 16 Nov 2020 14:52:59 +0100 Message-Id: <20201116135305.81319-3-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201116135305.81319-1-jacopo+renesas@jmondi.org> References: <20201116135305.81319-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Document the 'initial-reverse-channel-mV' vendor property in the bindings document of the max9286 driver. The newly introduced property allows to specifying the initial configuration of the GMSL reverse control channel to accommodate remote serializers pre-programmed with the high threshold power supply noise immunity enabled. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- .../bindings/media/i2c/maxim,max9286.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.29.1 diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml index 9ea827092fdd..f61234d204fa 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml @@ -51,6 +51,26 @@ properties: '#gpio-cells': const: 2 + maxim,initial-reverse-channel-mV: + $ref: '/schemas/types.yaml#/definitions/uint32' + minimum: 30 + maximum: 200 + default: 170 + description: | + Initial amplitude of the reverse control channel, in millivolts. + + The initial amplitude shall be adjusted to a value compatible with the + configuration of the connected remote serializer. + + Some camera modules (for example RDACM20) include an on-board MCU that + pre-programs the embedded serializer with power supply noise immunity + (high-threshold) enabled. A typical value of the deserializer's reverse + channel amplitude to communicate with pre-programmed serializers is 170mV. + + A typical value for the reverse channel amplitude to communicate with + a remote serializer whose high-threshold noise immunity is not enabled + is 100mV. + ports: type: object description: | @@ -221,6 +241,7 @@ required: - ports - i2c-mux - gpio-controller + - maxim,initial-reverse-channel-mV additionalProperties: false @@ -243,6 +264,8 @@ examples: gpio-controller; #gpio-cells = <2>; + maxim,initial-reverse-channel-mV = <170>; + ports { #address-cells = <1>; #size-cells = <0>; From patchwork Mon Nov 16 13:53:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 324864 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=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 75252C6369E for ; Mon, 16 Nov 2020 13:54:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41C4C222E8 for ; Mon, 16 Nov 2020 13:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729596AbgKPNxe (ORCPT ); Mon, 16 Nov 2020 08:53:34 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:49921 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729572AbgKPNxe (ORCPT ); Mon, 16 Nov 2020 08:53:34 -0500 X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id F2F4640017; Mon, 16 Nov 2020 13:53:28 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org Cc: Jacopo Mondi , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Hyun Kwon , Manivannan Sadhasivam , sergei.shtylyov@gmail.com, Kieran Bingham Subject: [PATCH v5 3/8] media: i2c: max9286: Break-out reverse channel setup Date: Mon, 16 Nov 2020 14:53:00 +0100 Message-Id: <20201116135305.81319-4-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201116135305.81319-1-jacopo+renesas@jmondi.org> References: <20201116135305.81319-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Break out the reverse channel setup configuration procedure to its own function. This change prepares for configuring the reverse channel conditionally to the remote side high threshold configuration. No functional changes intended. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- drivers/media/i2c/max9286.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index d969ac21a058..526b6e557dfb 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -336,6 +336,22 @@ static void max9286_configure_i2c(struct max9286_priv *priv, bool localack) usleep_range(3000, 5000); } +static void max9286_reverse_channel_setup(struct max9286_priv *priv) +{ + /* + * Reverse channel setup. + * + * - Enable custom reverse channel configuration (through register 0x3f) + * and set the first pulse length to 35 clock cycles. + * - Increase the reverse channel amplitude to 170mV to accommodate the + * high threshold enabled by the serializer driver. + */ + max9286_write(priv, 0x3f, MAX9286_EN_REV_CFG | MAX9286_REV_FLEN(35)); + max9286_write(priv, 0x3b, MAX9286_REV_TRF(1) | MAX9286_REV_AMP(70) | + MAX9286_REV_AMP_X); + usleep_range(2000, 2500); +} + /* * max9286_check_video_links() - Make sure video links are detected and locked * @@ -941,19 +957,7 @@ static int max9286_setup(struct max9286_priv *priv) * only. This should be disabled after the mux is initialised. */ max9286_configure_i2c(priv, true); - - /* - * Reverse channel setup. - * - * - Enable custom reverse channel configuration (through register 0x3f) - * and set the first pulse length to 35 clock cycles. - * - Increase the reverse channel amplitude to 170mV to accommodate the - * high threshold enabled by the serializer driver. - */ - max9286_write(priv, 0x3f, MAX9286_EN_REV_CFG | MAX9286_REV_FLEN(35)); - max9286_write(priv, 0x3b, MAX9286_REV_TRF(1) | MAX9286_REV_AMP(70) | - MAX9286_REV_AMP_X); - usleep_range(2000, 2500); + max9286_reverse_channel_setup(priv); /* * Enable GMSL links, mask unused ones and autodetect link From patchwork Mon Nov 16 13:53:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 324866 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=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 3F4DAC64E7A for ; Mon, 16 Nov 2020 13:53:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16523241A4 for ; Mon, 16 Nov 2020 13:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729471AbgKPNxh (ORCPT ); Mon, 16 Nov 2020 08:53:37 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:49921 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729572AbgKPNxh (ORCPT ); Mon, 16 Nov 2020 08:53:37 -0500 X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 85AE84001C; Mon, 16 Nov 2020 13:53:33 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org Cc: Jacopo Mondi , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Hyun Kwon , Manivannan Sadhasivam , sergei.shtylyov@gmail.com Subject: [PATCH v5 5/8] media: i2c: max9286: Configure reverse channel amplitude Date: Mon, 16 Nov 2020 14:53:02 +0100 Message-Id: <20201116135305.81319-6-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201116135305.81319-1-jacopo+renesas@jmondi.org> References: <20201116135305.81319-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Adjust the initial reverse channel amplitude parsing from firmware interface the 'maxim,initial-reverse-channel-mV' property. This change is required for both rdacm20 and rdacm21 camera modules to be correctly probed when used in combination with the max9286 deserializer. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- drivers/media/i2c/max9286.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 31e27d0f34f1..11ba047f3793 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -163,6 +163,8 @@ struct max9286_priv { unsigned int mux_channel; bool mux_open; + u32 reverse_channel_mV; + struct v4l2_ctrl_handler ctrls; struct v4l2_ctrl *pixelrate; @@ -557,10 +559,14 @@ static int max9286_notify_bound(struct v4l2_async_notifier *notifier, * All enabled sources have probed and enabled their reverse control * channels: * + * - Increase the reverse channel amplitude to compensate for the + * remote ends high threshold, if not done already * - Verify all configuration links are properly detected * - Disable auto-ack as communication on the control channel are now * stable. */ + if (priv->reverse_channel_mV < 170) + max9286_reverse_channel_setup(priv, 170); max9286_check_config_link(priv, priv->source_mask); /* @@ -967,7 +973,7 @@ static int max9286_setup(struct max9286_priv *priv) * only. This should be disabled after the mux is initialised. */ max9286_configure_i2c(priv, true); - max9286_reverse_channel_setup(priv, 170); + max9286_reverse_channel_setup(priv, priv->reverse_channel_mV); /* * Enable GMSL links, mask unused ones and autodetect link @@ -1235,6 +1241,18 @@ static int max9286_parse_dt(struct max9286_priv *priv) } of_node_put(node); + /* + * Parse the initial value of the reverse channel amplitude from + * the firmware interface. + * + * Default it to 170mV for backward compatibility with DTB that do not + * provide the property. + */ + if (of_property_read_u32(dev->of_node, + "maxim,initial-reverse-channel-mV", + &priv->reverse_channel_mV)) + priv->reverse_channel_mV = 170; + priv->route_mask = priv->source_mask; return 0; From patchwork Mon Nov 16 13:53:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 324865 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=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, 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 1A126C71155 for ; Mon, 16 Nov 2020 13:53:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3A44222EC for ; Mon, 16 Nov 2020 13:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729669AbgKPNxm (ORCPT ); Mon, 16 Nov 2020 08:53:42 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:44589 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729572AbgKPNxm (ORCPT ); Mon, 16 Nov 2020 08:53:42 -0500 X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id D33714000B; Mon, 16 Nov 2020 13:53:37 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org Cc: Jacopo Mondi , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Hyun Kwon , Manivannan Sadhasivam , sergei.shtylyov@gmail.com Subject: [PATCH v5 7/8] [DNI] arm64: dts: renesas: salvator-x-max9286: Specify channel amplitude Date: Mon, 16 Nov 2020 14:53:04 +0100 Message-Id: <20201116135305.81319-8-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201116135305.81319-1-jacopo+renesas@jmondi.org> References: <20201116135305.81319-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use the newly introduced 'maxim,initial-reverse-channel-mV' property to specify the initial reverse channel amplitude when the remote serializers are pre-programmed with noise immunity threshold enabled. Signed-off-by: Jacopo Mondi Tested-by: Kieran Bingham Reviewed-by: Kieran Bingham --- arch/arm64/boot/dts/renesas/salvator-x-max9286.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/salvator-x-max9286.dtsi b/arch/arm64/boot/dts/renesas/salvator-x-max9286.dtsi index 6f4798859542..f14a133b7302 100644 --- a/arch/arm64/boot/dts/renesas/salvator-x-max9286.dtsi +++ b/arch/arm64/boot/dts/renesas/salvator-x-max9286.dtsi @@ -128,6 +128,7 @@ gmsl-deserializer@4c { compatible = "maxim,max9286"; reg = <0x4c>; poc-supply = <&poc_12v>; + maxim,initial-reverse-channel-mV = <170>; ports { #address-cells = <1>; @@ -263,6 +264,7 @@ gmsl-deserializer@6c { compatible = "maxim,max9286"; reg = <0x6c>; poc-supply = <&poc_12v>; + maxim,initial-reverse-channel-mV = <170>; ports { #address-cells = <1>;