Skip to content

Commit 1a8f324

Browse files
William Breathitt Grayjic23
authored andcommitted
iio: Implement counter channel type and info constants
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>
1 parent 9ecca12 commit 1a8f324

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎Documentation/ABI/testing/sysfs-bus-iio‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ What: /sys/bus/iio/devices/iio:deviceX/in_pressure_scale
329329
What: /sys/bus/iio/devices/iio:deviceX/in_humidityrelative_scale
330330
What: /sys/bus/iio/devices/iio:deviceX/in_velocity_sqrt(x^2+y^2+z^2)_scale
331331
What: /sys/bus/iio/devices/iio:deviceX/in_illuminance_scale
332+
What: /sys/bus/iio/devices/iio:deviceX/in_countY_scale
332333
KernelVersion: 2.6.35
333334
Contact: linux-iio@vger.kernel.org
334335
Description:
@@ -1579,3 +1580,20 @@ Contact: linux-iio@vger.kernel.org
15791580
Description:
15801581
Raw (unscaled no offset etc.) electric conductivity reading that
15811582
can be processed to siemens per meter.
1583+
1584+
What: /sys/bus/iio/devices/iio:deviceX/in_countY_raw
1585+
KernelVersion: 4.9
1586+
Contact: linux-iio@vger.kernel.org
1587+
Description:
1588+
Raw counter device counts from channel Y. For quadrature
1589+
counters, multiplication by an available [Y]_scale results in
1590+
the counts of a single quadrature signal phase from channel Y.
1591+
1592+
What: /sys/bus/iio/devices/iio:deviceX/in_indexY_raw
1593+
KernelVersion: 4.9
1594+
Contact: linux-iio@vger.kernel.org
1595+
Description:
1596+
Raw counter device index value from channel Y. This attribute
1597+
provides an absolute positional reference (e.g. a pulse once per
1598+
revolution) which may be used to home positional systems as
1599+
required.

‎drivers/iio/industrialio-core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ static const char * const iio_chan_type_name_spec[] = {
8181
[IIO_PH] = "ph",
8282
[IIO_UVINDEX] = "uvindex",
8383
[IIO_ELECTRICALCONDUCTIVITY] = "electricalconductivity",
84+
[IIO_COUNT] = "count",
85+
[IIO_INDEX] = "index",
8486
};
8587

8688
static const char * const iio_modifier_names[] = {

‎include/uapi/linux/iio/types.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ enum iio_chan_type {
4040
IIO_PH,
4141
IIO_UVINDEX,
4242
IIO_ELECTRICALCONDUCTIVITY,
43+
IIO_COUNT,
44+
IIO_INDEX,
4345
};
4446

4547
enum iio_modifier {

0 commit comments

Comments
 (0)