From: Jonathan Cameron <jic23@kernel.org>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: lars@metafoo.de, peress@chromium.org,
enric.balletbo@collabora.com, linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/2] docs: abi: iio: Add event when offset changes
Date: Sun, 30 Aug 2020 14:11:40 +0100 [thread overview]
Message-ID: <20200830141140.3a360928@archlinux> (raw)
In-Reply-To: <20200828233156.2264689-3-gwendal@chromium.org>
On Fri, 28 Aug 2020 16:31:56 -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>
Hi Gwendal
This strikes me as rather prone to races. I guess if the updates
tend to be fairly minor we will just have slightly less accurate data
until the update gets picked up by userspace.
We have had some discussions about how to handle meta data updates
in the past. One option was to provide a metadata index channel
that could be used to indicate there was an update to something
sat in a separate fifo.
> ---
> Documentation/ABI/testing/sysfs-bus-iio | 33 +++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index 47df16c87862d..40da602e7a555 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -1716,3 +1716,36 @@ Description:
> Mass concentration reading of particulate matter in ug / m3.
> pmX consists of particles with aerodynamic diameter less or
> equal to X micrometers.
> +
> +What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_offset
> +What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_offset
> +What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_offset
> +KernelVersion: x.y
> +Contact: linux-iio@vger.kernel.org
> +Description:
> + Gyroscope drift calculated by the sensor. In addition to factory
> + calibration, sensor or sensorhub can
> + detect gyroscope drift and report it to userspace.
This looks like standard ABI that should probably already be documented,
unrelated to the controversial part of this patch. I would split it out into
it's own patch a I can pick that up much faster.
> +
> +What: /sys/bus/iio/devices/iio:deviceX/in_magn_x_offset
> +What: /sys/bus/iio/devices/iio:deviceX/in_magn_y_offset
> +What: /sys/bus/iio/devices/iio:deviceX/in_magn_z_offset
> +KernelVersion: x.y
> +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.
Same as above.
> +
> +What: /sys/.../iio:deviceX/events/in_accel_offset_change_en
> +What: /sys/.../iio:deviceX/events/in_magn_offset_change_en
> +What: /sys/.../iio:deviceX/events/in_magn_scale_change_en
> +What: /sys/.../iio:deviceX/events/in_anglvel_offset_change_en
> +KernelVersion: x.y
> +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.
I'm not totally sold on this idea, though would like inputs from other people before
ruling it out.
One minor change I'd make would be to have a single event to indicate that something
userspace might care about in the way of metadata for this channel has changed.
I guess something like
in_accel_metachange_en etc with a single new event code. For events, it's the event
code mapping that normally matters more than sysfs binding as that is much more
tightly restricted.
Jonathan
next prev parent reply other threads:[~2020-08-30 13:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-28 23:31 [PATCH 0/2] docs: abi: iio: RFC: Request to add event when offsets calculated by sensorhub change Gwendal Grignou
2020-08-28 23:31 ` [PATCH 1/2] docs: abi: iio: Use What: consistently Gwendal Grignou
2020-08-29 14:45 ` Jonathan Cameron
2020-08-28 23:31 ` [PATCH 2/2] docs: abi: iio: Add event when offset changes Gwendal Grignou
2020-08-30 13:11 ` Jonathan Cameron [this message]
2020-09-01 3:00 ` Gwendal Grignou
2020-09-06 15:56 ` 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=20200830141140.3a360928@archlinux \
--to=jic23@kernel.org \
--cc=enric.balletbo@collabora.com \
--cc=gwendal@chromium.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=peress@chromium.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).