Skip to content

Commit 902edc2

Browse files
Jacopo Mondimchehab
authored andcommitted
media: i2c: max9286: Cache channel amplitude
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 <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f78723e commit 902edc2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/media/i2c/max9286.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ struct max9286_priv {
165165

166166
/* The initial reverse control channel amplitude. */
167167
u32 init_rev_chan_mv;
168+
u32 rev_chan_mv;
168169

169170
struct v4l2_ctrl_handler ctrls;
170171
struct v4l2_ctrl *pixelrate;
@@ -341,8 +342,15 @@ static void max9286_configure_i2c(struct max9286_priv *priv, bool localack)
341342
static void max9286_reverse_channel_setup(struct max9286_priv *priv,
342343
unsigned int chan_amplitude)
343344
{
345+
u8 chan_config;
346+
347+
if (priv->rev_chan_mv == chan_amplitude)
348+
return;
349+
350+
priv->rev_chan_mv = chan_amplitude;
351+
344352
/* Reverse channel transmission time: default to 1. */
345-
u8 chan_config = MAX9286_REV_TRF(1);
353+
chan_config = MAX9286_REV_TRF(1);
346354

347355
/*
348356
* Reverse channel setup.
@@ -564,8 +572,7 @@ static int max9286_notify_bound(struct v4l2_async_notifier *notifier,
564572
* - Disable auto-ack as communication on the control channel are now
565573
* stable.
566574
*/
567-
if (priv->init_rev_chan_mv < 170)
568-
max9286_reverse_channel_setup(priv, 170);
575+
max9286_reverse_channel_setup(priv, 170);
569576
max9286_check_config_link(priv, priv->source_mask);
570577

571578
/*

0 commit comments

Comments
 (0)