Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gustavo Silva <gustavograzs@gmail.com>,
	lanzano.alex@gmail.com, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/4] iio: imu: bmi270: add support for motion events
Date: Sat, 30 Aug 2025 18:00:12 +0100	[thread overview]
Message-ID: <20250830180012.5ab8872f@jic23-huawei> (raw)
In-Reply-To: <CAHp75Ve93UPiE=STPLiGzfipWUe0WeQsER5X50sKbkdMWDR4bQ@mail.gmail.com>


Just picking out one thing to reply to...
> 
> > +static ssize_t bmi270_show_accel_value_avail(struct device *dev,
> > +                                            struct device_attribute *attr,
> > +                                            char *buf)
> > +{
> > +       struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> > +       struct bmi270_data *data = iio_priv(indio_dev);
> > +       int ret, scale, uscale;
> > +       unsigned int step, max;
> > +
> > +       ret = bmi270_get_scale(data, IIO_ACCEL, &scale, &uscale);
> > +       if (ret)
> > +               return ret;
> > +
> > +       max = BMI270_G_MICRO_M_S_2 / uscale;
> > +       step = max / BMI270_MOTION_THRES_FULL_SCALE;
> > +
> > +       return sysfs_emit(buf, "[0 %u %u]\n", step, max);  
> 
> Do we need []? Is it common in IIO? The usual way in SW to have "$min
> $max $step" (see `seq` in shell, range() in Python and so on).
> 
yes. See ABI docs for _available.  It comes in two forms.
space separted list of values and this one which is used for specifying
limits and step.  The [] is how we tell which one it is.

For anything other than events we handle all this via callbacks and
masks. I've never bothered adding the complexity of that to events
as _available attributes are fairly rare.




  parent reply	other threads:[~2025-08-30 17:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-30 11:58 [PATCH v5 0/4] BMI270: Add support for step counter and motion events Gustavo Silva
2025-08-30 11:58 ` [PATCH v5 3/4] iio: imu: bmi270: add support for " Gustavo Silva
2025-08-30 12:44   ` Andy Shevchenko
2025-08-30 12:47     ` Andy Shevchenko
2025-08-30 17:00     ` Jonathan Cameron [this message]
2025-09-13 12:46     ` Gustavo Silva
2025-09-14 11:40       ` Andy Shevchenko
2025-08-30 11:58 ` [PATCH v5 4/4] iio: ABI: document accel and roc event attributes Gustavo Silva
2025-08-30 12:49   ` Andy Shevchenko
2025-08-30 17:05     ` Jonathan Cameron
2025-08-30 17:09       ` Jonathan Cameron
2025-08-30 19:58         ` Andy Shevchenko
2025-08-31 15:39           ` Jonathan Cameron
2025-08-30 17:21   ` Jonathan Cameron
2025-08-30 12:36 ` [PATCH v5 0/4] BMI270: Add support for step counter and motion events Andy Shevchenko
2025-08-30 17:23   ` Jonathan Cameron

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=20250830180012.5ab8872f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gustavograzs@gmail.com \
    --cc=lanzano.alex@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /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