Re: [PATCH v2 3/3] Documentation: ABI: iio: Add event when offset/scale changes

Jonathan Cameron
2020-09-06T15:32:30Z

On Mon, 31 Aug 2020 20:00:17 -0700
Gwendal Grignou <gwendal@chromium.org> wrote:

> Some sensors/sensorhubs can calculate drift or hard iron offsets to
> apply to raw data to get the true measure data.
> These offsets are applied by the user space application.
> When these offsets change, events are raised to tell the application
> to update the cached offset values.
>
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>

I'm fine with this, but would like to give a bit more time for others to
comment. Also you left the version number as wild cards.
I guess I can fix that, but I've been known to miss such things
so better to be optimistic and put in 5.10.

However I don't really want to see ABI without a user so I'd rather
see this patch alongside the driver update.

Thanks,

Jonathan

> ---
> Changes since v1:
> - Define metadata_en instead of offset/scale_en to limit race
> conditions.
> Documentation/ABI/testing/sysfs-bus-iio | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index f77aee8886c66..45f456de1621a 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -1735,3 +1735,16 @@ Contact: linux-iio@vger.kernel.org
> Description:
> Hard Iron bias calculated by the sensor or sensorhub. To be applied by
> user space application to the raw data to obtain the geomagnetic field.
> +
> +What: /sys/.../iio:deviceX/events/in_accel_metadata_change_en
> +What: /sys/.../iio:deviceX/events/in_magn_metadata_change_en
> +What: /sys/.../iio:deviceX/events/in_anglvel_metadata_change_en

I've just been looking at existing naming of events and thinking about whether
we should have a space between metadata and change. From a human readabilty
point of view it would be nice, but from a parsability viewpoint possibly not.

We do have precedent though for such a space (even if we wouldn't have done
it today) in thresh_adaptive and mag_adaptive (see industrialio-event.c) so
I guess one more probably doesn't hurt too much.

> +KernelVersion: x.y

Be an optimist for patches like this and put the next cycle in there. That's
better than some maintainers just picking it up with wild cards :)

> +Contact: linux-iio@vger.kernel.org
> +Description:
> + Some sensors internally calculate offset to apply to remove bias (for
> + instance, hard/soft-iron bias for magnetometer, online calibration bias for
> + gyroscope or accelerometer).
> + When the sensor computes a new set of offset values, it generates an
> + event for the userspace application to refresh the offsets to apply to raw
> + data.