Commit 17abc9ec authored by Tomasz Duszynski's avatar Tomasz Duszynski Committed by Jonathan Cameron

iio: add IIO_MASSCONCENTRATION channel type

Measuring particulate matter in ug / m3 (micro-grams per cubic meter)
is de facto standard. Existing air quality sensors usually follow
this convention and are capable of returning measurements using
this unit.

IIO currently does not offer suitable channel type for this
type of measurements hence this patch adds this.

In addition, extra modifiers are introduced used for distinguishing
between fine pm1, pm2p5 and coarse pm4, pm10 particle measurements, i.e
IIO_MOD_PM1, IIO_MOD_PM25 and IIO_MOD_PM4, IIO_MOD_PM10.

pmX consists of particles with aerodynamic diameter less or equal to
X micrometers.
Signed-off-by: default avatarTomasz Duszynski <tduszyns@gmail.com>
Acked-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f1b753a0
...@@ -1684,4 +1684,19 @@ KernelVersion: 4.18 ...@@ -1684,4 +1684,19 @@ KernelVersion: 4.18
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
Description: Description:
Raw (unscaled) phase difference reading from channel Y Raw (unscaled) phase difference reading from channel Y
that can be processed to radians. that can be processed to radians.
\ No newline at end of file
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm1_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm1_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm2p5_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm2p5_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm4_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm4_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentration_pm10_input
What: /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
KernelVersion: 4.22
Contact: linux-iio@vger.kernel.org
Description:
Mass concentration reading of particulate matter in ug / m3.
pmX consists of particles with aerodynamic diameter less or
equal to X micrometers.
...@@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = { ...@@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_GRAVITY] = "gravity", [IIO_GRAVITY] = "gravity",
[IIO_POSITIONRELATIVE] = "positionrelative", [IIO_POSITIONRELATIVE] = "positionrelative",
[IIO_PHASE] = "phase", [IIO_PHASE] = "phase",
[IIO_MASSCONCENTRATION] = "massconcentration",
}; };
static const char * const iio_modifier_names[] = { static const char * const iio_modifier_names[] = {
...@@ -127,6 +128,10 @@ static const char * const iio_modifier_names[] = { ...@@ -127,6 +128,10 @@ static const char * const iio_modifier_names[] = {
[IIO_MOD_Q] = "q", [IIO_MOD_Q] = "q",
[IIO_MOD_CO2] = "co2", [IIO_MOD_CO2] = "co2",
[IIO_MOD_VOC] = "voc", [IIO_MOD_VOC] = "voc",
[IIO_MOD_PM1] = "pm1",
[IIO_MOD_PM2P5] = "pm2p5",
[IIO_MOD_PM4] = "pm4",
[IIO_MOD_PM10] = "pm10",
}; };
/* relies on pairs of these shared then separate */ /* relies on pairs of these shared then separate */
......
...@@ -46,6 +46,7 @@ enum iio_chan_type { ...@@ -46,6 +46,7 @@ enum iio_chan_type {
IIO_GRAVITY, IIO_GRAVITY,
IIO_POSITIONRELATIVE, IIO_POSITIONRELATIVE,
IIO_PHASE, IIO_PHASE,
IIO_MASSCONCENTRATION,
}; };
enum iio_modifier { enum iio_modifier {
...@@ -87,6 +88,10 @@ enum iio_modifier { ...@@ -87,6 +88,10 @@ enum iio_modifier {
IIO_MOD_VOC, IIO_MOD_VOC,
IIO_MOD_LIGHT_UV, IIO_MOD_LIGHT_UV,
IIO_MOD_LIGHT_DUV, IIO_MOD_LIGHT_DUV,
IIO_MOD_PM1,
IIO_MOD_PM2P5,
IIO_MOD_PM4,
IIO_MOD_PM10,
}; };
enum iio_event_type { enum iio_event_type {
......
...@@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = { ...@@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_GRAVITY] = "gravity", [IIO_GRAVITY] = "gravity",
[IIO_POSITIONRELATIVE] = "positionrelative", [IIO_POSITIONRELATIVE] = "positionrelative",
[IIO_PHASE] = "phase", [IIO_PHASE] = "phase",
[IIO_MASSCONCENTRATION] = "massconcentration",
}; };
static const char * const iio_ev_type_text[] = { static const char * const iio_ev_type_text[] = {
...@@ -115,6 +116,10 @@ static const char * const iio_modifier_names[] = { ...@@ -115,6 +116,10 @@ static const char * const iio_modifier_names[] = {
[IIO_MOD_Q] = "q", [IIO_MOD_Q] = "q",
[IIO_MOD_CO2] = "co2", [IIO_MOD_CO2] = "co2",
[IIO_MOD_VOC] = "voc", [IIO_MOD_VOC] = "voc",
[IIO_MOD_PM1] = "pm1",
[IIO_MOD_PM2P5] = "pm2p5",
[IIO_MOD_PM4] = "pm4",
[IIO_MOD_PM10] = "pm10",
}; };
static bool event_is_known(struct iio_event_data *event) static bool event_is_known(struct iio_event_data *event)
...@@ -156,6 +161,7 @@ static bool event_is_known(struct iio_event_data *event) ...@@ -156,6 +161,7 @@ static bool event_is_known(struct iio_event_data *event)
case IIO_GRAVITY: case IIO_GRAVITY:
case IIO_POSITIONRELATIVE: case IIO_POSITIONRELATIVE:
case IIO_PHASE: case IIO_PHASE:
case IIO_MASSCONCENTRATION:
break; break;
default: default:
return false; return false;
...@@ -200,6 +206,10 @@ static bool event_is_known(struct iio_event_data *event) ...@@ -200,6 +206,10 @@ static bool event_is_known(struct iio_event_data *event)
case IIO_MOD_Q: case IIO_MOD_Q:
case IIO_MOD_CO2: case IIO_MOD_CO2:
case IIO_MOD_VOC: case IIO_MOD_VOC:
case IIO_MOD_PM1:
case IIO_MOD_PM2P5:
case IIO_MOD_PM4:
case IIO_MOD_PM10:
break; break;
default: default:
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment