From patchwork Mon Mar 16 20:27:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11441257 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95D0913B1 for ; Mon, 16 Mar 2020 20:25:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80D8620663 for ; Mon, 16 Mar 2020 20:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732553AbgCPUZR (ORCPT ); Mon, 16 Mar 2020 16:25:17 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:47971 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732552AbgCPUZQ (ORCPT ); Mon, 16 Mar 2020 16:25:16 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id D1A0EFF803; Mon, 16 Mar 2020 20:25:13 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com Cc: Jacopo Mondi , hyunk@xilinx.com, manivannan.sadhasivam@linaro.org, linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 1/5] media: i2c: max9286: Put of node on error Date: Mon, 16 Mar 2020 21:27:53 +0100 Message-Id: <20200316202757.529740-2-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200316202757.529740-1-jacopo+renesas@jmondi.org> References: <20200316202757.529740-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Put the device of node in case of dt parsing error. Fixes: 9eed4185c7a0 ("media: i2c: Add MAX9286 driver") Signed-off-by: Jacopo Mondi --- drivers/media/i2c/max9286.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index a20829297ef6..06edd8bd3e82 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -1046,6 +1046,7 @@ static int max9286_parse_dt(struct max9286_priv *priv) i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux"); if (!i2c_mux) { dev_err(dev, "Failed to find i2c-mux node\n"); + of_node_put(dev->of_node); return -EINVAL; } From patchwork Mon Mar 16 20:27:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11441261 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BC0913B1 for ; Mon, 16 Mar 2020 20:25:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8D6F20663 for ; Mon, 16 Mar 2020 20:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732557AbgCPUZS (ORCPT ); Mon, 16 Mar 2020 16:25:18 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:56109 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732556AbgCPUZS (ORCPT ); Mon, 16 Mar 2020 16:25:18 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 9EBCEFF804; Mon, 16 Mar 2020 20:25:15 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com Cc: Jacopo Mondi , hyunk@xilinx.com, manivannan.sadhasivam@linaro.org, linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 2/5] dt-bindings: media: max9286: Add overlap window Date: Mon, 16 Mar 2020 21:27:54 +0100 Message-Id: <20200316202757.529740-3-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200316202757.529740-1-jacopo+renesas@jmondi.org> References: <20200316202757.529740-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The MAX9286 chip exposes a way to control the 'overlap window' parameter, most probably used in calculation of the frame synchronization interval. When used in conjunction with some serializers, the overlap window has to be disabled in order to correctly achieve frame sync locking. As the exact meaning of that control is not documented in the chip's manual, require all DTS users to specify the value of the window. When, and if, in future the meaning of control gets clarified and a default behaviour (window enabled or disabled) can be established, a new boolean property could supersede this one while being sure that older DTB are fully specified to avoid confusion. Provide a few convenience macros for the window disabled and window default value. Signed-off-by: Jacopo Mondi --- .../devicetree/bindings/media/i2c/maxim,max9286.yaml | 11 +++++++++++ MAINTAINERS | 1 + include/dt-bindings/media/maxim-gmsl.h | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 include/dt-bindings/media/maxim-gmsl.h diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml index f9d3e5712c59..ee8e0418b3f0 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml @@ -46,6 +46,14 @@ properties: description: GPIO connected to the \#PWDN pin with inverted polarity maxItems: 1 + # Until the overlap window control gets not clarified, require dts + # to set its value explicitly, + maxim,overlap-window: + description: Overlap window duration, in pixel clock cycles. + maxItems: 1 + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + ports: type: object description: | @@ -146,6 +154,7 @@ properties: required: - compatible - reg + - maxim,overlap-window - ports - i2c-mux @@ -154,6 +163,7 @@ additionalProperties: false examples: - | #include + #include i2c@e66d8000 { #address-cells = <1>; @@ -166,6 +176,7 @@ examples: reg = <0x2c>; poc-supply = <&camera_poc_12v>; enable-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + maxim,overlap-window = MAX9286_OVLP_WINDOW_DISABLED; ports { #address-cells = <1>; diff --git a/MAINTAINERS b/MAINTAINERS index 21a9ff4fe684..3d2455085c80 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10190,6 +10190,7 @@ M: Niklas Söderlund L: linux-media@vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml +F: include/dt-bindings/media/maxim-gmsl.h F: drivers/media/i2c/max9286.c MAX9860 MONO AUDIO VOICE CODEC DRIVER diff --git a/include/dt-bindings/media/maxim-gmsl.h b/include/dt-bindings/media/maxim-gmsl.h new file mode 100644 index 000000000000..47945ffc3a4d --- /dev/null +++ b/include/dt-bindings/media/maxim-gmsl.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _DT_BINDINGS_MEDIA_MAXIM_GMSL_H +#define _DT_BINDINGS_MEDIA_MAXIM_GMSL_H + +/* MAX9286 default overlap values. */ +#define MAX9286_OVLP_WINDOW_DISABLED <0> +#define MAX9286_OVLP_WINDOW_DEFAULT <0x1680> + +#endif /* _DT_BINDINGS_MEDIA_MAXIM_GMSL_H */ From patchwork Mon Mar 16 20:27:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11441265 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 557951668 for ; Mon, 16 Mar 2020 20:25:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F88A20658 for ; Mon, 16 Mar 2020 20:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732552AbgCPUZV (ORCPT ); Mon, 16 Mar 2020 16:25:21 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:58527 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732556AbgCPUZU (ORCPT ); Mon, 16 Mar 2020 16:25:20 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 77656FF802; Mon, 16 Mar 2020 20:25:17 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com Cc: Jacopo Mondi , hyunk@xilinx.com, manivannan.sadhasivam@linaro.org, linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 3/5] media: i2c: max9286: Parse overlap window value Date: Mon, 16 Mar 2020 21:27:55 +0100 Message-Id: <20200316202757.529740-4-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200316202757.529740-1-jacopo+renesas@jmondi.org> References: <20200316202757.529740-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Parse the 'maxim,overlap-window' property value and cache its content to later program registers 0x63 and 0x64. As specified by the bindings documentation, the property is mandatory as long as a default value cannot be established to guarantee DTB backward compatibility. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/max9286.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 06edd8bd3e82..0357515860b2 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -117,6 +117,9 @@ #define MAX9286_REV_FLEN(n) ((n) - 20) /* Register 0x49 */ #define MAX9286_VIDEO_DETECT_MASK 0x0f +/* Register 0x64 */ +#define MAX9286_OVLP_WINDOWH_MASK GENMASK(4, 0) + /* Register 0x69 */ #define MAX9286_LFLTBMONMASKED BIT(7) #define MAX9286_LOCKMONMASKED BIT(6) @@ -164,6 +167,8 @@ struct max9286_priv { unsigned int csi2_data_lanes; struct max9286_source sources[MAX9286_NUM_GMSL]; struct v4l2_async_notifier notifier; + + u32 overlap_window; }; static struct max9286_source *next_source(struct max9286_priv *priv, @@ -895,6 +900,11 @@ static int max9286_setup(struct max9286_priv *priv) max9286_write(priv, 0x01, MAX9286_FSYNCMODE_INT_HIZ | MAX9286_FSYNCMETH_AUTO); + /* Configure overlap window. */ + max9286_write(priv, 0x63, priv->overlap_window); + max9286_write(priv, 0x64, (priv->overlap_window >> 8) & + MAX9286_OVLP_WINDOWH_MASK); + /* Enable HS/VS encoding, use D14/15 for HS/VS, invert VS. */ max9286_write(priv, 0x0c, MAX9286_HVEN | MAX9286_INVVS | MAX9286_HVSRC_D14); @@ -1041,8 +1051,24 @@ static int max9286_parse_dt(struct max9286_priv *priv) struct device_node *i2c_mux; struct device_node *node = NULL; unsigned int i2c_mux_mask = 0; + int ret; of_node_get(dev->of_node); + + /* + * FIXM: Require overlap window value to be specified by DTS as long as + * the control function is not clarified. As soon as a default + * behaviour can be established drop this requirement, while older + * DTBs are guaranteed to be fully specified. + */ + ret = of_property_read_u32(dev->of_node, "maxim,overlap-window", + &priv->overlap_window); + if (ret) { + dev_err(dev, "Missing property \"maxim,overlap-window\"\n"); + of_node_put(dev->of_node); + return -EINVAL; + } + i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux"); if (!i2c_mux) { dev_err(dev, "Failed to find i2c-mux node\n"); From patchwork Mon Mar 16 20:27:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11441269 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C742613B1 for ; Mon, 16 Mar 2020 20:25:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2E5F20663 for ; Mon, 16 Mar 2020 20:25:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732565AbgCPUZW (ORCPT ); Mon, 16 Mar 2020 16:25:22 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:54871 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732556AbgCPUZW (ORCPT ); Mon, 16 Mar 2020 16:25:22 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 5729EFF803; Mon, 16 Mar 2020 20:25:19 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com Cc: Jacopo Mondi , hyunk@xilinx.com, manivannan.sadhasivam@linaro.org, linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 4/5] dt-bindings: media: max9286: Add reverse channel amplitude Date: Mon, 16 Mar 2020 21:27:56 +0100 Message-Id: <20200316202757.529740-5-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200316202757.529740-1-jacopo+renesas@jmondi.org> References: <20200316202757.529740-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The MAX9286 chip exposes registers to control the reverse channel amplitude signal. The channel amplitude has to be configured according to the connected remote serializer settings, in order to guarantee reliable communications. Serializer might be pre-programmed and initialize with their reverse channel noise threshold level increased. While this is intended to increase the signal/noise immunity ratio on the channel, the deserializer should be initialized accordingly, with its channel amplitude increased to 170mV. Add to the bindings documentation a required property to allow DTS users to specify the initial setting of the deserializer reverse channel and accommodate different serializer models. Signed-off-by: Jacopo Mondi --- .../bindings/media/i2c/maxim,max9286.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml index ee8e0418b3f0..a1c56734a727 100644 --- a/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml +++ b/Documentation/devicetree/bindings/media/i2c/maxim,max9286.yaml @@ -54,6 +54,25 @@ properties: allOf: - $ref: /schemas/types.yaml#/definitions/uint32 + maxim,reverse-channel-amplitude: + description: | + The reverse channel amplitude initial value, in milliVolts. If the remote + serializer is pre-programmed with an high reverse channel noise threshold, + the deserializer channel amplitude shall initially be increased to 170mV + to allow the two to communicate reliably. Likewise, if the remote + serializer probes without an increased reverse channel noise threshold, + the deserializer initial reverse channel amplitude should be set to 100mV + to be later increased to 170mV after serializers have increased their + reverse channel noise threshold. + maxItems: 1 + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + # The property can be easily expanded to support more values if needed, + # but that's what's supported today by the driver. + oneOf: + - const: 100 + - const: 170 + ports: type: object description: | @@ -155,6 +174,7 @@ required: - compatible - reg - maxim,overlap-window + - maxim,reverse-channel-amplitude - ports - i2c-mux @@ -177,6 +197,7 @@ examples: poc-supply = <&camera_poc_12v>; enable-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; maxim,overlap-window = MAX9286_OVLP_WINDOW_DISABLED; + maxim,reverse-channel-amplitude = <170>; ports { #address-cells = <1>; From patchwork Mon Mar 16 20:27:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11441273 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BD0C1668 for ; Mon, 16 Mar 2020 20:25:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5563A20658 for ; Mon, 16 Mar 2020 20:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732560AbgCPUZY (ORCPT ); Mon, 16 Mar 2020 16:25:24 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:53291 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732556AbgCPUZX (ORCPT ); Mon, 16 Mar 2020 16:25:23 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 44635FF804; Mon, 16 Mar 2020 20:25:21 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com Cc: Jacopo Mondi , hyunk@xilinx.com, manivannan.sadhasivam@linaro.org, linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 5/5] media: i2c: max9286: Parse channel amplitude Date: Mon, 16 Mar 2020 21:27:57 +0100 Message-Id: <20200316202757.529740-6-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200316202757.529740-1-jacopo+renesas@jmondi.org> References: <20200316202757.529740-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Parse the 'maxim,reverse-channel-amplitude' property value and cache its content to later program the initial reverse channel amplitude. Only support 100mV and 170mV values for the moment. The property could be easily expanded to support more values. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/max9286.c | 39 ++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 0357515860b2..24af8002535e 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -168,6 +168,7 @@ struct max9286_priv { struct max9286_source sources[MAX9286_NUM_GMSL]; struct v4l2_async_notifier notifier; + u32 reverse_chan_amp; u32 overlap_window; }; @@ -479,10 +480,15 @@ static int max9286_notify_bound(struct v4l2_async_notifier *notifier, * All enabled sources have probed and enabled their reverse control * channels: * - * - Verify all configuration links are properly detected + * - Increase reverse channel amplitude to 170mV if not initially + * compensated * - Disable auto-ack as communication on the control channel are now * stable. */ + if (priv->reverse_chan_amp == 100) + max9286_write(priv, 0x3b, MAX9286_REV_TRF(1) | + MAX9286_REV_AMP(70) | MAX9286_REV_AMP_X); + max9286_check_config_link(priv, priv->source_mask); /* @@ -830,6 +836,8 @@ static void max9286_v4l2_unregister(struct max9286_priv *priv) static int max9286_setup(struct max9286_priv *priv) { + u8 chan_amp = MAX9286_REV_TRF(1); + /* * Link ordering values for all enabled links combinations. Orders must * be assigned sequentially from 0 to the number of enabled links @@ -869,12 +877,18 @@ static int max9286_setup(struct max9286_priv *priv) * * - 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. + * - Set initial reverse channel amplitude according the DTS property. + * If the initial channel amplitude is 100mV it should be increase + * later after the serializers high threshold have been enabled. + * If the initial value is 170mV the serializer has been + * pre-programmed and we can compensate immediately. */ 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); + if (priv->reverse_chan_amp == 100) + chan_amp |= MAX9286_REV_AMP(100); + else + chan_amp |= MAX9286_REV_AMP(70) | MAX9286_REV_AMP_X; + max9286_write(priv, 0x3b, chan_amp); usleep_range(2000, 2500); /* @@ -1069,6 +1083,21 @@ static int max9286_parse_dt(struct max9286_priv *priv) return -EINVAL; } + ret = of_property_read_u32(dev->of_node, "maxim,reverse-channel-amplitude", + &priv->reverse_chan_amp); + if (ret) { + dev_err(dev, + "Missing property \"maxim,reverse-channel-amplitude\"\n"); + of_node_put(dev->of_node); + return -EINVAL; + } + if (priv->reverse_chan_amp != 100 && priv->reverse_chan_amp != 170) { + dev_err(dev, "Unsupported channel amplitude %umV\n", + priv->reverse_chan_amp); + of_node_put(dev->of_node); + return -EINVAL; + } + i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux"); if (!i2c_mux) { dev_err(dev, "Failed to find i2c-mux node\n");