Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp593315pxb; Wed, 13 Jan 2021 10:57:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJx53SJoolJNlo8R1/anlnnqXBBBoKNMIxPFUf2464yLtNWY0hfW4YzndIkTxO+Rp6xn0uWg X-Received: by 2002:a17:907:10c8:: with SMTP id rv8mr2561479ejb.228.1610564267132; Wed, 13 Jan 2021 10:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610564267; cv=none; d=google.com; s=arc-20160816; b=ZCfuYM4nki9PNoU0GbS3QC9gK8J6GoOldSawlL7vBRmqh+G7nA6o5gS9Q8HB7mmUms +rgQvXFK8/FNw3jOEISyao8oZSlu6QvAR97Ow7KwuY+KuWpV5CKKyl0/k9+TGg/SAmrm Der4KfiYRiqMwolnZ4cvOIbZnQ9VbKNyKthgcRunwFMF0H+SkSbPH7GafjuKEu4EIK4q XkObaxnltyhgOel5mv+EZTBMHPb0XtsODGMPQd5mHLvc3dkwkhQo+JLKcH46NbJ2LkI8 Qo0dFVQd6ZCmAtQyU9g5Ri+C7lzTsnj0Gn8UUvZrb7zfQuRCxHqbX9FpGuQDTdH7lN+v DSdA== 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=05d+NDA6p3JU1a9V1Ft2a3GXKzxWt2bYn/mflutbPmoO5m+eTMoe4oYA2hV5bUkMUn FsynsWAjq4ZMngOi00J2tyPS9A2SCA3LIbXhAwwbGmGpXF3h26MsJ/Qil6ktkZmdf5L2 qSS1hkE7tJzz6x/nouKiIQOcWG3kiX8tR2n3Swvb4diOdMDynLwdKqBN0aS03ZN3QL02 FuO26fJyv0TM9BxwPUJNkoPt91czI1UvfzFpIJeUgdYCMNmh02HKXZcG526B2YAxW0/3 Sn2n2wYm3NVGvXBAtdLXox3Jbs7Loy+6cjRi5aH/wDo5Vv2In1HEuavJai8CQ3gVkzDy hrCg== 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 g1si1364180ejz.557.2021.01.13.10.57.23; Wed, 13 Jan 2021 10:57:47 -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 S1728611AbhAMSzx (ORCPT + 99 others); Wed, 13 Jan 2021 13:55:53 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:45741 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728552AbhAMSzw (ORCPT ); Wed, 13 Jan 2021 13:55:52 -0500 X-Originating-IP: 93.61.96.190 Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 670AB1C0011; Wed, 13 Jan 2021 18:55:08 +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 v7 5/7] media: i2c: max9286: Break-out reverse channel setup Date: Wed, 13 Jan 2021 19:55:03 +0100 Message-Id: <20210113185506.119808-6-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113185506.119808-1-jacopo+renesas@jmondi.org> References: <20210113185506.119808-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