Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp424372pxb; Thu, 14 Jan 2021 09:07:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOKC6oUUPxEDl2Oa4/3obB5kBMaK7ZBCbKccbP/gLEEpwLaSW8iX4uolRT5FjGBGhb0h5z X-Received: by 2002:a05:6402:404:: with SMTP id q4mr6608797edv.295.1610644076786; Thu, 14 Jan 2021 09:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610644076; cv=none; d=google.com; s=arc-20160816; b=cpd31pnSH9kQfUedovHESDUZVpJgcD9yse9cV0U/2eVretPfouzLHJigOv9HaYmceu E6AseYE8ZpboJVHLkLjwsmG1D2VsJdg0m44IF6CYsViWT4Zf5EBQ+V7Cuwq1VhqBWR4a VSXrczVFescDUkS1zmOBgVersHhtSu77IoBvIiHqzlfeBUlB6tW/Ky4XjZ9NAh7jNnWd MgxUL0lemJg67AcuhWjVOiHRKI6R3Ggx02OzxGhtPmRQZ38cbMP9V2N1nk5L1771T+Mn G+1swnBe/cQzFpEznJ3OpgKCLvsHV2+JLd9ya+/zYggJxWWtjf336VHcwaBhw3JwpTub p+Wg== 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=6+VT9j/dYfTdd5UfndILJcwA5oxbOmv3GpJWHG7iKjc=; b=uaL/RBMI15al3fiCRXqRAiohfBEHj78xnRGIOUL1sNgYRMvXZ9NliKDPjlO2rVkLIL +aefFFx+80HU3bnTATlNqonXzFLC/lvlAhKiDwf9+uvk5I+kbKZdcpZkGqNBCYbPQBRL X87H/2G6K3m7Mv9ZX/mT81sOMHEj4aC7utFrel1KAMeGQ23t2CFh8dlh/VjPPLRR3jSh 6NTPm7Xg2l0cSKelTJ1kvGw/8LX/lwRj6z6Zr/1Gao8vJXDmzihdExVAGuHV3bvrx5Uo YPBDUn825brIsAZ0ozZS7Eu1Ft2Aqh8AtIXPEoq4iVdfxjoD39FdU/0bJp9LXGEI6PcK 1gOw== 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 a15si964959eju.226.2021.01.14.09.07.31; Thu, 14 Jan 2021 09:07:56 -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 S1728001AbhANRFU (ORCPT + 99 others); Thu, 14 Jan 2021 12:05:20 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:53119 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727793AbhANRFR (ORCPT ); Thu, 14 Jan 2021 12:05:17 -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 883C040006; Thu, 14 Jan 2021 17:04: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, Laurent Pinchart , Kieran Bingham Subject: [PATCH v8 3/5] media: i2c: max9286: Break-out reverse channel setup Date: Thu, 14 Jan 2021 18:04:27 +0100 Message-Id: <20210114170429.139762-4-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210114170429.139762-1-jacopo+renesas@jmondi.org> References: <20210114170429.139762-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: Laurent Pinchart 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 c82c1493e099..1cfc8801c0b2 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.2