Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1557859pxf; Fri, 19 Mar 2021 09:43:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx03U8LIbbVttNaFZlawm4p49h72kQahCXJeD14GjOr66pVgk7/8mBLrxCwAEqlnIXovejH X-Received: by 2002:a17:906:f9db:: with SMTP id lj27mr5385215ejb.399.1616172206926; Fri, 19 Mar 2021 09:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616172206; cv=none; d=google.com; s=arc-20160816; b=jgFF/ZSP3AS+aWYrByXlWhi999KQvM2S5o2hL0q2Cgu7D8W474UTOFWNJQAXgL/8JB Xv3WLBujCF+EjzcO6QuPk0RHV51wUdXvX5lkVcoTDwYPfMPdUdBctC6SHnoPEFQoFGz9 iNsbjgmYaoSqiZoPR7Wws3lliZk8gkUaXPxeMMjsD8ai356AyMm6Wh1p+yiFgR9dPbke 22eDA+rcv25Sw6cG5yl7pKzJkfNgOaVEQlGMNIAOmUVm4buNpy8/O4eG6hNB95W/K5sa s51BXQLx7rQXwSLjWoxAUtKzhmq0tAVaGHfmkWRF8qpfPadjAAeUJAPeT38oJeCmAbmS 3olQ== 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=FpRzQVnJb1/I6RBCB7D00TygHAzNQhDbKetF8PCbycc=; b=Wx+mKkrB7p6P7u6BmC7mR993mv9J8Nq2tOm9V0g/xBN3Ar1O8ZKlYZY9p4zR1vH/6l /yZUHjFphhnX1110pouPeHsjwQ33XVjr18RPWk6r/9hPEfD709H9PfU0+ewdBCJEOw24 7uZvBQmMvwAuIbJsVywR1D719xNi3kepTW1ZwGWn64hH8rr9r6V1V9imz+1d7JsKZLpA CBevYRJois/FIbq2WMBDjlTx61pllmpRzQCKWwyDIWZcQowqxBgIo0dVVBJ4x9pbeUoR RbLFpwnX5ZplDx0Xs2/iuQ2kLjGmW9kIIbZMm6gVkpoUA5qskJoDCGy77h4rCrTebZVo X/Uw== 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 h15si4617456edw.371.2021.03.19.09.43.04; Fri, 19 Mar 2021 09:43:26 -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 S230203AbhCSQlt (ORCPT + 99 others); Fri, 19 Mar 2021 12:41:49 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:36321 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229973AbhCSQlm (ORCPT ); Fri, 19 Mar 2021 12:41:42 -0400 X-Originating-IP: 5.92.35.220 Received: from uno.localdomain (mob-5-92-35-220.net.vodafone.it [5.92.35.220]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 9FF1FC000D; Fri, 19 Mar 2021 16:41:38 +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 , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Laurent Pinchart Subject: [PATCH v3 03/19] media: i2c: max9286: Cache channel amplitude Date: Fri, 19 Mar 2021 17:41:32 +0100 Message-Id: <20210319164148.199192-4-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210319164148.199192-1-jacopo+renesas@jmondi.org> References: <20210319164148.199192-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. Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- 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.30.0