Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1484271 > unrolled thread

[PATCH v3 1/2] iio: Implement counter channel type and info constants

Started byWilliam Breathitt Gray <vilhelm.gray@gmail.com>
First post2016-09-15 17:00 +0200
Last post2016-09-18 21:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 1/2] iio: Implement counter channel type and info constants William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-09-15 17:00 +0200
    Re: [PATCH v3 1/2] iio: Implement counter channel type and info  constants Jonathan Cameron <jic23@kernel.org> - 2016-09-18 21:30 +0200

#1484271 — [PATCH v3 1/2] iio: Implement counter channel type and info constants

FromWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Date2016-09-15 17:00 +0200
Subject[PATCH v3 1/2] iio: Implement counter channel type and info constants
Message-ID<shGiS-8jb-35@gated-at.bofh.it>
Quadrature encoders, such as rotary encoders and linear encoders, are
devices which are capable of encoding the relative position and
direction of motion of a shaft. This patch introduces several IIO
constants for supporting quadrature encoder counter devices.

  IIO_COUNT: Current count (main data provided by the counter device)
  IIO_INDEX: Set high when index input is at active level
  IIO_CHAN_INFO_PRESET: Counter preset value

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
 drivers/iio/industrialio-core.c | 3 +++
 include/linux/iio/iio.h         | 1 +
 include/uapi/linux/iio/types.h  | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 0528a0c..42d8c8b 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -81,6 +81,8 @@ static const char * const iio_chan_type_name_spec[] = {
 	[IIO_PH] = "ph",
 	[IIO_UVINDEX] = "uvindex",
 	[IIO_ELECTRICALCONDUCTIVITY] = "electricalconductivity",
+	[IIO_COUNT] = "count",
+	[IIO_INDEX] = "index",
 };
 
 static const char * const iio_modifier_names[] = {
@@ -151,6 +153,7 @@ static const char * const iio_chan_info_postfix[] = {
 	[IIO_CHAN_INFO_DEBOUNCE_TIME] = "debounce_time",
 	[IIO_CHAN_INFO_CALIBEMISSIVITY] = "calibemissivity",
 	[IIO_CHAN_INFO_OVERSAMPLING_RATIO] = "oversampling_ratio",
+	[IIO_CHAN_INFO_PRESET] = "preset",
 };
 
 /**
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index b4a0679..7dc86d1 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -46,6 +46,7 @@ enum iio_chan_info_enum {
 	IIO_CHAN_INFO_DEBOUNCE_TIME,
 	IIO_CHAN_INFO_CALIBEMISSIVITY,
 	IIO_CHAN_INFO_OVERSAMPLING_RATIO,
+	IIO_CHAN_INFO_PRESET,
 };
 
 enum iio_shared_by {
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
index 22e5e58..e54d14a 100644
--- a/include/uapi/linux/iio/types.h
+++ b/include/uapi/linux/iio/types.h
@@ -40,6 +40,8 @@ enum iio_chan_type {
 	IIO_PH,
 	IIO_UVINDEX,
 	IIO_ELECTRICALCONDUCTIVITY,
+	IIO_COUNT,
+	IIO_INDEX,
 };
 
 enum iio_modifier {
-- 
2.7.3

[toc] | [next] | [standalone]


#1485926 — Re: [PATCH v3 1/2] iio: Implement counter channel type and info constants

FromJonathan Cameron <jic23@kernel.org>
Date2016-09-18 21:30 +0200
SubjectRe: [PATCH v3 1/2] iio: Implement counter channel type and info constants
Message-ID<siPWN-3Iw-15@gated-at.bofh.it>
In reply to#1484271
On 15/09/16 15:50, William Breathitt Gray wrote:
> Quadrature encoders, such as rotary encoders and linear encoders, are
> devices which are capable of encoding the relative position and
> direction of motion of a shaft. This patch introduces several IIO
> constants for supporting quadrature encoder counter devices.
> 
>   IIO_COUNT: Current count (main data provided by the counter device)
>   IIO_INDEX: Set high when index input is at active level
>   IIO_CHAN_INFO_PRESET: Counter preset value
> 
> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
We'll see how it pans out as the driver gets revised further, but
in general I think I am happy with what we have here.

I thought hard on whether INDEX should be handled as an event.
I'm still not entirely certain, but right now I think this is
the right option.

Jonathan
> ---
>  drivers/iio/industrialio-core.c | 3 +++
>  include/linux/iio/iio.h         | 1 +
>  include/uapi/linux/iio/types.h  | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 0528a0c..42d8c8b 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -81,6 +81,8 @@ static const char * const iio_chan_type_name_spec[] = {
>  	[IIO_PH] = "ph",
>  	[IIO_UVINDEX] = "uvindex",
>  	[IIO_ELECTRICALCONDUCTIVITY] = "electricalconductivity",
> +	[IIO_COUNT] = "count",
> +	[IIO_INDEX] = "index",
>  };
>  
>  static const char * const iio_modifier_names[] = {
> @@ -151,6 +153,7 @@ static const char * const iio_chan_info_postfix[] = {
>  	[IIO_CHAN_INFO_DEBOUNCE_TIME] = "debounce_time",
>  	[IIO_CHAN_INFO_CALIBEMISSIVITY] = "calibemissivity",
>  	[IIO_CHAN_INFO_OVERSAMPLING_RATIO] = "oversampling_ratio",
> +	[IIO_CHAN_INFO_PRESET] = "preset",
>  };
>  
>  /**
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index b4a0679..7dc86d1 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -46,6 +46,7 @@ enum iio_chan_info_enum {
>  	IIO_CHAN_INFO_DEBOUNCE_TIME,
>  	IIO_CHAN_INFO_CALIBEMISSIVITY,
>  	IIO_CHAN_INFO_OVERSAMPLING_RATIO,
> +	IIO_CHAN_INFO_PRESET,
>  };
>  
>  enum iio_shared_by {
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index 22e5e58..e54d14a 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -40,6 +40,8 @@ enum iio_chan_type {
>  	IIO_PH,
>  	IIO_UVINDEX,
>  	IIO_ELECTRICALCONDUCTIVITY,
> +	IIO_COUNT,
> +	IIO_INDEX,
>  };
>  
>  enum iio_modifier {
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web