[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250830180012.5ab8872f@jic23-huawei>
Date: Sat, 30 Aug 2025 18:00:12 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Gustavo Silva <gustavograzs@...il.com>, lanzano.alex@...il.com,
dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 3/4] iio: imu: bmi270: add support for motion events
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.
Powered by blists - more mailing lists