From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: "Paul J . Murphy" <paul.j.murphy@intel.com>,
Daniele Alessandrelli <daniele.alessandrelli@intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 6/6] media: i2c: ov9282: Fix device detection
Date: Thu, 21 Jul 2022 16:25:02 +0200 [thread overview]
Message-ID: <4156055.7s5MMGUR32@steina-w> (raw)
In-Reply-To: <YtQbCYCdUHcpnTs5@valkosipuli.retiisi.eu>
Hi,
Am Sonntag, 17. Juli 2022, 16:22:01 CEST schrieb Sakari Ailus:
> Hi Alexander,
>
> On Fri, Jul 15, 2022 at 09:48:58AM +0200, Alexander Stein wrote:
> > Apparently the Vision Components model (VC MIPI OV9281) does not support
> > address auto-increment, so probe fails with:
> > ov9282 2-0060: chip id mismatch: 9281!=92ff
> > Instead do two 1 byte reads and combine the result.
> >
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > Changes in v2:
> > * Fix commit message
> > * Add comment about prevented auto-increment
> > * Return early if reading ID register failed
> > * Reorder ID registers, smaller register number first
> >
> > drivers/media/i2c/ov9282.c | 15 ++++++++++++++-
> > 1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
> > index 263cdffc558f..532791304c3d 100644
> > --- a/drivers/media/i2c/ov9282.c
> > +++ b/drivers/media/i2c/ov9282.c
> > @@ -761,11 +761,24 @@ static int ov9282_set_stream(struct v4l2_subdev *sd,
> > int enable)>
> > static int ov9282_detect(struct ov9282 *ov9282)
> > {
> >
> > int ret;
> >
> > + u32 id[2];
> >
> > u32 val;
> >
> > - ret = ov9282_read_reg(ov9282, OV9282_REG_ID, 2, &val);
> > + /*
> > + * Some vendors prevent auto-increment, so each register has to
> > + * be read separately
> > + */
>
> I suppose it still works for writes I guess? Would be nice to have this in
> the comment.
>
> > + ret = ov9282_read_reg(ov9282, OV9282_REG_ID,
> > + 1, &id[0]);
>
> Fits on one line. Same below.
>
> > if (ret)
> >
> > return ret;
> >
> > + ret = ov9282_read_reg(ov9282, OV9282_REG_ID + 1,
> > + 1, &id[1]);
> > + if (ret)
> > + return ret;
> > +
> > + val = id[1];
> > + val |= (id[0] << 8);
> >
> > if (val != OV9282_ID) {
> >
> > dev_err(ov9282->dev, "chip id mismatch: %x!=%x",
imx290 is affected by the same problem. This can be handles by using regmap's
config option use_single_read=true.
Will convert to regmap to address this.
Best regards,
Alexander
prev parent reply other threads:[~2022-07-21 14:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 7:48 [PATCH v2 0/6] OV9281 support Alexander Stein
2022-07-15 7:48 ` [PATCH v2 1/6] media: i2c: ov9282: remove unused and unset i2c_client member Alexander Stein
2022-07-15 7:48 ` [PATCH v2 2/6] media: dt-bindings: media: Add compatible for ov9281 Alexander Stein
2022-07-15 7:48 ` [PATCH v2 3/6] media: i2c: ov9282: Add ov9281 compatible Alexander Stein
2022-07-17 14:23 ` Sakari Ailus
2022-07-18 11:42 ` Alexander Stein
2022-07-15 7:48 ` [PATCH v2 4/6] media: dt-bindings: media: ov9282: Add power supply properties Alexander Stein
2022-07-15 7:48 ` [PATCH v2 5/6] media: i2c: ov9282: Add regulator support Alexander Stein
2022-07-17 14:17 ` Sakari Ailus
2022-07-18 6:42 ` Alexander Stein
2022-07-15 7:48 ` [PATCH v2 6/6] media: i2c: ov9282: Fix device detection Alexander Stein
2022-07-17 14:22 ` Sakari Ailus
2022-07-18 6:45 ` Alexander Stein
2022-07-21 14:25 ` Alexander Stein [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4156055.7s5MMGUR32@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=daniele.alessandrelli@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=paul.j.murphy@intel.com \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox