[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Vfo18+PD8N1WaonLDHv=QLOdb6xpD_grVVj02L=GtqNDA@mail.gmail.com>
Date: Sat, 28 Mar 2020 20:56:39 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Ivan Mikhaylov <i.mikhaylov@...ro.com>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-iio <linux-iio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Mark Rutland <mark.rutland@....com>,
Rob Herring <robh+dt@...nel.org>
Subject: Re: [PATCH v4 2/2] iio: proximity: Add driver support for vcnl3020
proximity sensor
On Sat, Mar 28, 2020 at 5:11 PM Jonathan Cameron <jic23@...nel.org> wrote:
> On Fri, 27 Mar 2020 13:49:54 +0300
> Ivan Mikhaylov <i.mikhaylov@...ro.com> wrote:
...
> > Datasheet: http://www.vishay.com/docs/84150/vcnl3020.pdf
> > Signed-off-by: Ivan Mikhaylov <i.mikhaylov@...ro.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
Powered by blists - more mailing lists