Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp734854pxu; Thu, 15 Oct 2020 15:24:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZmPl0Pc3k575iCZa0XWgUBhOcGgNQ2NYDlMoKDYnsqu5PG7NFcBr53dc7XqSa3/j/n2gX X-Received: by 2002:a05:6402:187:: with SMTP id r7mr659458edv.360.1602800679159; Thu, 15 Oct 2020 15:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602800679; cv=none; d=google.com; s=arc-20160816; b=MyE0Wga5Go27gos4NwipDb1u76l777SgGsX6nKY63BclQ77jeXAUdTRw39TxFOm+yq t5pivqAIOl3zes+wN4eSfIKJsdT64cidTEGIASozR5YE4WKbKpsFMIdCbDTe0MP3hlnV f5Yd0n1fsQpnYu6bVjaJWipgk8y6x76IgiwijzLeyvCcPZvarNKk0Ixs5N7LY8AafjJY WIYMFbd2H9ynAHidEqgG/X9HonyeAoVZr+10BCcavYby6xoDht4IL57IUvN5cGLD62Uq E+tAza/ONWtrV8vqmHwic+0XgAuwFskIB2shUnX9D3zbBBsUCT6ag7l5U2iqa2ni1a59 4twg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:reply-to:dkim-signature; bh=/dkZ8dVjnTnKQu2Fh/HM8o3j2bKDkfXCvinuPjZq4xU=; b=tT03b5QFkpuQkAFwgCj/GZvKiXgS7qFkYECJLFuaAInPScqIYbPF5p768di3EoSuo4 8xNFGzQESL7Z4LZOvYY9JYWWfaRVuffbCW5Pe0SCGj2lcn/7n/mcTtmUY0OX4ROMWDQE ROJV28SulUhgWzSvOgUm0/uegGeo5pV1k5aZldigp5ZthrrU06GDeQ8AvLLA4l3yaVwH Oe2d7JNxnq24+pF+FIESiIH6V3TMpAdTFzqvfW5cXybR8sCR+OycsIgLC0mCda54LubN a3HsE1qj/ZJMCgsHAocgssVbe6flcQgV5PevKslC98P1RugyySHyBMKpf/0th4Cd7jjZ 8eYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=LaslllP2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si191190edw.591.2020.10.15.15.24.17; Thu, 15 Oct 2020 15:24:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=LaslllP2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392064AbgJOUAr (ORCPT + 99 others); Thu, 15 Oct 2020 16:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392040AbgJOUAr (ORCPT ); Thu, 15 Oct 2020 16:00:47 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CECDBC061755; Thu, 15 Oct 2020 13:00:46 -0700 (PDT) Received: from [192.168.0.20] (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D0345556; Thu, 15 Oct 2020 22:00:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602792043; bh=izH9H8iQTzC30m7jO8b83gxSPSpkQpnsFsc295p+2gQ=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=LaslllP2tLXqaertoBfp3WntC4heYm1W8By273rWKlQkyrZxzDO5A8Kq5JGEZJPkC dLC8pDPWJ9zZVgQ7GLL+6udaihaWK97uCTDO/xlyyAXwrCaF4pYJV5o4cyEqKnAYND 99Nwzj4XVtPwjm98ZVEpQTtD6sHw8z+Acbc6ljec= Reply-To: kieran.bingham+renesas@ideasonboard.com Subject: Re: [PATCH v2 4/7] media: i2c: max9286: Make channel amplitude programmable To: Jacopo Mondi , laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Hyun Kwon , Manivannan Sadhasivam References: <20201015182710.54795-1-jacopo+renesas@jmondi.org> <20201015182710.54795-5-jacopo+renesas@jmondi.org> From: Kieran Bingham Organization: Ideas on Board Message-ID: Date: Thu, 15 Oct 2020 21:00:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201015182710.54795-5-jacopo+renesas@jmondi.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacopo, On 15/10/2020 19:27, Jacopo Mondi wrote: > Instrument the function that configures the reverse channel with a > programmable amplitude value. > > This change serves to prepare to adjust the reverse channel amplitude > depending on the remote end high-threshold configuration. > > Signed-off-by: Jacopo Mondi > --- > drivers/media/i2c/max9286.c | 22 ++++++++++++++++------ > 1 file changed, 16 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c > index 89a7248f5c25..163e102199e3 100644 > --- a/drivers/media/i2c/max9286.c > +++ b/drivers/media/i2c/max9286.c > @@ -906,19 +906,29 @@ static void max9286_v4l2_unregister(struct max9286_priv *priv) > * Probe/Remove > */ > > -static void max9286_reverse_channel_setup(struct max9286_priv *priv) > +static void max9286_reverse_channel_setup(struct max9286_priv *priv, > + unsigned int chan_amplitude) > { > + /* Reverse channel transmission time: default to 1. */ > + u8 chan_config = MAX9286_REV_TRF(1); > + > /* > * 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. > + * - Adjust reverse channel amplitude: values > 130 are programmed > + * using the additional +100mV REV_AMP_X boost flag > */ > 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); > + Should we also clamp to min/max values at all? Probably not needed, as it's only an internal helper. > + if (chan_amplitude > 100) { > + /* It is not possible express values (100 < x < 130) */ 'possible to express' > + chan_amplitude = chan_amplitude < 130 > + ? 30 : chan_amplitude - 100; We could round < 115 to 100, and >= 115 to 130, but that's probably more effort that it's worth, so I think this is fine. I think it's really helpful to codify this parameter though: Reviewed-by: Kieran Bingham > + chan_config |= MAX9286_REV_AMP_X; > + } > + max9286_write(priv, 0x3b, chan_config | MAX9286_REV_AMP(chan_amplitude)); > usleep_range(2000, 2500); > } > > @@ -957,7 +967,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); > + max9286_reverse_channel_setup(priv, 170); > > /* > * Enable GMSL links, mask unused ones and autodetect link >