From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
William Breathitt Gray <vilhelm.gray@gmail.com>
Subject: [PATCH v2 1/2] iio: Implement counter channel type and info constants
Date: Wed, 14 Sep 2016 15:24:30 -0400 [thread overview]
Message-ID: <bd7044c5088c8f0d445d236581de9b19c806bbfc.1473877757.git.vilhelm.gray@gmail.com> (raw)
In-Reply-To: <cover.1473877757.git.vilhelm.gray@gmail.com>
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 the counter
subdirectory and 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/Kconfig | 1 +
drivers/iio/Makefile | 1 +
drivers/iio/counter/Kconfig | 8 ++++++++
drivers/iio/counter/Makefile | 6 ++++++
drivers/iio/industrialio-core.c | 3 +++
include/linux/iio/iio.h | 1 +
include/uapi/linux/iio/types.h | 2 ++
7 files changed, 22 insertions(+)
create mode 100644 drivers/iio/counter/Kconfig
create mode 100644 drivers/iio/counter/Makefile
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
index 6743b18..574d1fb 100644
--- a/drivers/iio/Kconfig
+++ b/drivers/iio/Kconfig
@@ -73,6 +73,7 @@ source "drivers/iio/adc/Kconfig"
source "drivers/iio/amplifiers/Kconfig"
source "drivers/iio/chemical/Kconfig"
source "drivers/iio/common/Kconfig"
+source "drivers/iio/counter/Kconfig"
source "drivers/iio/dac/Kconfig"
source "drivers/iio/dummy/Kconfig"
source "drivers/iio/frequency/Kconfig"
diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile
index 87e4c43..77b2000 100644
--- a/drivers/iio/Makefile
+++ b/drivers/iio/Makefile
@@ -18,6 +18,7 @@ obj-y += amplifiers/
obj-y += buffer/
obj-y += chemical/
obj-y += common/
+obj-y += counter/
obj-y += dac/
obj-y += dummy/
obj-y += gyro/
diff --git a/drivers/iio/counter/Kconfig b/drivers/iio/counter/Kconfig
new file mode 100644
index 0000000..95a7a0df
--- /dev/null
+++ b/drivers/iio/counter/Kconfig
@@ -0,0 +1,8 @@
+#
+# Counter devices
+#
+# When adding new entries keep the list in alphabetical order
+
+menu "Counters"
+
+endmenu
diff --git a/drivers/iio/counter/Makefile b/drivers/iio/counter/Makefile
new file mode 100644
index 0000000..c4dfa50
--- /dev/null
+++ b/drivers/iio/counter/Makefile
@@ -0,0 +1,6 @@
+#
+# Makefile for IIO counter devices
+#
+
+# When adding new entries keep the list in alphabetical order
+
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
next prev parent reply other threads:[~2016-09-14 19:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-14 19:24 [PATCH v2 0/2] Add IIO support for counter devices William Breathitt Gray
2016-09-14 19:24 ` William Breathitt Gray [this message]
2016-09-15 13:35 ` [PATCH v2 1/2] iio: Implement counter channel type and info constants kbuild test robot
2016-09-15 14:03 ` William Breathitt Gray
2016-09-15 22:30 ` kbuild test robot
2016-09-14 19:24 ` [PATCH v2 2/2] iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8 William Breathitt Gray
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=bd7044c5088c8f0d445d236581de9b19c806bbfc.1473877757.git.vilhelm.gray@gmail.com \
--to=vilhelm.gray@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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
all inboxes | Powered by JetHome®