public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: Taha Ed-Dafili <0rayn.dev@gmail.com>,
	rdunlap@infradead.org, skhan@linuxfoundation.org,
	linux-kernel-mentees-archive@lists.linuxfoundation.org,
	nuno.sa@analog.com, andy@kernel.org, corbet@lwn.net,
	lars@metafoo.de, Michael.Hennerich@analog.com,
	linux-iio@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/4] docs: iio: adxl345: update math and examples for scaling
Date: Sun, 15 Feb 2026 19:29:01 +0000	[thread overview]
Message-ID: <20260215192901.0aa23e20@jic23-huawei> (raw)
In-Reply-To: <53cb71bb-4943-4e2f-bd26-9adeada84852@baylibre.com>

On Sat, 14 Feb 2026 11:11:41 -0600
David Lechner <dlechner@baylibre.com> wrote:

> On 2/8/26 9:05 AM, Taha Ed-Dafili wrote:
> > Update the documentation to reflect the addition of event scaling
> > and correct existing technical errors in scale values.
> > 
> > key changes:
> > - Fix the 62.5 g/LSB typo to 62.5 mg/LSB and add SI unit conversion.
> > - Correct decimal precision of in_accel_scale and
> > in_accel_scale_available to match actual SI unit (m/s^2)
> > values reported by the driver.
> > - Add sysfs example showing how to read and interpret the
> > newly implemented event scale factor.
> > 
> > Suggested-by: Jonathan Cameron <jic23@kernel.org>
> > Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
> > ---
> >  Documentation/iio/adxl345.rst | 41 +++++++++++++++++++++++------------
> >  1 file changed, 27 insertions(+), 14 deletions(-)
> > 
> > diff --git a/Documentation/iio/adxl345.rst b/Documentation/iio/adxl345.rst
> > index 3ca6a78feb5b..321565699817 100644
> > --- a/Documentation/iio/adxl345.rst
> > +++ b/Documentation/iio/adxl345.rst
> > @@ -13,7 +13,12 @@ This driver supports Analog Device's ADXL345/375 on SPI/I2C bus.
> >  * `ADXL375 <https://www.analog.com/ADXL375>`_
> >  
> >  The ADXL345 is a general-purpose, low-power, 3-axis accelerometer with selectable
> > -measurement ranges. The ADXL345 supports the ±2 g, ±4 g, ±8 g, and ±16 g ranges.
> > +measurement ranges. The ADXL345 supports the following ranges:
> > +
> > +- ±2g  (approx. ±19.61 m/s^2)
> > +- ±4g  (approx. ±39.23 m/s^2)
> > +- ±8g  (approx. ±78.45 m/s^2)
> > +- ±16g (approx. ±156.91 m/s^2)
> >  
> >  2. Device Attributes
> >  ====================
> > @@ -98,23 +103,23 @@ listed.
> >  +---------------------------------------------+---------------------------------------------+
> >  | in_accel_gesture_singletap_timeout          | Single tap duration in [us]                 |
> >  +---------------------------------------------+---------------------------------------------+
> > -| in_accel_gesture_singletap_value            | Single tap threshold value in 62.5/LSB      |
> > +| in_accel_gesture_singletap_value            | Single tap threshold value                  |
> >  +---------------------------------------------+---------------------------------------------+
> >  | in_accel_mag_falling_period                 | Inactivity time in seconds                  |
> >  +---------------------------------------------+---------------------------------------------+
> > -| in_accel_mag_falling_value                  | Inactivity threshold value in 62.5/LSB      |
> > +| in_accel_mag_falling_value                  | Inactivity threshold value                  |
> >  +---------------------------------------------+---------------------------------------------+
> >  | in_accel_mag_adaptive_rising_en             | Enable AC coupled activity on X axis        |
> >  +---------------------------------------------+---------------------------------------------+
> >  | in_accel_mag_adaptive_falling_period        | AC coupled inactivity time in seconds       |
> >  +---------------------------------------------+---------------------------------------------+
> > -| in_accel_mag_adaptive_falling_value         | AC coupled inactivity threshold in 62.5/LSB |
> > +| in_accel_mag_adaptive_falling_value         | AC coupled inactivity threshold             |
> >  +---------------------------------------------+---------------------------------------------+
> > -| in_accel_mag_adaptive_rising_value          | AC coupled activity threshold in 62.5/LSB   |
> > +| in_accel_mag_adaptive_rising_value          | AC coupled activity threshold               |
> >  +---------------------------------------------+---------------------------------------------+
> >  | in_accel_mag_rising_en                      | Enable activity detection on X axis         |
> >  +---------------------------------------------+---------------------------------------------+
> > -| in_accel_mag_rising_value                   | Activity threshold value in 62.5/LSB        |
> > +| in_accel_mag_rising_value                   | Activity threshold value                    |
> >  +---------------------------------------------+---------------------------------------------+
> >  | in_accel_x_gesture_singletap_en             | Enable single tap detection on X axis       |
> >  +---------------------------------------------+---------------------------------------------+
> > @@ -126,6 +131,10 @@ listed.
> >  +---------------------------------------------+---------------------------------------------+
> >  | in_accel_z_gesture_singletap_en             | Enable single tap detection on Z axis       |
> >  +---------------------------------------------+---------------------------------------------+
> > +| in_accel_gesture_scale                      | Tap threshold scale (0.612915 m/s^2).       |
> > ++---------------------------------------------+---------------------------------------------+
> > +| in_accel_mag_scale                          | Activity threshold scale (0.612915 m/s^2).  |
> > ++---------------------------------------------+---------------------------------------------+  

Does it?  See below,

> 
> It looks like the others are in alphabetical order (or , so would
> be nice to insert the new ones in the appropriate order.
> 
> (in_accel_mag_falling is also out of order, so that could be part
> of the precursor cleanup patch)
> 
> Also, missing in_accel_mag_adaptive_scale (it was added in
> the driver changes.)

That missing is particularly interesting as I think Claude code + Chris's prompts found an issue
(took a while as I ran out of tokens yesterday!)

Issue: IIO_EV_INFO_SCALE is added to mask_shared_by_type for MAG and
  MAG_ADAPTIVE event types (both rising and falling), but
  adxl345_read_mag_value() doesn't handle IIO_EV_INFO_SCALE — it falls
  through to default: return -EINVAL. The sysfs attributes
  in_accel_mag_scale and in_accel_mag_adaptive_scale will be created
  by the IIO core but reading them returns -EINVAL. The scale case
  is only handled for IIO_EV_TYPE_GESTURE events.

Which i think is right:
The code is only added in patch 3 for the TYPE_GESTURE, but the relevant
bit is set to create the interface you call out as missing... + indeed
in_accel_mag_scale.

Taha assuming this bug report is correct, please up your testing game.
This stuff is much easier for an author to find by actually looking at
what new files are created and checking they respond as expected than
it is for reviewers to figure out from patches.

Jonathan




> 


  reply	other threads:[~2026-02-15 19:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-08 15:05 [PATCH v3 0/4] iio: accel: adxl345: Add event scaling and doc fixes Taha Ed-Dafili
2026-02-08 15:05 ` [PATCH v3 1/4] docs: iio: adxl345: fix typos and grammar Taha Ed-Dafili
2026-02-08 15:05 ` [PATCH v3 2/4] iio: core: Add IIO_EV_INFO_SCALE to event info Taha Ed-Dafili
2026-02-08 15:05 ` [PATCH v3 3/4] iio: accel: adxl345: Implement event scaling for ABI compliance Taha Ed-Dafili
2026-02-14 17:02   ` David Lechner
2026-02-14 17:09     ` David Lechner
2026-02-14 18:22     ` Andy Shevchenko
2026-02-14 21:49       ` Randy Dunlap
2026-02-08 15:05 ` [PATCH v3 4/4] docs: iio: adxl345: update math and examples for scaling Taha Ed-Dafili
2026-02-14 17:11   ` David Lechner
2026-02-15 19:29     ` Jonathan Cameron [this message]
2026-02-14 17:21 ` [PATCH v3 0/4] iio: accel: adxl345: Add event scaling and doc fixes Jonathan Cameron
2026-02-15 15:57   ` Jonathan Cameron
2026-02-15 17:11     ` Taha Ed-Dafili

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=20260215192901.0aa23e20@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=0rayn.dev@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dlechner@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel-mentees-archive@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.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