Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp701022pxj; Wed, 16 Jun 2021 11:31:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3YhR/7WyHnS5PYSBLg6+u/+gf2I34Nt1vq/52ORUicUprYVUe6B1Jb4kwQBT9TyDToF3U X-Received: by 2002:a92:cc51:: with SMTP id t17mr666447ilq.113.1623868287426; Wed, 16 Jun 2021 11:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623868287; cv=none; d=google.com; s=arc-20160816; b=Gyqz4eiKL/ITEXJ8oBpc6k7DaLbMJfPSKgIpCxUt2Y0y+le82ZQx5bHvfVE5o3gARM w76B2zc5bzqg6AqOvJ84/65n/1dEjsjM658aMVsMNF6X9CwsLFXGiuiMeQqxw9i5Ic9h k5kOV8qBpvfR3uGIWpixs0qsQKbMKvQp/hqgmv+e0fWN1xKVW6deRBCayj6hdUvsWOEv NaofFG7Yb66DLQARjFV94/Yf/8j0DyJRc6U97ICzvD6WWT0oLqEqOpmHcrxkwfipoU4Y q80HrR6MJfnEcuyhYxqZnAdIZpDACVyZ3fhBtJx4n87xA3WgfK8YXQ+jfmhgULvOreXW +jAA== 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=+wKpK+tfmBRscwrXVmz3n4DCR1zkhTMaYbBNoXkSRoA=; b=HDGELX4z9CDEK5ZJcafINrdiv5U+uOxeiLrZBpzwPHGeMtHAfMRboHaNmaBb8fCHCN JZMnngaOXWqG2RSfrDslDiZWBC1vkvjQSJy3JP9QAUVcDJMzQdx0jgAIJiDlyHB/HYms eNkedujiMzhtDL0ZE815TylCICW6IewZvykbr+XuDiOPhfep6fhcvetCKsQJjbUJTaJG QIXrqXjcJn1KeE7yol+r6P8kBW7V+N5UvriZwMQ5U1FhFMk4YIBFbF4bN2NSMBMGREgZ mazMGQed3VPi5CVZwnPuc1JAwt41G/RvyGq6ukQKynC5waxt3pAv+dUtXbjcxAVWpwb9 qn7g== 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 t44si3195355jal.72.2021.06.16.11.31.10; Wed, 16 Jun 2021 11:31:27 -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 S232885AbhFPMrz (ORCPT + 99 others); Wed, 16 Jun 2021 08:47:55 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:36847 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232851AbhFPMrv (ORCPT ); Wed, 16 Jun 2021 08:47:51 -0400 Received: (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id CE3D61C001C; Wed, 16 Jun 2021 12:45:42 +0000 (UTC) From: Jacopo Mondi To: Hans Verkuil , kieran.bingham+renesas@ideasonboard.com, laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org Cc: Jacopo Mondi , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Laurent Pinchart Subject: [PATCH v5 03/15] media: i2c: max9286: Cache channel amplitude Date: Wed, 16 Jun 2021 14:46:04 +0200 Message-Id: <20210616124616.49249-4-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210616124616.49249-1-jacopo+renesas@jmondi.org> References: <20210616124616.49249-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 Cache the current channel amplitude in a driver variable to skip updating it if the newly requested value is the same as the currently configured one. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- drivers/media/i2c/max9286.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 82ec05e96cb7..ed1cdefe7c30 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -165,6 +165,7 @@ struct max9286_priv { /* The initial reverse control channel amplitude. */ u32 init_rev_chan_mv; + u32 rev_chan_mv; struct v4l2_ctrl_handler ctrls; struct v4l2_ctrl *pixelrate; @@ -341,8 +342,15 @@ static void max9286_configure_i2c(struct max9286_priv *priv, bool localack) static void max9286_reverse_channel_setup(struct max9286_priv *priv, unsigned int chan_amplitude) { + u8 chan_config; + + if (priv->rev_chan_mv == chan_amplitude) + return; + + priv->rev_chan_mv = chan_amplitude; + /* Reverse channel transmission time: default to 1. */ - u8 chan_config = MAX9286_REV_TRF(1); + chan_config = MAX9286_REV_TRF(1); /* * Reverse channel setup. @@ -564,8 +572,7 @@ static int max9286_notify_bound(struct v4l2_async_notifier *notifier, * - Disable auto-ack as communication on the control channel are now * stable. */ - if (priv->init_rev_chan_mv < 170) - max9286_reverse_channel_setup(priv, 170); + max9286_reverse_channel_setup(priv, 170); max9286_check_config_link(priv, priv->source_mask); /* -- 2.31.1