Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3100106pxb; Mon, 16 Nov 2020 05:56:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlG9++DTfBatF9GuPqUdS9MM0h5szi2LKe+NhskMoI9JNSUFHlwGRqoNeKfJIZalD8LoCd X-Received: by 2002:a05:6402:1155:: with SMTP id g21mr15668800edw.53.1605534994428; Mon, 16 Nov 2020 05:56:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605534994; cv=none; d=google.com; s=arc-20160816; b=uFSyaN6cOSOy+Ga16P+DsiGXvBPTx8Tw/9xz1Nufwpb8hW6G9gyvsTr/zDhKbmAXQr LYCf1+4gSInTtjCEObeUTlMiwBsUyOlBZwT9W8qR5p1cBLw9EX3PB0Sq+YsADU/T3iaJ cbrxiteN6bqD3QB2q9u6PFux0UupCSSHz20CWV62hqcIso5kFbFtCFFJbl4B6a69CKLC 9Wcbrtxxnt/YXdlkW1zCb+aV+KivYq1IVQyBQdu4rkwIqLJj95t0ngmpmJLxoZPsG3dZ XbFSljvPWQjDBp5UMDmNNBTzs1rHSny8jvrQ3xJFvL5YJnkBhqLeaQWqQxMQoRrxeyow SPKA== 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=Grq3/4ojYLjpUiGNgl3M2NmDBKmpMDoj04+tLxQZc7Y=; b=eVpD/tcQcw6xW5l4+lZmKlRwP9RL1bOOElKuBmbcAmz3+uCrrO0ygKcrS6Pv+bw18w 9zDuHHEBhAtmNaH+/am1xnApnWiu2TW5JVQyVC1ZhCZNCWILtch3rK9d9kA6Qbp+YWkE vvPgU7hGBZr2xDZtslduTn4/DSpVSsW1OIMVxOpN+JbrsYJQ+Cy1rKzzlypbuU4AYMES Ze/bBap2SiK1btG9EWiMhwBgd8WwTbNKeP4tjdCBO+sPtJhBvbfeZrKcVbzeUTPfsObP OzbwRA1YSowyScqq2FKzu+a9FihAeyoMrjzulzHoWM091YK7SKXO0cqdx0ZLwNe2eF+a 9xzw== 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 dm26si1021074edb.57.2020.11.16.05.56.11; Mon, 16 Nov 2020 05:56:34 -0800 (PST) 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 S1729603AbgKPNxe (ORCPT + 99 others); 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 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.29.1