Skip to contentSkip to conversation

iio: new chemical sensor framework and channel types

RFC Superseded Matt Ranostay 1 participant 5 messages Sep 9, 2015

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover iio: new chemical sensor framework and channel types

Changes from RFC v2:
* Proper usage of IIO_CHAN_INFO_OFFSET values for VOC and CO2 channels
* Return CO2 offset that combines the 400 ppm offset and -13 value correction

Matt Ranostay (4):
iio: chemical: Add IIO_CONCENTRATION channel type
iio: resistance: add IIO_RESISTANCE channel type
devicetree: add SGX Sensortech vendor id
iio: chemical: add SGX VZ89x VOC sensor support

 Documentation/ABI/testing/sysfs-bus-iio            |  14 ++
 .../ABI/testing/sysfs-bus-iio-chemical-vz89x       |  30 +++
 .../devicetree/bindings/i2c/trivial-devices.txt    |   1 +
 .../devicetree/bindings/vendor-prefixes.txt        |   1 +
 drivers/iio/Kconfig                                |   1 +
 drivers/iio/Makefile                               |   1 +
 drivers/iio/chemical/Makefile                      |   6 +
 drivers/iio/chemical/vz89x.c                       | 245 +++++++++++++++++++++
 drivers/iio/industrialio-core.c                    |   2 +
 include/uapi/linux/iio/types.h                     |   2 +
 10 files changed, 303 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-chemical-vz89x
 create mode 100644 drivers/iio/chemical/Makefile
 create mode 100644 drivers/iio/chemical/vz89x.c
Signature · 1 line
1.9.1
#1 lore raw

RFC v3 1/4 iio: chemical: Add IIO_CONCENTRATION channel type

There are air quality sensors that report data back in parts per million of VOC (Volatile Organic Compounds) which are usually indexed from CO2 or another common pollutant.

This patchset adds an IIO_CONCENTRATION type that returns a percentage of substance because no other channels types fit this use case.

---
 Documentation/ABI/testing/sysfs-bus-iio | 7 +++++++
 drivers/iio/industrialio-core.c         | 1 +
 include/uapi/linux/iio/types.h          | 1 +
 3 files changed, 9 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +7 -0
index 42d360f..48080b7 100644
@@ -1459,3 +1459,10 @@ Description:
 		measurements and return the average value as output data. Each
 		value resulted from <type>[_name]_oversampling_ratio measurements
 		is considered as one sample for <type>[_name]_sampling_frequency.
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_concentration_raw
+What:		/sys/bus/iio/devices/iio:deviceX/in_concentrationX_raw
+KernelVersion:	4.3
+Contact:	[email protected]
+Description:
+		Raw (unscaled no offset etc.) precentage reading of a substance.
drivers/iio/industrialio-core.c +1 -0
index b3fcc2c..58a60a1 100644
@@ -75,6 +75,7 @@ static const char * const iio_chan_type_name_spec[] = {
 	[IIO_ENERGY] = "energy",
 	[IIO_DISTANCE] = "distance",
 	[IIO_VELOCITY] = "velocity",
+	[IIO_CONCENTRATION] = "concentration",
 };
 
 static const char * const iio_modifier_names[] = {
include/uapi/linux/iio/types.h +1 -0
index 2f8b117..c5a0e3f 100644
@@ -35,6 +35,7 @@ enum iio_chan_type {
 	IIO_ENERGY,
 	IIO_DISTANCE,
 	IIO_VELOCITY,
+	IIO_CONCENTRATION,
 };
 
 enum iio_modifier {
Signature · 1 line
1.9.1
#2 lore raw

RFC v3 2/4 iio: resistance: add IIO_RESISTANCE channel type

In reply to Matt Ranostay
---
 Documentation/ABI/testing/sysfs-bus-iio | 7 +++++++
 drivers/iio/industrialio-core.c         | 1 +
 include/uapi/linux/iio/types.h          | 1 +
 3 files changed, 9 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +7 -0
index 48080b7..0f683ed 100644
@@ -1466,3 +1466,10 @@ KernelVersion:	4.3
 Contact:	[email protected]
 Description:
 		Raw (unscaled no offset etc.) precentage reading of a substance.
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_resistance_raw
+What:		/sys/bus/iio/devices/iio:deviceX/in_resistanceX_raw
+KernelVersion:	4.3
+Contact:	[email protected]
+Description:
+		Raw (unscaled no offset etc.) resistance reading in ohms.
drivers/iio/industrialio-core.c +1 -0
index 58a60a1..d61a363 100644
@@ -76,6 +76,7 @@ static const char * const iio_chan_type_name_spec[] = {
 	[IIO_DISTANCE] = "distance",
 	[IIO_VELOCITY] = "velocity",
 	[IIO_CONCENTRATION] = "concentration",
+	[IIO_RESISTANCE] = "resistance",
 };
 
 static const char * const iio_modifier_names[] = {
include/uapi/linux/iio/types.h +1 -0
index c5a0e3f..d58319c 100644
@@ -36,6 +36,7 @@ enum iio_chan_type {
 	IIO_DISTANCE,
 	IIO_VELOCITY,
 	IIO_CONCENTRATION,
+	IIO_RESISTANCE,
 };
 
 enum iio_modifier {
Signature · 1 line
1.9.1
#3 lore raw

RFC v3 3/4 devicetree: add SGX Sensortech vendor id

In reply to Matt Ranostay
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index ac5f0c3..281e8f0 100644
@@ -191,6 +191,7 @@ sbs	Smart Battery System
 schindler	Schindler
 seagate	Seagate Technology PLC
 semtech	Semtech Corporation
+sgx	SGX Sensortech
 sharp	Sharp Corporation
 sil	Silicon Image
 silabs	Silicon Laboratories
Signature · 1 line
1.9.1
#4 lore raw

RFC v3 4/4 iio: chemical: add SGX VZ89x VOC sensor support

In reply to Matt Ranostay

Add support for VZ89X sensors VOC and CO2 reporting channels in percentage which can be converted to part per million.

---
 .../ABI/testing/sysfs-bus-iio-chemical-vz89x       |  30 +++
 .../devicetree/bindings/i2c/trivial-devices.txt    |   1 +
 drivers/iio/Kconfig                                |   1 +
 drivers/iio/Makefile                               |   1 +
 drivers/iio/chemical/Makefile                      |   6 +
 drivers/iio/chemical/vz89x.c                       | 245 +++++++++++++++++++++
 6 files changed, 284 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-chemical-vz89x
 create mode 100644 drivers/iio/chemical/Makefile
 create mode 100644 drivers/iio/chemical/vz89x.c
Documentation/ABI/testing/sysfs-bus-iio-chemical-vz89x new file +30 -0
new file mode 100644
index 0000000..74f2a35
@@ -0,0 +1,30 @@
+What:		/sys/bus/iio/devices/iio:deviceX/in_concentration_CO2_raw
+Date:		September 2015
+KernelVersion:	4.3
+Contact:	Matt Ranostay <[email protected]>
+Description:
+		Get the unscaled, and no offset applied CO2 gas percentage
+		value.
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_concentration_VOC_short_raw
+Date:		September 2015
+KernelVersion:	4.3
+Contact:	Matt Ranostay <[email protected]>
+Description:
+		Get the raw calibration VOC value from the sensor.
+		This value has little application outside of calibration.
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_concentration_tVOC_raw
+Date:		September 2015
+KernelVersion:	4.3
+Contact:	Matt Ranostay <[email protected]>
+Description:
+		Get the unscaled, and no offset applied total VOC gas
+		percentage value.
+
+What:		/sys/bus/iio/devices/iio:deviceX/in_resistance_raw
+Date:		September 2015
+KernelVersion:	4.3
+Contact:	Matt Ranostay <[email protected]>
+Description:
+		Get the unscaled sensor resistance value.
Documentation/devicetree/bindings/i2c/trivial-devices.txt +1 -0
index d77d412..a550216 100644
@@ -88,6 +88,7 @@ ricoh,rs5c372b		I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
 ricoh,rv5c386		I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
 ricoh,rv5c387a		I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
 samsung,24ad0xd1	S524AD0XF1 (128K/256K-bit Serial EEPROM for Low Power)
+sgx,vz89x		SGX Sensortech VZ89X Sensors
 sii,s35390a		2-wire CMOS real-time clock
 skyworks,sky81452	Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply
 st-micro,24c256		i2c serial eeprom  (24cxx)
drivers/iio/Kconfig +1 -0
index 4011eff..9664e9c 100644
@@ -61,6 +61,7 @@ config IIO_CONSUMERS_PER_TRIGGER
 source "drivers/iio/accel/Kconfig"
 source "drivers/iio/adc/Kconfig"
 source "drivers/iio/amplifiers/Kconfig"
+source "drivers/iio/chemical/Kconfig"
 source "drivers/iio/common/Kconfig"
 source "drivers/iio/dac/Kconfig"
 source "drivers/iio/frequency/Kconfig"
drivers/iio/Makefile +1 -0
index 698afc2..2288684 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o
 obj-y += accel/
 obj-y += adc/
 obj-y += amplifiers/
+obj-y += chemical/
 obj-y += common/
 obj-y += dac/
 obj-y += gyro/
drivers/iio/chemical/Makefile new file +6 -0
new file mode 100644
index 0000000..7292f2d
@@ -0,0 +1,6 @@
+#
+# Makefile for IIO chemical sensors
+#
+
+# When adding new entries keep the list in alphabetical order
+obj-$(CONFIG_VZ89X)		+= vz89x.o
drivers/iio/chemical/vz89x.c new file +245 -0

245 lines not on this page · raw message

Signature · 1 line
1.9.1