From: "Alessandrelli, Daniele" <daniele.alessandrelli@intel.com>
To: "Murphy, Paul J" <paul.j.murphy@intel.com>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"alexander.stein@ew.tq-group.com"
<alexander.stein@ew.tq-group.com>,
"krzysztof.kozlowski+dt@linaro.org"
<krzysztof.kozlowski+dt@linaro.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 6/6] media: i2c: ov9282: Fix device detection
Date: Mon, 11 Jul 2022 19:58:11 +0000 [thread overview]
Message-ID: <2fabd63f6494770de39187e16a83b8ec50b90355.camel@intel.com> (raw)
In-Reply-To: <20220711081639.150153-7-alexander.stein@ew.tq-group.com>
On Mon, 2022-07-11 at 10:16 +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 two a 1 byte reads to combine the result.
I think some word is missing from this last statement.
>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> drivers/media/i2c/ov9282.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
> index c3faf11a99b5..c507d9d4531a 100644
> --- a/drivers/media/i2c/ov9282.c
> +++ b/drivers/media/i2c/ov9282.c
> @@ -761,11 +761,16 @@ 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);
> - if (ret)
> - return ret;
> + ret = ov9282_read_reg(ov9282, OV9282_REG_ID + 1,
> + 1, &id[1]);
Please add a comment explaining why reading one byte at a time is
needed.
> + if (!ret)
> + ret = ov9282_read_reg(ov9282, OV9282_REG_ID,
> + 1, &id[0]);
Shouldn't we return in case of error? As the original code was doing?
> + val = id[1];
> + val |= (id[0] << 8);
>
> if (val != OV9282_ID) {
> dev_err(ov9282->dev, "chip id mismatch: %x!=%x",
prev parent reply other threads:[~2022-07-11 19:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 8:16 [PATCH 0/6] OV9281 support Alexander Stein
2022-07-11 8:16 ` [PATCH 1/6] media: i2c: ov9282: remove unused and unset i2c_client member Alexander Stein
2022-07-11 19:34 ` Alessandrelli, Daniele
2022-07-11 8:16 ` [PATCH 2/6] media: dt-bindings: media: Add compatible for ov9281 Alexander Stein
2022-07-11 9:17 ` Krzysztof Kozlowski
2022-07-11 8:16 ` [PATCH 3/6] media: i2c: ov9282: Add ov9281 compatible Alexander Stein
2022-07-11 19:34 ` Alessandrelli, Daniele
2022-07-11 8:16 ` [PATCH 4/6] media: dt-bindings: media: ov9282: Add power supply properties Alexander Stein
2022-07-11 9:17 ` Krzysztof Kozlowski
2022-07-11 11:45 ` Alexander Stein
2022-07-11 12:02 ` Krzysztof Kozlowski
2022-07-11 8:16 ` [PATCH 5/6] media: i2c: ov9282: Add regulator support Alexander Stein
2022-07-11 19:54 ` Alessandrelli, Daniele
2022-07-11 8:16 ` [PATCH 6/6] media: i2c: ov9282: Fix device detection Alexander Stein
2022-07-11 19:58 ` Alessandrelli, Daniele [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=2fabd63f6494770de39187e16a83b8ec50b90355.camel@intel.com \
--to=daniele.alessandrelli@intel.com \
--cc=alexander.stein@ew.tq-group.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 \
/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;
as well as URLs for NNTP newsgroup(s).