Re: [PATCH v2 2/2] iio: accel: Add driver support for ADXL313

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 6 Aug 2021 21:22:46 -0300
Lucas Stankus <lucas.p.stankus@xxxxxxxxx> wrote:

> On Fri, Aug 6, 2021 at 9:35 AM Andy Shevchenko
> <andy.shevchenko@xxxxxxxxx> wrote:
> >
> >
> >
> > On Thursday, August 5, 2021, Lucas Stankus <lucas.p.stankus@xxxxxxxxx> wrote:  
> >>
> >> ADXL313 is a small, thin, low power, 3-axis accelerometer with high
> >> resolution measurement up to +/-4g. It includes an integrated 32-level
> >> FIFO and has activity and inactivity sensing capabilities.
> >>
> >> Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL313.pdf
> >> Signed-off-by: Lucas Stankus <lucas.p.stankus@xxxxxxxxx>
> >> ---
> >>  MAINTAINERS                      |   9 +
> >>  drivers/iio/accel/Kconfig        |  29 +++
> >>  drivers/iio/accel/Makefile       |   3 +
> >>  drivers/iio/accel/adxl313.h      |  63 ++++++
> >>  drivers/iio/accel/adxl313_core.c | 321 +++++++++++++++++++++++++++++++
> >>  drivers/iio/accel/adxl313_i2c.c  |  65 +++++++
> >>  drivers/iio/accel/adxl313_spi.c  |  85 ++++++++
> >>  7 files changed, 575 insertions(+)
> >>  create mode 100644 drivers/iio/accel/adxl313.h
> >>  create mode 100644 drivers/iio/accel/adxl313_core.c
> >>  create mode 100644 drivers/iio/accel/adxl313_i2c.c
> >>  create mode 100644 drivers/iio/accel/adxl313_spi.c
> >>
> >> diff --git a/MAINTAINERS b/MAINTAINERS
> >> index a61f4f3b78a9..566055450b6b 100644
> >> --- a/MAINTAINERS
> >> +++ b/MAINTAINERS
> >> @@ -585,6 +585,15 @@ L: platform-driver-x86@xxxxxxxxxxxxxxx
> >>  S:     Maintained
> >>  F:     drivers/platform/x86/adv_swbutton.c
> >>
> >> +ADXL313 THREE-AXIS DIGITAL ACCELEROMETER DRIVER
> >> +M:     Lucas Stankus <lucas.p.stankus@xxxxxxxxx>
> >> +S:     Supported
> >> +F:     Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml
> >> +F:     drivers/iio/accel/adxl313.h
> >> +F:     drivers/iio/accel/adxl313_core.c
> >> +F:     drivers/iio/accel/adxl313_i2c.c
> >> +F:     drivers/iio/accel/adxl313_spi.c  
> >
> >
> >
> > adxl313*?
> >  
> 
> Didn't know this would work, but I think I prefer the way it is now.
> Are you proposing this as a suggestion or more of a change request?

It's a bit neater and very unlikely we'll get a clash on that wild card
in the long run, so I'd 'slightly' prefer this as well.


...

>> +/*
> >> + * Scale for any g range is given in datasheet as
> >> + * 1024 LSB/g = 0.0009765625 * 9.80665 = 0.009576806640625 m/s^2
> >> + */
> >> +#define ADXL313_NSCALE 9576806  
> >
> >
> >
> > Is it in nanonewtons? Perhaps add a suffix _nN?
> >  
> 
> It's actually in meters per second squared, so I couldn't come up with
> a good suffix. Do you have any suggestions?

Easy. Don't have a #define :)

In all seriousness it isn't a 'magic' number, it's an actual real world
value, so move the comment down to where it's used and put the number
directly were it is needed.


Jonathan




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux