lkml.org 
[lkml]   [2020]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@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

\
 
 \ /
  Last update: 2020-03-28 19:57    [W:0.042 / U:1.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site