From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Ivan Mikhaylov <i.mikhaylov@yadro.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio <linux-iio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH v4 2/2] iio: proximity: Add driver support for vcnl3020 proximity sensor
Date: Sat, 28 Mar 2020 20:56:39 +0200 [thread overview]
Message-ID: <CAHp75Vfo18+PD8N1WaonLDHv=QLOdb6xpD_grVVj02L=GtqNDA@mail.gmail.com> (raw)
In-Reply-To: <20200328151102.4279cb42@archlinux>
On Sat, Mar 28, 2020 at 5:11 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Fri, 27 Mar 2020 13:49:54 +0300
> Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
...
> > Datasheet: http://www.vishay.com/docs/84150/vcnl3020.pdf
> > Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
> A few things inline.
>
> I note Andy suggested a Datasheet tag, but has it actually been
> standardised?
I don't think so, but I bet it's a good idea to have it.
...
> > + rc = device_property_read_u32(data->dev, "led-current", &led_current);
>
> The presence of a firmware read (dt / acpi etc) means that the i2c id table
> isn't actually useful for probing.
...in case if there are no defaults hard coded in the driver.
> > + if (rc) {
> > + dev_err(data->dev, "Couldn't get led current (%d)", rc);
> > + return rc;
> > + }
...
> > + rc = regmap_read(data->regmap, VCNL_PS_RESULT_HI, &hi);
> > + if (rc)
> > + goto err_unlock;
> > + dev_dbg(data->dev, "result high byte 0x%x", hi);
> > +
> > + rc = regmap_read(data->regmap, VCNL_PS_RESULT_LO, &lo);
> > + if (rc)
> > + goto err_unlock;
>
> These are neigbouring registers. Can you not get away with a bulk read?
> The datasheet suggests the device does auto address incrementing.
>
> If you do that, you can read directly into an __be16/__le16 (I haven't
> checked which) and do an endian conversion to whatever the cpu is
> using.
Oh, indeed. How I missed this during my review? :-)
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2020-03-28 18:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-27 10:49 [PATCH v4 0/2] iio: proximity: driver for vcnl3020 Ivan Mikhaylov
2020-03-27 10:49 ` [PATCH v4 1/2] iio: proximity: provide device tree binding document Ivan Mikhaylov
2020-03-28 14:55 ` Jonathan Cameron
2020-03-27 10:49 ` [PATCH v4 2/2] iio: proximity: Add driver support for vcnl3020 proximity sensor Ivan Mikhaylov
2020-03-27 11:11 ` Andy Shevchenko
2020-03-28 15:11 ` Jonathan Cameron
2020-03-28 18:56 ` Andy Shevchenko [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='CAHp75Vfo18+PD8N1WaonLDHv=QLOdb6xpD_grVVj02L=GtqNDA@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=i.mikhaylov@yadro.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pmeerw@pmeerw.net \
--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).