Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3286028pxf; Mon, 15 Mar 2021 06:18:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqO9u0kZMCGe3qH9kFY2uHYy70cTKahKrUWanq94bj45CtohRc9MwQeAyKCJD5jpfhbcFC X-Received: by 2002:a05:6402:9:: with SMTP id d9mr29663101edu.67.1615814296296; Mon, 15 Mar 2021 06:18:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615814296; cv=none; d=google.com; s=arc-20160816; b=BiiQS4jOpD68e+nfud/CU/UkzE7r7jDk5BI0wRXKsHiGVGyZlrsipZjFF9GWS8C0lh GUCbu3XkTiJOH1337h4/jg2qmo5h4qrPsH9PX4Zr5cYGwlHXX4QaDdjv5xUfqnT2/E85 8r6yT1IVkLjZU5kYc+LvF44QQCqnFAx8dEhuWSaKJRrej89qrPR3b2aWS99DpgkNNVEY 3LUa0GiSCSSlL73o435u35xCi5+tWBdnlP+RJRRtARk5bxGBTr1XXxKW7HCCV0T8PsWW z9DBNso6t7N1JuAn0h6ZKBZbrXt3u+BQW9yl4wdVb0vwem6fiF4aP1hz0QppkGFMedYz 3Vfg== 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=TyLtauwXJEY2TE5bVhIrzNrhR8zNzfajrq5wqHbyAS2Af41dnrFYmfvEFLQy9IAYuH p2puIyP6pCxoJBH/pk8ba98qzih+/0c8xFsoQY3wy10pQHD1t79RLF+f17G09sjFE9bj iwPAViw2e106I6sfAogP3I4uMXNtVEl7qHSVhOZlPygjk0bPf/ARz8SPF0UJehd9R5NX claI49CZ9ABp+woiSKyUxAjpxBJIgc3HXndaSNC0U/bErQXEhq3rra3Z4vXuzdDC1rr8 LWL1gxop7CMHAvONqIQVXIIIuXBiLbJ3ajy0r8hUrqcAe+7rBLfLv+gO4e0ohA9XWCUa V42g== 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 dk18si11222674edb.178.2021.03.15.06.17.51; Mon, 15 Mar 2021 06:18:16 -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 S231233AbhCONQG (ORCPT + 99 others); Mon, 15 Mar 2021 09:16:06 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:60437 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbhCONPf (ORCPT ); Mon, 15 Mar 2021 09:15:35 -0400 X-Originating-IP: 79.22.58.175 Received: from uno.homenet.telecomitalia.it (host-79-22-58-175.retail.telecomitalia.it [79.22.58.175]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 95320FF803; Mon, 15 Mar 2021 13:15:30 +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 v2 14/18] media: i2c: max9286: Cache channel amplitude Date: Mon, 15 Mar 2021 14:15:08 +0100 Message-Id: <20210315131512.133720-15-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210315131512.133720-1-jacopo+renesas@jmondi.org> References: <20210315131512.133720-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