Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7445911pxb; Thu, 18 Feb 2021 10:13:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJya6/Jbd/TnFhQrzl2TBnm1q0HG1QASS5mdcpKbcQJVk4jTG/5es/XBcKUNNtu8LFFd5qrR X-Received: by 2002:a05:6402:2210:: with SMTP id cq16mr5280582edb.148.1613671989323; Thu, 18 Feb 2021 10:13:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613671989; cv=none; d=google.com; s=arc-20160816; b=oMI2fdgVQqmUGYUDJWibpxJT+spw9yyeG9uY234Lkn3+eceMVtLQUG3CjFrjcNjcVr 9nms5vKkZFLSPjr0Vj9YmfbzIBljkVqdJLAQDjWyh5Mkxlff0M8qHBaXHJSbWERiOxrx lIADyiLQ0XMuMqG7NYBo3kReDjsY+5WGWzdiX7aiMOXDp8VfDz1adABC/4y7vaJX9prI PPemS2QPa98d6W06VW0aVQJg+f9pth/5pYQ5b7eTcfR7wcVbr2IW3gqqD3UP63Hrx7mu EiC+2jVaBVdZy1OPETvHoVp2G4EmfSoL+sg7io+qp6czRAwRtmqFrRuljZste3pyIw6q +uTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:reply-to:dkim-signature; bh=dBJwyE+XXwTVQ2BSW5bmR0r6g3Lw0EHvtIN+woQTGho=; b=FEoK2e8fzy4j23+bHc/NvsPWXv6QhAzOUGSiQ831IHC7hYBktF4LZliBPrL0BW3j+g fnP1jhN0XkEmrn48i86vh3/APABtAAH0qFXcfiaXe27PdLJoTqK17KaQYGDfaSJlPzG2 hNukiy1bVXL+FlipMDYf/AgqRd9jCQc83WDnVus4v26NafEf8C7DpBF12Ldd/yikkCmT axNBLGb+Rd6rYFSOIDrKGe5WP6OIhdhH2ogSYZmamuY1Yzf/rKE8tplX5ESPe5Pfg7ZX B/qoBNJsAQ5JHVwd9ZDroGcqEI+wxxKYUs3Q1e53gw9uqPzM+oAw/LlhejsBjma2P72Y QoZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jvXFmBq7; 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 de20si3949800ejc.753.2021.02.18.10.12.43; Thu, 18 Feb 2021 10:13:09 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jvXFmBq7; 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 S230253AbhBRSJs (ORCPT + 99 others); Thu, 18 Feb 2021 13:09:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232455AbhBRPkY (ORCPT ); Thu, 18 Feb 2021 10:40:24 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2478C061574; Thu, 18 Feb 2021 07:39:41 -0800 (PST) Received: from [192.168.0.20] (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E3913E7; Thu, 18 Feb 2021 16:39:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1613662780; bh=DmnvdwZV8yESaBMJksJjQrvF/K8QlpTjEqk5yRbepCU=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=jvXFmBq7P95/RylozLm6qa5y5bZxYWP0ZUAYBEFJKhxMU1NGGi04lR6hXoJnQ60Xf OUaZBTGvg1RC2B99xdWSvAHluasdew8Har76VRc8FEe/V82tNiVH7WvhJ5ToHTBmna cgreUgH0SMcjMXqOrJt3v/nANy0Q67YfqDpoCWQw= Reply-To: kieran.bingham+renesas@ideasonboard.com Subject: Re: [PATCH 11/16] media: i2c: max9286: Cache channel amplitude To: Jacopo Mondi , laurent.pinchart+renesas@ideasonboard.com, niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210216174146.106639-1-jacopo+renesas@jmondi.org> <20210216174146.106639-12-jacopo+renesas@jmondi.org> From: Kieran Bingham Organization: Ideas on Board Message-ID: <2b62ff38-7c9c-c24f-b7a6-8e3a65d3f669@ideasonboard.com> Date: Thu, 18 Feb 2021 15:39:37 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210216174146.106639-12-jacopo+renesas@jmondi.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/02/2021 17:41, Jacopo Mondi wrote: > 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 I like this model better than deciding outside of the call :-) Reviewed-by: Kieran Bingham > --- > 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); > > /* >