Re: [PATCH 1/2] iio: proximity: vcnl3020: add proximity rate

From: Ivan Mikhaylov
Date: Wed Feb 24 2021 - 10:42:39 EST


On Sun, 2021-02-21 at 22:34 +0200, Andy Shevchenko wrote:
>
>
> On Tuesday, February 16, 2021, Ivan Mikhaylov <i.mikhaylov@xxxxxxxxx> wrote:
> > Add the proximity rate optional option and handling of it for
> > vishay vcnl3020.
> >
> > Signed-off-by: Ivan Mikhaylov <i.mikhaylov@xxxxxxxxx>
> > ---
> > drivers/iio/proximity/vcnl3020.c | 123 ++++++++++++++++++++++++++++++-
> > 1 file changed, 120 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/proximity/vcnl3020.c
> > b/drivers/iio/proximity/vcnl3020.c
> > index 37264f801ad0..833c5d5ac0a1 100644
> > --- a/drivers/iio/proximity/vcnl3020.c
> > +++ b/drivers/iio/proximity/vcnl3020.c
> > @@ -40,6 +40,17 @@
> > #define VCNL_ON_DEMAND_TIMEOUT_US 100000
> > #define VCNL_POLL_US 20000
> >
> > +static const int vcnl3020_prox_sampling_frequency[][2] = {
> > + {1, 950000},
>
> Can you confirm that’s the correct value and shan’t be 953125?

Yes, It is described in the documentation for vcnl3020, also vcnl4000.c driver
has same sampling frequency values for vcnl4020.

> > + {3, 906250},
> > + {7, 812500},
> > + {16, 625000},
> > + {31, 250000},
> > + {62, 500000},
> > + {125, 0},
> > + {250, 0},
> > +};
> > +
> > /**
> > * struct vcnl3020_data - vcnl3020 specific data.
> > * @regmap: device register map.
> > @@ -75,12 +86,37 @@ static u32 microamp_to_reg(u32 *val)
> > return *val /= 10000;
> > };
> >