Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5881438pxb; Tue, 16 Feb 2021 09:46:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+fO7iwSqWzATIaUva2Q5Jarf97jQJUbFKi9npAaESyQojnq19spxgbCJrnSgSzz1sjJxW X-Received: by 2002:a17:906:5e06:: with SMTP id n6mr2196850eju.19.1613497605935; Tue, 16 Feb 2021 09:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613497605; cv=none; d=google.com; s=arc-20160816; b=hLXQiBXbvOcpL42Iv4jvvFbY7EO+ucxDlinfYApJBgRHEUSsEswa59DW7GOuw5nbDT iUWe4maI4BXCDdwUE4yfRDWN9sjZCrjysTOFtYjyeN4Xd9U4d8M/q3AKxM2125njshVc ApR74wExRe6A+FbT7K8yrf9iJMvph2fF+UX29Xub0/Fk/S/SEz6BH3k/AfQpkGpoXgKB L8HWNFTdPUomq8M+f3DK+VQbOqXjGOZ+HUNhzMls9azDXU403/1Fic0geTmKMACUoJcA Oq31GzQWwHTOmPxVJ+XimJuCFE3P69DMXhNdm5ni/ed75VCyC/O5oZ4ijngPOzswNAsa OP+w== 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=hHwqagzZn5PrOpuNpHw6JGxizV+Pbp4tzQ54nII/dK0=; b=w6ZcA/LQVPQuER4gSZTxzhCGt7ZShgdvrKCkR5GR+eFrjgHcf5OulkiWHW4pYZEkjQ zmyGMAfo9gDOmK6t9RNslJyzLCFzmkcm96wQGxd8fKhAhsu/Yi62mIgYQKSPH6DHTBy/ GUlIrdMeDXLJnaDWGOVQUoY/sVAJaByhMulLiQg8JuN7fYDlHqTK7ZwD8rYH1otXOJj+ BKnqTICoIXR4IrQTEr+3RThzEpneRddpkOQE7J/KsbRbWbTUTqmRvTW25R47RH3JaJJx CR2Q1rJndyDvDbkiZqbLYCSaA88+ANKkHfM09k0Io+Pk1gNl3zKgIJwg3xGU/WKrC6k/ DPLA== 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 jw1si15652627ejc.74.2021.02.16.09.46.19; Tue, 16 Feb 2021 09:46:45 -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 S231244AbhBPRpn (ORCPT + 99 others); Tue, 16 Feb 2021 12:45:43 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:41669 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231230AbhBPRm7 (ORCPT ); Tue, 16 Feb 2021 12:42:59 -0500 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 3AE9E200016; Tue, 16 Feb 2021 17:41:46 +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 Subject: [PATCH 11/16] media: i2c: max9286: Cache channel amplitude Date: Tue, 16 Feb 2021 18:41:41 +0100 Message-Id: <20210216174146.106639-12-jacopo+renesas@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210216174146.106639-1-jacopo+renesas@jmondi.org> References: <20210216174146.106639-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 new requested value is the same as the currently configured one. 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 1f14cd817fbf..4afb5ca06448 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -164,6 +164,7 @@ struct max9286_priv { bool mux_open; u32 init_rev_chan_mv; + u32 rev_chan_mv; struct v4l2_ctrl_handler ctrls; struct v4l2_ctrl *pixelrate; @@ -340,8 +341,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. @@ -563,8 +571,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