linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lucas Stankus <lucas.p.stankus@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	"lars@metafoo.de" <lars@metafoo.de>,
	"Michael.Hennerich@analog.com" <Michael.Hennerich@analog.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"Dragos.Bogdan@analog.com" <Dragos.Bogdan@analog.com>,
	"Darius.Berghe@analog.com" <Darius.Berghe@analog.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: accel: Add driver support for ADXL313
Date: Sun, 8 Aug 2021 15:51:49 +0100	[thread overview]
Message-ID: <20210808155149.1c435b88@jic23-huawei> (raw)
In-Reply-To: <CACKVXZB5Fo02ZT58swZKoz9DxNUR9Mmx717nf1OiB+g6+T7hJw@mail.gmail.com>

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

> On Fri, Aug 6, 2021 at 9:35 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> >
> >
> >
> > On Thursday, August 5, 2021, Lucas Stankus <lucas.p.stankus@gmail.com> 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@gmail.com>
> >> ---
> >>  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@vger.kernel.org
> >>  S:     Maintained
> >>  F:     drivers/platform/x86/adv_swbutton.c
> >>
> >> +ADXL313 THREE-AXIS DIGITAL ACCELEROMETER DRIVER
> >> +M:     Lucas Stankus <lucas.p.stankus@gmail.com>
> >> +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


      reply	other threads:[~2021-08-08 14:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  6:29 [PATCH v2 0/2] iio: accel: Add support for ADXL313 accelerometer Lucas Stankus
2021-08-05  6:29 ` [PATCH v2 1/2] dt-bindings: iio: accel: Add binding documentation for ADXL313 Lucas Stankus
2021-08-06 17:07   ` Rob Herring
2021-08-06 18:10   ` Rob Herring
2021-08-07  0:33     ` Lucas Stankus
2021-08-08 14:45       ` Jonathan Cameron
2021-08-05  6:29 ` [PATCH v2 2/2] iio: accel: Add driver support " Lucas Stankus
2021-08-05  8:21   ` Alexandru Ardelean
     [not found]   ` <CAHp75Ve7avWpdnCioW6qdT21NqjK1TTW-nwFsz6x+0JLXsQH3Q@mail.gmail.com>
2021-08-07  0:22     ` Lucas Stankus
2021-08-08 14:51       ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210808155149.1c435b88@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Darius.Berghe@analog.com \
    --cc=Dragos.Bogdan@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.p.stankus@gmail.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).