Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Ramona Bolboaca <ramona.bolboaca@analog.com>
Cc: <nuno.sa@analog.com>, <linux-iio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] iio: Add IIO_DELTA_ANGL channel type
Date: Sat, 5 Aug 2023 19:35:16 +0100	[thread overview]
Message-ID: <20230805193516.332122e1@jic23-huawei> (raw)
In-Reply-To: <20230804064559.47192-2-ramona.bolboaca@analog.com>

On Fri, 4 Aug 2023 09:45:57 +0300
Ramona Bolboaca <ramona.bolboaca@analog.com> wrote:

> The delta angle is defined as a piece-wise integration of angular
> velocity data. The delta angle represents the amount of
> angular displacement between two consecutive measurements and it
> is measured in degrees.

That's not consistent with angl and it should be.
Hence should be radians, with appropriate changes in the scale
exposed by the driver.

> 
> In order to track the total angular displacement during a desired
> period of time, simply sum-up the delta angle samples acquired
> during that time.
> 
> IIO currently does not offer a suitable channel type for this
> type of measurements hence this patch adds it.
> 
> Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
> ---
>  Documentation/ABI/testing/sysfs-bus-iio | 14 ++++++++++++++
>  drivers/iio/industrialio-core.c         |  1 +
>  include/uapi/linux/iio/types.h          |  1 +
>  tools/iio/iio_event_monitor.c           |  2 ++
>  4 files changed, 18 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index a2854dc9a839..1561c33b05a1 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -279,6 +279,20 @@ Description:
>  		but should match other such assignments on device).
>  		Units after application of scale and offset are m/s^2.
>  
> +What:		/sys/bus/iio/devices/iio:deviceX/in_deltaangl_x_raw
> +What:		/sys/bus/iio/devices/iio:deviceX/in_deltaangl_y_raw
> +What:		/sys/bus/iio/devices/iio:deviceX/in_deltaangl_z_raw
> +KernelVersion:	6.5
> +Contact:	linux-iio@vger.kernel.org
> +Description:
> +		Angular displacement between two consecutive samples on x, y or
> +		z (may be arbitrarily assigned but should match other such
> +		assignments on device).
> +		In order to compute the total angular displacement during a
> +		desired period of time, the application should sum-up the delta
> +		angle samples acquired during that time.
> +		Units after application of scale and offset are angles.

Units above are degrees, but should be radians.

> +
>  What:		/sys/bus/iio/devices/iio:deviceX/in_angl_raw
>  What:		/sys/bus/iio/devices/iio:deviceX/in_anglY_raw
>  KernelVersion:	4.17
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index a92b8b6ad647..2e2fd0be2504 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -89,6 +89,7 @@ static const char * const iio_chan_type_name_spec[] = {
>  	[IIO_POSITIONRELATIVE]  = "positionrelative",
>  	[IIO_PHASE] = "phase",
>  	[IIO_MASSCONCENTRATION] = "massconcentration",
> +	[IIO_DELTA_ANGL] = "deltaangl",
>  };
>  
>  static const char * const iio_modifier_names[] = {
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index c79f2f046a0b..55666a17d311 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -47,6 +47,7 @@ enum iio_chan_type {
>  	IIO_POSITIONRELATIVE,
>  	IIO_PHASE,
>  	IIO_MASSCONCENTRATION,
> +	IIO_DELTA_ANGL,
>  };
>  
>  enum iio_modifier {
> diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> index 0a5c2bb60030..3505450060e6 100644
> --- a/tools/iio/iio_event_monitor.c
> +++ b/tools/iio/iio_event_monitor.c
> @@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = {
>  	[IIO_POSITIONRELATIVE] = "positionrelative",
>  	[IIO_PHASE] = "phase",
>  	[IIO_MASSCONCENTRATION] = "massconcentration",
> +	[IIO_DELTA_ANGL] = "deltaangl",
>  };
>  
>  static const char * const iio_ev_type_text[] = {
> @@ -173,6 +174,7 @@ static bool event_is_known(struct iio_event_data *event)
>  	case IIO_POSITIONRELATIVE:
>  	case IIO_PHASE:
>  	case IIO_MASSCONCENTRATION:
> +	case IIO_DELTA_ANGL:
>  		break;
>  	default:
>  		return false;


  reply	other threads:[~2023-08-05 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  6:45 [PATCH v3 0/3] Add new channels for adis16475 Ramona Bolboaca
2023-08-04  6:45 ` [PATCH v3 1/3] iio: Add IIO_DELTA_ANGL channel type Ramona Bolboaca
2023-08-05 18:35   ` Jonathan Cameron [this message]
2023-08-04  6:45 ` [PATCH v3 2/3] iio: Add IIO_DELTA_VELOCITY " Ramona Bolboaca
2023-08-05 18:37   ` Jonathan Cameron
2023-08-04  6:45 ` [PATCH v3 3/3] iio: imu: adis16475.c: Add delta angle and delta velocity channels Ramona Bolboaca
2023-08-05 18:45   ` Jonathan Cameron
2023-08-05 18:32 ` [PATCH v3 0/3] Add new channels for adis16475 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=20230805193516.332122e1@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=ramona.bolboaca@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