Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1073595pxu; Fri, 16 Oct 2020 03:12:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2cvN4rAf+cujTcYWMdebY7jfavH+cMPisXbIKgkAedG2pWMlSyy8/lVuoV/2sEnINMTXw X-Received: by 2002:a17:906:c293:: with SMTP id r19mr2779013ejz.63.1602843125328; Fri, 16 Oct 2020 03:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602843125; cv=none; d=google.com; s=arc-20160816; b=uO3Ie0OkICffceNCRHUdbOGPevMqObIhPwySNsntGun3+nlf0kSXKWbjXkDD8tanr9 6pUtc6FJYJ3PdCOAga/BX0z00xC/ihkCZJyhL1tSIhAPq0IKsB3rBSI+hofER85Zkbkx dxMO20UgDJW3gwJy3Q8OgF2hUqyVDMx6i+CKwAu9ZtVkJqjV77BWARn3eODXGR0fBMv4 1p0lTTnwH9WybR+MOcYIDSjE1iYfa6QlpLcXPAm88S19XZPYwa7BsigasoSx/J9Jseyk 4/jefjEEpO+yDFqO4VBV55UwXozlsiqzUVzzygMH1EPKoXma2DDiAYSa5Ke1n5mHside V6hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VNzw+R9x1+RCRD7P06cJB+Fc4kykVHB7tsY53TbhMtU=; b=RT2noytqVr4P23Sy2M9m5r9LJbYDn51oPDnAkO/4FyxCuCNElSjqMIBEf/jXP7V77G XcyepGFk1Auv4YcIG5S+IAkpWDNnB1RzFSh7/yM1WYNhE62hg+XKYltaS0U6tN9BYnbF LNpPf2XMPyZNeSjN/aDVtHNDkIMpu7Yrhxp9oYXU6sjpJuv8BQ1yDRBM+OkpXDK/h9/D v2nPklwg7WnvNYSXerpEabSWRSqwpx2DVODJeyLLy1gAy73JbHnX50qmfVPQKivVq3nF ZQSAqX43waEQTG5RF4SBkMXcheQTbCz9hzldiWbh3RxS5z845xEbVo3T3Vu05gviWrBF WsQA== ARC-Authentication-Results: i=1; mx.google.com; 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 b1si1556281ejb.112.2020.10.16.03.11.43; Fri, 16 Oct 2020 03:12:05 -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; 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 S2406581AbgJPKHL (ORCPT + 99 others); Fri, 16 Oct 2020 06:07:11 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:49505 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406557AbgJPKHD (ORCPT ); Fri, 16 Oct 2020 06:07:03 -0400 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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id C6659E0017; Fri, 16 Oct 2020 10:06:58 +0000 (UTC) From: Jacopo Mondi To: kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se Cc: Jacopo Mondi , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Hyun Kwon , Manivannan Sadhasivam , Kieran Bingham Subject: [PATCH v3 3/7] media: i2c: max9286: Break-out reverse channel setup Date: Fri, 16 Oct 2020 14:06:21 +0200 Message-Id: <20201016120625.64337-4-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016120625.64337-1-jacopo+renesas@jmondi.org> References: <20201016120625.64337-1-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 -- 2.28.0