Message ID | 20220101232637.32104-1-laurent.pinchart+renesas@ideasonboard.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Kieran Bingham |
Headers | show |
Series | media: i2c: max9286: Small new features | expand |
Hi Laurent On Sun, Jan 02, 2022 at 01:26:37AM +0200, Laurent Pinchart wrote: > The power-up GMSL link configuration is controlled by the HIM and BWS > pins, whose state is reflected in register 0x1c. Print the detected > power-up config in a debug message to help debugging. > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Thanks j > --- > drivers/media/i2c/max9286.c | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c > index 446fc238d642..f7cbfdde436e 100644 > --- a/drivers/media/i2c/max9286.c > +++ b/drivers/media/i2c/max9286.c > @@ -1147,6 +1147,7 @@ static int max9286_setup(struct max9286_priv *priv) > (2 << 6) | (1 << 4) | (0 << 2) | (3 << 0), /* 210x */ > (3 << 6) | (2 << 4) | (1 << 2) | (0 << 0), /* 3210 */ > }; > + int cfg; > > /* > * Set the I2C bus speed. > @@ -1168,21 +1169,23 @@ static int max9286_setup(struct max9286_priv *priv) > max9286_set_video_format(priv, &max9286_default_format); > max9286_set_fsync_period(priv); > > + cfg = max9286_read(priv, 0x1c); > + if (cfg < 0) > + return cfg; > + > + dev_dbg(&priv->client->dev, "power-up config: %s immunity, %u-bit bus\n", > + cfg & MAX9286_HIGHIMM(0) ? "high" : "legacy", > + cfg & MAX9286_BWS ? 32 : cfg & MAX9286_HIBW ? 27 : 24); > + > if (priv->bus_width) { > - int val; > - > - val = max9286_read(priv, 0x1c); > - if (val < 0) > - return val; > - > - val &= ~(MAX9286_HIBW | MAX9286_BWS); > + cfg &= ~(MAX9286_HIBW | MAX9286_BWS); > > if (priv->bus_width == 27) > - val |= MAX9286_HIBW; > + cfg |= MAX9286_HIBW; > else if (priv->bus_width == 32) > - val |= MAX9286_BWS; > + cfg |= MAX9286_BWS; > > - max9286_write(priv, 0x1c, val); > + max9286_write(priv, 0x1c, cfg); > } > > /* > -- > Regards, > > Laurent Pinchart >
diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index 446fc238d642..f7cbfdde436e 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -1147,6 +1147,7 @@ static int max9286_setup(struct max9286_priv *priv) (2 << 6) | (1 << 4) | (0 << 2) | (3 << 0), /* 210x */ (3 << 6) | (2 << 4) | (1 << 2) | (0 << 0), /* 3210 */ }; + int cfg; /* * Set the I2C bus speed. @@ -1168,21 +1169,23 @@ static int max9286_setup(struct max9286_priv *priv) max9286_set_video_format(priv, &max9286_default_format); max9286_set_fsync_period(priv); + cfg = max9286_read(priv, 0x1c); + if (cfg < 0) + return cfg; + + dev_dbg(&priv->client->dev, "power-up config: %s immunity, %u-bit bus\n", + cfg & MAX9286_HIGHIMM(0) ? "high" : "legacy", + cfg & MAX9286_BWS ? 32 : cfg & MAX9286_HIBW ? 27 : 24); + if (priv->bus_width) { - int val; - - val = max9286_read(priv, 0x1c); - if (val < 0) - return val; - - val &= ~(MAX9286_HIBW | MAX9286_BWS); + cfg &= ~(MAX9286_HIBW | MAX9286_BWS); if (priv->bus_width == 27) - val |= MAX9286_HIBW; + cfg |= MAX9286_HIBW; else if (priv->bus_width == 32) - val |= MAX9286_BWS; + cfg |= MAX9286_BWS; - max9286_write(priv, 0x1c, val); + max9286_write(priv, 0x1c, cfg); } /*
The power-up GMSL link configuration is controlled by the HIM and BWS pins, whose state is reflected in register 0x1c. Print the detected power-up config in a debug message to help debugging. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/media/i2c/max9286.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)