iio: Implement counter channel type and info constants
authorWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Wed, 28 Sep 2016 17:59:49 +0000 (13:59 -0400)
committerJonathan Cameron <jic23@kernel.org>
Sat, 1 Oct 2016 16:06:02 +0000 (17:06 +0100)
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: Counter device index value

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/ABI/testing/sysfs-bus-iio
drivers/iio/industrialio-core.c
include/uapi/linux/iio/types.h

index fee35c00cc4ed6fd59fdff3fd14cac396e9336a4..b8f220f978dd335389f7cae80e1e1eafb5fdde2d 100644 (file)
@@ -329,6 +329,7 @@ What:               /sys/bus/iio/devices/iio:deviceX/in_pressure_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_humidityrelative_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_velocity_sqrt(x^2+y^2+z^2)_scale
 What:          /sys/bus/iio/devices/iio:deviceX/in_illuminance_scale
+What:          /sys/bus/iio/devices/iio:deviceX/in_countY_scale
 KernelVersion: 2.6.35
 Contact:       linux-iio@vger.kernel.org
 Description:
@@ -1579,3 +1580,20 @@ Contact: linux-iio@vger.kernel.org
 Description:
                Raw (unscaled no offset etc.) electric conductivity reading that
                can be processed to siemens per meter.
+
+What:          /sys/bus/iio/devices/iio:deviceX/in_countY_raw
+KernelVersion: 4.9
+Contact:       linux-iio@vger.kernel.org
+Description:
+               Raw counter device counts from channel Y. For quadrature
+               counters, multiplication by an available [Y]_scale results in
+               the counts of a single quadrature signal phase from channel Y.
+
+What:          /sys/bus/iio/devices/iio:deviceX/in_indexY_raw
+KernelVersion: 4.9
+Contact:       linux-iio@vger.kernel.org
+Description:
+               Raw counter device index value from channel Y. This attribute
+               provides an absolute positional reference (e.g. a pulse once per
+               revolution) which may be used to home positional systems as
+               required.
index fc340ed3dca1ca555dfa47cc02ae845d825279d3..649725bc15c1a5ee38a13345fe0d89272ca567f0 100644 (file)
@@ -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[] = {
index 22e5e589a2747beff6d59f40d44ce99364c85415..e54d14a7f876b08c8ff5bd370143d85a89c02ff5 100644 (file)
@@ -40,6 +40,8 @@ enum iio_chan_type {
        IIO_PH,
        IIO_UVINDEX,
        IIO_ELECTRICALCONDUCTIVITY,
+       IIO_COUNT,
+       IIO_INDEX,
 };
 
 enum iio_modifier {