mbox series

[v3,0/2] Add ps_it attributes for vcnl4040

Message ID 20220926091900.1724105-1-marten.lindahl@axis.com (mailing list archive)
Headers show
Series Add ps_it attributes for vcnl4040 | expand

Message

Mårten Lindahl Sept. 26, 2022, 9:18 a.m. UTC
Currently there is no way for userspace to make any configuration of
the VCNL4040 sensors, but only the sensor readings are exported in
sysfs. To support configuration for proximity integration time value,
sysfs attributes for this needs to be exported.

To begin with the runtime power management turns both sensors (ALS, and
PS) on before reading the sensor register values and then switches
them off again. But when doing so it writes the whole register instead
of just switching the power on/off bit. This needs to be fixed in order
to make other persistent configurations.

Kind regards
Mårten Lindahl

Changes in v3:
 - Rename defines for ALS/PS shutdown bits
 - Add local variable for building register value

Changes in v2:
 - Removed unnecessary switch for chip id
 - Guard read/write sequence against potential race
 - Remove confusing boolean operation
 - Use bitmask macros instead of local field shifting
 - Use .read_avail callback instead of using IIO_CONST_ATTR
 - Skip [PATCH 2/3] iio: light: vcnl4000: Add enable attributes for vcnl4040

Mårten Lindahl (2):
  iio: light: vcnl4000: Preserve conf bits when toggle power
  iio: light: vcnl4000: Add ps_it attributes for vcnl4040

 drivers/iio/light/vcnl4000.c | 185 +++++++++++++++++++++++++++++++++--
 1 file changed, 179 insertions(+), 6 deletions(-)

Comments

Mårten Lindahl Nov. 7, 2022, 7:47 a.m. UTC | #1
On Mon, Sep 26, 2022 at 11:18:58AM +0200, Mårten Lindahl wrote:
> Currently there is no way for userspace to make any configuration of
> the VCNL4040 sensors, but only the sensor readings are exported in
> sysfs. To support configuration for proximity integration time value,
> sysfs attributes for this needs to be exported.
> 
> To begin with the runtime power management turns both sensors (ALS, and
> PS) on before reading the sensor register values and then switches
> them off again. But when doing so it writes the whole register instead
> of just switching the power on/off bit. This needs to be fixed in order
> to make other persistent configurations.
> 
> Kind regards
> Mårten Lindahl

Hi!

I suspect this mail may have slipped through unnoticed since there has
not been any comments on it. v2 had some minor comments which I hope I
fixed.

Jonathan?

Kind regards
Mårten

> 
> Changes in v3:
>  - Rename defines for ALS/PS shutdown bits
>  - Add local variable for building register value
> 
> Changes in v2:
>  - Removed unnecessary switch for chip id
>  - Guard read/write sequence against potential race
>  - Remove confusing boolean operation
>  - Use bitmask macros instead of local field shifting
>  - Use .read_avail callback instead of using IIO_CONST_ATTR
>  - Skip [PATCH 2/3] iio: light: vcnl4000: Add enable attributes for vcnl4040
> 
> Mårten Lindahl (2):
>   iio: light: vcnl4000: Preserve conf bits when toggle power
>   iio: light: vcnl4000: Add ps_it attributes for vcnl4040
> 
>  drivers/iio/light/vcnl4000.c | 185 +++++++++++++++++++++++++++++++++--
>  1 file changed, 179 insertions(+), 6 deletions(-)
> 
> -- 
> 2.30.2
>
Jonathan Cameron Nov. 7, 2022, 4:44 p.m. UTC | #2
On Mon, 7 Nov 2022 08:47:54 +0100
Marten Lindahl <martenli@axis.com> wrote:

> On Mon, Sep 26, 2022 at 11:18:58AM +0200, Mårten Lindahl wrote:
> > Currently there is no way for userspace to make any configuration of
> > the VCNL4040 sensors, but only the sensor readings are exported in
> > sysfs. To support configuration for proximity integration time value,
> > sysfs attributes for this needs to be exported.
> > 
> > To begin with the runtime power management turns both sensors (ALS, and
> > PS) on before reading the sensor register values and then switches
> > them off again. But when doing so it writes the whole register instead
> > of just switching the power on/off bit. This needs to be fixed in order
> > to make other persistent configurations.
> > 
> > Kind regards
> > Mårten Lindahl  
> 
> Hi!
> 
> I suspect this mail may have slipped through unnoticed since there has
> not been any comments on it. v2 had some minor comments which I hope I
> fixed.
> 
> Jonathan?

It's queued up. Not sure why I failed to send an email though - I'll probably
find it's in my outbox on the other laptop or something equally silly.

https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/drivers/iio/light/vcnl4000.c?h=testing&id=1a09d52bf0cab10580ab52f04f8b182f279be455

Jonathan

> 
> Kind regards
> Mårten
> 
> > 
> > Changes in v3:
> >  - Rename defines for ALS/PS shutdown bits
> >  - Add local variable for building register value
> > 
> > Changes in v2:
> >  - Removed unnecessary switch for chip id
> >  - Guard read/write sequence against potential race
> >  - Remove confusing boolean operation
> >  - Use bitmask macros instead of local field shifting
> >  - Use .read_avail callback instead of using IIO_CONST_ATTR
> >  - Skip [PATCH 2/3] iio: light: vcnl4000: Add enable attributes for vcnl4040
> > 
> > Mårten Lindahl (2):
> >   iio: light: vcnl4000: Preserve conf bits when toggle power
> >   iio: light: vcnl4000: Add ps_it attributes for vcnl4040
> > 
> >  drivers/iio/light/vcnl4000.c | 185 +++++++++++++++++++++++++++++++++--
> >  1 file changed, 179 insertions(+), 6 deletions(-)
> > 
> > -- 
> > 2.30.2
> >
Mårten Lindahl Nov. 7, 2022, 10:53 p.m. UTC | #3
On Mon, Nov 07, 2022 at 05:44:31PM +0100, Jonathan Cameron wrote:
> On Mon, 7 Nov 2022 08:47:54 +0100
> Marten Lindahl <martenli@axis.com> wrote:
> 
> > On Mon, Sep 26, 2022 at 11:18:58AM +0200, Mårten Lindahl wrote:
> > > Currently there is no way for userspace to make any configuration of
> > > the VCNL4040 sensors, but only the sensor readings are exported in
> > > sysfs. To support configuration for proximity integration time value,
> > > sysfs attributes for this needs to be exported.
> > > 
> > > To begin with the runtime power management turns both sensors (ALS, and
> > > PS) on before reading the sensor register values and then switches
> > > them off again. But when doing so it writes the whole register instead
> > > of just switching the power on/off bit. This needs to be fixed in order
> > > to make other persistent configurations.
> > > 
> > > Kind regards
> > > Mårten Lindahl  
> > 
> > Hi!
> > 
> > I suspect this mail may have slipped through unnoticed since there has
> > not been any comments on it. v2 had some minor comments which I hope I
> > fixed.
> > 
> > Jonathan?
> 
> It's queued up. Not sure why I failed to send an email though - I'll probably
> find it's in my outbox on the other laptop or something equally silly.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/drivers/iio/light/vcnl4000.c?h=testing&id=1a09d52bf0cab10580ab52f04f8b182f279be455
> 
> Jonathan

Ok, then I know. Thanks!
Kind regards
Mårten
> 
> > 
> > Kind regards
> > Mårten
> > 
> > > 
> > > Changes in v3:
> > >  - Rename defines for ALS/PS shutdown bits
> > >  - Add local variable for building register value
> > > 
> > > Changes in v2:
> > >  - Removed unnecessary switch for chip id
> > >  - Guard read/write sequence against potential race
> > >  - Remove confusing boolean operation
> > >  - Use bitmask macros instead of local field shifting
> > >  - Use .read_avail callback instead of using IIO_CONST_ATTR
> > >  - Skip [PATCH 2/3] iio: light: vcnl4000: Add enable attributes for vcnl4040
> > > 
> > > Mårten Lindahl (2):
> > >   iio: light: vcnl4000: Preserve conf bits when toggle power
> > >   iio: light: vcnl4000: Add ps_it attributes for vcnl4040
> > > 
> > >  drivers/iio/light/vcnl4000.c | 185 +++++++++++++++++++++++++++++++++--
> > >  1 file changed, 179 insertions(+), 6 deletions(-)
> > > 
> > > -- 
> > > 2.30.2
> > >   
>