diff mbox series

[1/3] iio: add IIO_MASSCONCENTRATION channel type

Message ID 20181124221415.10081-2-tduszyns@gmail.com (mailing list archive)
State New, archived
Headers show
Series add support for Sensirion SPS30 PM sensor | expand

Commit Message

Tomasz Duszynski Nov. 24, 2018, 10:14 p.m. UTC
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, two modifiers are introduced used for distinguishing
between coarse (PM10) and fine particles (PM2p5) measurements, i.e
IIO_MOD_PM10 and IIO_MOD_PM2p5.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
---
 Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
 drivers/iio/industrialio-core.c         |  3 +++
 include/uapi/linux/iio/types.h          |  3 +++
 tools/iio/iio_event_monitor.c           |  6 ++++++
 4 files changed, 22 insertions(+), 1 deletion(-)

Comments

Jonathan Cameron Nov. 25, 2018, 8:35 a.m. UTC | #1
On Sat, 24 Nov 2018 23:14:13 +0100
Tomasz Duszynski <tduszyns@gmail.com> wrote:

> 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, two modifiers are introduced used for distinguishing
> between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> IIO_MOD_PM10 and IIO_MOD_PM2p5.
I initially wondered why these particular numbers and why don't
we provide an attribute specify this separately?

However google suggests these two are pretty much the only
ones anyone worries about in pollution sensors.  I ended
up fairly quickly at the EPA website
https://www.epa.gov/pm-pollution/table-historical-particulate-matter-pm-national-ambient-air-quality-standards-naaqs
which tells me these two have be used since about 1987.

So I think the modifier route is the right approach here
(I think we've gotten this wrong in the past such as light
sensor colours where the list keeps on growing).

I would like a reference or two in the docs though to point
people to these definitions.

Thanks,

Jonathan

> 
> Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> ---
>  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
>  drivers/iio/industrialio-core.c         |  3 +++
>  include/uapi/linux/iio/types.h          |  3 +++
>  tools/iio/iio_event_monitor.c           |  6 ++++++
>  4 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index 8127a08e366d..ce0ed140660d 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -1684,4 +1684,13 @@ KernelVersion:	4.18
>  Contact:	linux-iio@vger.kernel.org
>  Description:
>  		Raw (unscaled) phase difference reading from channel Y
> -		that can be processed to radians.
> \ No newline at end of file
> +		that can be processed to radians.
> +
> +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_pm10_input
> +What:		/sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> +KernelVersion:	4.21
> +Contact:	linux-iio@vger.kernel.org
> +Description:
> +		Mass concentration reading of particulate matter in ug / m3.
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index a062cfddc5af..2a9ef600c1fb 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
>  	[IIO_GRAVITY]  = "gravity",
>  	[IIO_POSITIONRELATIVE]  = "positionrelative",
>  	[IIO_PHASE] = "phase",
> +	[IIO_MASSCONCENTRATION] = "massconcentration",
>  };
>  
>  static const char * const iio_modifier_names[] = {
> @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
>  	[IIO_MOD_Q] = "q",
>  	[IIO_MOD_CO2] = "co2",
>  	[IIO_MOD_VOC] = "voc",
> +	[IIO_MOD_PM2p5] = "pm2p5",
> +	[IIO_MOD_PM10] = "pm10",
>  };
>  
>  /* relies on pairs of these shared then separate */
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index 92baabc103ac..465044b42af5 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -46,6 +46,7 @@ enum iio_chan_type {
>  	IIO_GRAVITY,
>  	IIO_POSITIONRELATIVE,
>  	IIO_PHASE,
> +	IIO_MASSCONCENTRATION,
>  };
>  
>  enum iio_modifier {
> @@ -87,6 +88,8 @@ enum iio_modifier {
>  	IIO_MOD_VOC,
>  	IIO_MOD_LIGHT_UV,
>  	IIO_MOD_LIGHT_DUV,
> +	IIO_MOD_PM2p5,
> +	IIO_MOD_PM10,
>  };
>  
>  enum iio_event_type {
> diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> index ac2de6b7e89f..f0fcfeddba2b 100644
> --- a/tools/iio/iio_event_monitor.c
> +++ b/tools/iio/iio_event_monitor.c
> @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
>  	[IIO_GRAVITY] = "gravity",
>  	[IIO_POSITIONRELATIVE] = "positionrelative",
>  	[IIO_PHASE] = "phase",
> +	[IIO_MASSCONCENTRATION] = "massconcentration",
>  };
>  
>  static const char * const iio_ev_type_text[] = {
> @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
>  	[IIO_MOD_Q] = "q",
>  	[IIO_MOD_CO2] = "co2",
>  	[IIO_MOD_VOC] = "voc",
> +	[IIO_MOD_PM2p5] = "pm2p5",
> +	[IIO_MOD_PM10] = "pm10",
>  };
>  
>  static bool event_is_known(struct iio_event_data *event)
> @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
>  	case IIO_GRAVITY:
>  	case IIO_POSITIONRELATIVE:
>  	case IIO_PHASE:
> +	case IIO_MASSCONCENTRATION:
>  		break;
>  	default:
>  		return false;
> @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
>  	case IIO_MOD_Q:
>  	case IIO_MOD_CO2:
>  	case IIO_MOD_VOC:
> +	case IIO_MOD_PM2p5:
> +	case IIO_MOD_PM10:
>  		break;
>  	default:
>  		return false;
Matt Ranostay Nov. 25, 2018, 1:51 p.m. UTC | #2
On Sat, Nov 24, 2018 at 2:14 PM Tomasz Duszynski <tduszyns@gmail.com> wrote:
>
> 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, two modifiers are introduced used for distinguishing
> between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> IIO_MOD_PM10 and IIO_MOD_PM2p5.
>
> Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> ---
>  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
>  drivers/iio/industrialio-core.c         |  3 +++
>  include/uapi/linux/iio/types.h          |  3 +++
>  tools/iio/iio_event_monitor.c           |  6 ++++++
>  4 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index 8127a08e366d..ce0ed140660d 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -1684,4 +1684,13 @@ KernelVersion:   4.18
>  Contact:       linux-iio@vger.kernel.org
>  Description:
>                 Raw (unscaled) phase difference reading from channel Y
> -               that can be processed to radians.
> \ No newline at end of file
> +               that can be processed to radians.
> +
> +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_pm10_input
> +What:          /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> +KernelVersion: 4.21
> +Contact:       linux-iio@vger.kernel.org
> +Description:
> +               Mass concentration reading of particulate matter in ug / m3.
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index a062cfddc5af..2a9ef600c1fb 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
>         [IIO_GRAVITY]  = "gravity",
>         [IIO_POSITIONRELATIVE]  = "positionrelative",
>         [IIO_PHASE] = "phase",
> +       [IIO_MASSCONCENTRATION] = "massconcentration",
>  };
>
>  static const char * const iio_modifier_names[] = {
> @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
>         [IIO_MOD_Q] = "q",
>         [IIO_MOD_CO2] = "co2",
>         [IIO_MOD_VOC] = "voc",
> +       [IIO_MOD_PM2p5] = "pm2p5",
> +       [IIO_MOD_PM10] = "pm10",
>  };
>
>  /* relies on pairs of these shared then separate */
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index 92baabc103ac..465044b42af5 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -46,6 +46,7 @@ enum iio_chan_type {
>         IIO_GRAVITY,
>         IIO_POSITIONRELATIVE,
>         IIO_PHASE,
> +       IIO_MASSCONCENTRATION,

So I'm guessing IIO_CONCENTRATION can't be scaled to the micro-grams
per cubic meter?

>  };
>
>  enum iio_modifier {
> @@ -87,6 +88,8 @@ enum iio_modifier {
>         IIO_MOD_VOC,
>         IIO_MOD_LIGHT_UV,
>         IIO_MOD_LIGHT_DUV,
> +       IIO_MOD_PM2p5,

I know this is unit of measure but the lowercase p in IIO_MOD_PM2p5 is
a bit non-standard for iio defines/enum.

- Matt

> +       IIO_MOD_PM10,
>  };
>
>  enum iio_event_type {
> diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> index ac2de6b7e89f..f0fcfeddba2b 100644
> --- a/tools/iio/iio_event_monitor.c
> +++ b/tools/iio/iio_event_monitor.c
> @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
>         [IIO_GRAVITY] = "gravity",
>         [IIO_POSITIONRELATIVE] = "positionrelative",
>         [IIO_PHASE] = "phase",
> +       [IIO_MASSCONCENTRATION] = "massconcentration",
>  };
>
>  static const char * const iio_ev_type_text[] = {
> @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
>         [IIO_MOD_Q] = "q",
>         [IIO_MOD_CO2] = "co2",
>         [IIO_MOD_VOC] = "voc",
> +       [IIO_MOD_PM2p5] = "pm2p5",
> +       [IIO_MOD_PM10] = "pm10",
>  };
>
>  static bool event_is_known(struct iio_event_data *event)
> @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
>         case IIO_GRAVITY:
>         case IIO_POSITIONRELATIVE:
>         case IIO_PHASE:
> +       case IIO_MASSCONCENTRATION:
>                 break;
>         default:
>                 return false;
> @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
>         case IIO_MOD_Q:
>         case IIO_MOD_CO2:
>         case IIO_MOD_VOC:
> +       case IIO_MOD_PM2p5:
> +       case IIO_MOD_PM10:
>                 break;
>         default:
>                 return false;
> --
> 2.19.2
>
Jonathan Cameron Nov. 25, 2018, 2:03 p.m. UTC | #3
On Sun, 25 Nov 2018 05:51:32 -0800
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sat, Nov 24, 2018 at 2:14 PM Tomasz Duszynski <tduszyns@gmail.com> wrote:
> >
> > 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, two modifiers are introduced used for distinguishing
> > between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> > IIO_MOD_PM10 and IIO_MOD_PM2p5.
> >
> > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > ---
> >  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
> >  drivers/iio/industrialio-core.c         |  3 +++
> >  include/uapi/linux/iio/types.h          |  3 +++
> >  tools/iio/iio_event_monitor.c           |  6 ++++++
> >  4 files changed, 22 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > index 8127a08e366d..ce0ed140660d 100644
> > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > @@ -1684,4 +1684,13 @@ KernelVersion:   4.18
> >  Contact:       linux-iio@vger.kernel.org
> >  Description:
> >                 Raw (unscaled) phase difference reading from channel Y
> > -               that can be processed to radians.
> > \ No newline at end of file
> > +               that can be processed to radians.
> > +
> > +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_pm10_input
> > +What:          /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> > +KernelVersion: 4.21
> > +Contact:       linux-iio@vger.kernel.org
> > +Description:
> > +               Mass concentration reading of particulate matter in ug / m3.
> > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > index a062cfddc5af..2a9ef600c1fb 100644
> > --- a/drivers/iio/industrialio-core.c
> > +++ b/drivers/iio/industrialio-core.c
> > @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
> >         [IIO_GRAVITY]  = "gravity",
> >         [IIO_POSITIONRELATIVE]  = "positionrelative",
> >         [IIO_PHASE] = "phase",
> > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> >  };
> >
> >  static const char * const iio_modifier_names[] = {
> > @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
> >         [IIO_MOD_Q] = "q",
> >         [IIO_MOD_CO2] = "co2",
> >         [IIO_MOD_VOC] = "voc",
> > +       [IIO_MOD_PM2p5] = "pm2p5",
> > +       [IIO_MOD_PM10] = "pm10",
> >  };
> >
> >  /* relies on pairs of these shared then separate */
> > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> > index 92baabc103ac..465044b42af5 100644
> > --- a/include/uapi/linux/iio/types.h
> > +++ b/include/uapi/linux/iio/types.h
> > @@ -46,6 +46,7 @@ enum iio_chan_type {
> >         IIO_GRAVITY,
> >         IIO_POSITIONRELATIVE,
> >         IIO_PHASE,
> > +       IIO_MASSCONCENTRATION,  
> 
> So I'm guessing IIO_CONCENTRATION can't be scaled to the micro-grams
> per cubic meter?

Currently concentration is defined as a percentage reading of a substance
(which does make me wonder if it is meant to be percentage of the volume or
percentage of the mass?)  Either way, if can't convert to a density measurement
as it's a unit free ratio (I think).

> 
> >  };
> >
> >  enum iio_modifier {
> > @@ -87,6 +88,8 @@ enum iio_modifier {
> >         IIO_MOD_VOC,
> >         IIO_MOD_LIGHT_UV,
> >         IIO_MOD_LIGHT_DUV,
> > +       IIO_MOD_PM2p5,  
> 
> I know this is unit of measure but the lowercase p in IIO_MOD_PM2p5 is
> a bit non-standard for iio defines/enum.
It is a bit odd and will get us scripted reports so maybe best to
just go upper case and not worry about it.

Jonathan
> 
> - Matt
> 
> > +       IIO_MOD_PM10,
> >  };
> >
> >  enum iio_event_type {
> > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> > index ac2de6b7e89f..f0fcfeddba2b 100644
> > --- a/tools/iio/iio_event_monitor.c
> > +++ b/tools/iio/iio_event_monitor.c
> > @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
> >         [IIO_GRAVITY] = "gravity",
> >         [IIO_POSITIONRELATIVE] = "positionrelative",
> >         [IIO_PHASE] = "phase",
> > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> >  };
> >
> >  static const char * const iio_ev_type_text[] = {
> > @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
> >         [IIO_MOD_Q] = "q",
> >         [IIO_MOD_CO2] = "co2",
> >         [IIO_MOD_VOC] = "voc",
> > +       [IIO_MOD_PM2p5] = "pm2p5",
> > +       [IIO_MOD_PM10] = "pm10",
> >  };
> >
> >  static bool event_is_known(struct iio_event_data *event)
> > @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
> >         case IIO_GRAVITY:
> >         case IIO_POSITIONRELATIVE:
> >         case IIO_PHASE:
> > +       case IIO_MASSCONCENTRATION:
> >                 break;
> >         default:
> >                 return false;
> > @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
> >         case IIO_MOD_Q:
> >         case IIO_MOD_CO2:
> >         case IIO_MOD_VOC:
> > +       case IIO_MOD_PM2p5:
> > +       case IIO_MOD_PM10:
> >                 break;
> >         default:
> >                 return false;
> > --
> > 2.19.2
> >
Matt Ranostay Nov. 25, 2018, 2:14 p.m. UTC | #4
On Sun, Nov 25, 2018 at 6:03 AM Jonathan Cameron
<jic23@jic23.retrosnub.co.uk> wrote:
>
> On Sun, 25 Nov 2018 05:51:32 -0800
> Matt Ranostay <matt.ranostay@konsulko.com> wrote:
>
> > On Sat, Nov 24, 2018 at 2:14 PM Tomasz Duszynski <tduszyns@gmail.com> wrote:
> > >
> > > 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, two modifiers are introduced used for distinguishing
> > > between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> > > IIO_MOD_PM10 and IIO_MOD_PM2p5.
> > >
> > > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > > ---
> > >  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
> > >  drivers/iio/industrialio-core.c         |  3 +++
> > >  include/uapi/linux/iio/types.h          |  3 +++
> > >  tools/iio/iio_event_monitor.c           |  6 ++++++
> > >  4 files changed, 22 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > > index 8127a08e366d..ce0ed140660d 100644
> > > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > > @@ -1684,4 +1684,13 @@ KernelVersion:   4.18
> > >  Contact:       linux-iio@vger.kernel.org
> > >  Description:
> > >                 Raw (unscaled) phase difference reading from channel Y
> > > -               that can be processed to radians.
> > > \ No newline at end of file
> > > +               that can be processed to radians.
> > > +
> > > +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_pm10_input
> > > +What:          /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> > > +KernelVersion: 4.21
> > > +Contact:       linux-iio@vger.kernel.org
> > > +Description:
> > > +               Mass concentration reading of particulate matter in ug / m3.
> > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > > index a062cfddc5af..2a9ef600c1fb 100644
> > > --- a/drivers/iio/industrialio-core.c
> > > +++ b/drivers/iio/industrialio-core.c
> > > @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > >         [IIO_GRAVITY]  = "gravity",
> > >         [IIO_POSITIONRELATIVE]  = "positionrelative",
> > >         [IIO_PHASE] = "phase",
> > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > >  };
> > >
> > >  static const char * const iio_modifier_names[] = {
> > > @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
> > >         [IIO_MOD_Q] = "q",
> > >         [IIO_MOD_CO2] = "co2",
> > >         [IIO_MOD_VOC] = "voc",
> > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > +       [IIO_MOD_PM10] = "pm10",
> > >  };
> > >
> > >  /* relies on pairs of these shared then separate */
> > > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> > > index 92baabc103ac..465044b42af5 100644
> > > --- a/include/uapi/linux/iio/types.h
> > > +++ b/include/uapi/linux/iio/types.h
> > > @@ -46,6 +46,7 @@ enum iio_chan_type {
> > >         IIO_GRAVITY,
> > >         IIO_POSITIONRELATIVE,
> > >         IIO_PHASE,
> > > +       IIO_MASSCONCENTRATION,
> >
> > So I'm guessing IIO_CONCENTRATION can't be scaled to the micro-grams
> > per cubic meter?
>
> Currently concentration is defined as a percentage reading of a substance
> (which does make me wonder if it is meant to be percentage of the volume or
> percentage of the mass?)  Either way, if can't convert to a density measurement
> as it's a unit free ratio (I think).

Seems like it can be both..  guessing all the atmosphere ( CO2, VOC,
etc) ones are mass/density because on how they work.
But the electro-conductivity sensor that is using IIO_CONCENTRATION
channels is likely from percentage of volume.

- Matt

>
> >
> > >  };
> > >
> > >  enum iio_modifier {
> > > @@ -87,6 +88,8 @@ enum iio_modifier {
> > >         IIO_MOD_VOC,
> > >         IIO_MOD_LIGHT_UV,
> > >         IIO_MOD_LIGHT_DUV,
> > > +       IIO_MOD_PM2p5,
> >
> > I know this is unit of measure but the lowercase p in IIO_MOD_PM2p5 is
> > a bit non-standard for iio defines/enum.
> It is a bit odd and will get us scripted reports so maybe best to
> just go upper case and not worry about it.
>
> Jonathan
> >
> > - Matt
> >
> > > +       IIO_MOD_PM10,
> > >  };
> > >
> > >  enum iio_event_type {
> > > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> > > index ac2de6b7e89f..f0fcfeddba2b 100644
> > > --- a/tools/iio/iio_event_monitor.c
> > > +++ b/tools/iio/iio_event_monitor.c
> > > @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > >         [IIO_GRAVITY] = "gravity",
> > >         [IIO_POSITIONRELATIVE] = "positionrelative",
> > >         [IIO_PHASE] = "phase",
> > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > >  };
> > >
> > >  static const char * const iio_ev_type_text[] = {
> > > @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
> > >         [IIO_MOD_Q] = "q",
> > >         [IIO_MOD_CO2] = "co2",
> > >         [IIO_MOD_VOC] = "voc",
> > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > +       [IIO_MOD_PM10] = "pm10",
> > >  };
> > >
> > >  static bool event_is_known(struct iio_event_data *event)
> > > @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
> > >         case IIO_GRAVITY:
> > >         case IIO_POSITIONRELATIVE:
> > >         case IIO_PHASE:
> > > +       case IIO_MASSCONCENTRATION:
> > >                 break;
> > >         default:
> > >                 return false;
> > > @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
> > >         case IIO_MOD_Q:
> > >         case IIO_MOD_CO2:
> > >         case IIO_MOD_VOC:
> > > +       case IIO_MOD_PM2p5:
> > > +       case IIO_MOD_PM10:
> > >                 break;
> > >         default:
> > >                 return false;
> > > --
> > > 2.19.2
> > >
>
Tomasz Duszynski Nov. 25, 2018, 3:19 p.m. UTC | #5
On Sun, Nov 25, 2018 at 08:35:07AM +0000, Jonathan Cameron wrote:
> On Sat, 24 Nov 2018 23:14:13 +0100
> Tomasz Duszynski <tduszyns@gmail.com> wrote:
>
> > 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, two modifiers are introduced used for distinguishing
> > between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> > IIO_MOD_PM10 and IIO_MOD_PM2p5.
> I initially wondered why these particular numbers and why don't
> we provide an attribute specify this separately?
>
> However google suggests these two are pretty much the only
> ones anyone worries about in pollution sensors.  I ended
> up fairly quickly at the EPA website
> https://www.epa.gov/pm-pollution/table-historical-particulate-matter-pm-national-ambient-air-quality-standards-naaqs
> which tells me these two have be used since about 1987.
>

Usually sensors can measure more than just PM10 and PM2.5. Fairy
common is measurement of PM1.0. SPS30 additionally measures PM4.0
but frankly I don't now know exactly what's the real usecase for that.

> So I think the modifier route is the right approach here
> (I think we've gotten this wrong in the past such as light
> sensor colours where the list keeps on growing).
>
> I would like a reference or two in the docs though to point
> people to these definitions.
>

Okay, will add something reasonable so everyone interested
could get the basic idea quickly.

> Thanks,
>
> Jonathan
>
> >
> > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > ---
> >  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
> >  drivers/iio/industrialio-core.c         |  3 +++
> >  include/uapi/linux/iio/types.h          |  3 +++
> >  tools/iio/iio_event_monitor.c           |  6 ++++++
> >  4 files changed, 22 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > index 8127a08e366d..ce0ed140660d 100644
> > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > @@ -1684,4 +1684,13 @@ KernelVersion:	4.18
> >  Contact:	linux-iio@vger.kernel.org
> >  Description:
> >  		Raw (unscaled) phase difference reading from channel Y
> > -		that can be processed to radians.
> > \ No newline at end of file
> > +		that can be processed to radians.
> > +
> > +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_pm10_input
> > +What:		/sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> > +KernelVersion:	4.21
> > +Contact:	linux-iio@vger.kernel.org
> > +Description:
> > +		Mass concentration reading of particulate matter in ug / m3.
> > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > index a062cfddc5af..2a9ef600c1fb 100644
> > --- a/drivers/iio/industrialio-core.c
> > +++ b/drivers/iio/industrialio-core.c
> > @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
> >  	[IIO_GRAVITY]  = "gravity",
> >  	[IIO_POSITIONRELATIVE]  = "positionrelative",
> >  	[IIO_PHASE] = "phase",
> > +	[IIO_MASSCONCENTRATION] = "massconcentration",
> >  };
> >
> >  static const char * const iio_modifier_names[] = {
> > @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
> >  	[IIO_MOD_Q] = "q",
> >  	[IIO_MOD_CO2] = "co2",
> >  	[IIO_MOD_VOC] = "voc",
> > +	[IIO_MOD_PM2p5] = "pm2p5",
> > +	[IIO_MOD_PM10] = "pm10",
> >  };
> >
> >  /* relies on pairs of these shared then separate */
> > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> > index 92baabc103ac..465044b42af5 100644
> > --- a/include/uapi/linux/iio/types.h
> > +++ b/include/uapi/linux/iio/types.h
> > @@ -46,6 +46,7 @@ enum iio_chan_type {
> >  	IIO_GRAVITY,
> >  	IIO_POSITIONRELATIVE,
> >  	IIO_PHASE,
> > +	IIO_MASSCONCENTRATION,
> >  };
> >
> >  enum iio_modifier {
> > @@ -87,6 +88,8 @@ enum iio_modifier {
> >  	IIO_MOD_VOC,
> >  	IIO_MOD_LIGHT_UV,
> >  	IIO_MOD_LIGHT_DUV,
> > +	IIO_MOD_PM2p5,
> > +	IIO_MOD_PM10,
> >  };
> >
> >  enum iio_event_type {
> > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> > index ac2de6b7e89f..f0fcfeddba2b 100644
> > --- a/tools/iio/iio_event_monitor.c
> > +++ b/tools/iio/iio_event_monitor.c
> > @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
> >  	[IIO_GRAVITY] = "gravity",
> >  	[IIO_POSITIONRELATIVE] = "positionrelative",
> >  	[IIO_PHASE] = "phase",
> > +	[IIO_MASSCONCENTRATION] = "massconcentration",
> >  };
> >
> >  static const char * const iio_ev_type_text[] = {
> > @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
> >  	[IIO_MOD_Q] = "q",
> >  	[IIO_MOD_CO2] = "co2",
> >  	[IIO_MOD_VOC] = "voc",
> > +	[IIO_MOD_PM2p5] = "pm2p5",
> > +	[IIO_MOD_PM10] = "pm10",
> >  };
> >
> >  static bool event_is_known(struct iio_event_data *event)
> > @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
> >  	case IIO_GRAVITY:
> >  	case IIO_POSITIONRELATIVE:
> >  	case IIO_PHASE:
> > +	case IIO_MASSCONCENTRATION:
> >  		break;
> >  	default:
> >  		return false;
> > @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
> >  	case IIO_MOD_Q:
> >  	case IIO_MOD_CO2:
> >  	case IIO_MOD_VOC:
> > +	case IIO_MOD_PM2p5:
> > +	case IIO_MOD_PM10:
> >  		break;
> >  	default:
> >  		return false;
>
Tomasz Duszynski Nov. 25, 2018, 3:35 p.m. UTC | #6
On Sun, Nov 25, 2018 at 02:03:16PM +0000, Jonathan Cameron wrote:
> On Sun, 25 Nov 2018 05:51:32 -0800
> Matt Ranostay <matt.ranostay@konsulko.com> wrote:
>
> > On Sat, Nov 24, 2018 at 2:14 PM Tomasz Duszynski <tduszyns@gmail.com> wrote:
> > >
> > > 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, two modifiers are introduced used for distinguishing
> > > between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> > > IIO_MOD_PM10 and IIO_MOD_PM2p5.
> > >
> > > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > > ---
> > >  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
> > >  drivers/iio/industrialio-core.c         |  3 +++
> > >  include/uapi/linux/iio/types.h          |  3 +++
> > >  tools/iio/iio_event_monitor.c           |  6 ++++++
> > >  4 files changed, 22 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > > index 8127a08e366d..ce0ed140660d 100644
> > > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > > @@ -1684,4 +1684,13 @@ KernelVersion:   4.18
> > >  Contact:       linux-iio@vger.kernel.org
> > >  Description:
> > >                 Raw (unscaled) phase difference reading from channel Y
> > > -               that can be processed to radians.
> > > \ No newline at end of file
> > > +               that can be processed to radians.
> > > +
> > > +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_pm10_input
> > > +What:          /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> > > +KernelVersion: 4.21
> > > +Contact:       linux-iio@vger.kernel.org
> > > +Description:
> > > +               Mass concentration reading of particulate matter in ug / m3.
> > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > > index a062cfddc5af..2a9ef600c1fb 100644
> > > --- a/drivers/iio/industrialio-core.c
> > > +++ b/drivers/iio/industrialio-core.c
> > > @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > >         [IIO_GRAVITY]  = "gravity",
> > >         [IIO_POSITIONRELATIVE]  = "positionrelative",
> > >         [IIO_PHASE] = "phase",
> > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > >  };
> > >
> > >  static const char * const iio_modifier_names[] = {
> > > @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
> > >         [IIO_MOD_Q] = "q",
> > >         [IIO_MOD_CO2] = "co2",
> > >         [IIO_MOD_VOC] = "voc",
> > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > +       [IIO_MOD_PM10] = "pm10",
> > >  };
> > >
> > >  /* relies on pairs of these shared then separate */
> > > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> > > index 92baabc103ac..465044b42af5 100644
> > > --- a/include/uapi/linux/iio/types.h
> > > +++ b/include/uapi/linux/iio/types.h
> > > @@ -46,6 +46,7 @@ enum iio_chan_type {
> > >         IIO_GRAVITY,
> > >         IIO_POSITIONRELATIVE,
> > >         IIO_PHASE,
> > > +       IIO_MASSCONCENTRATION,
> >
> > So I'm guessing IIO_CONCENTRATION can't be scaled to the micro-grams
> > per cubic meter?
>
> Currently concentration is defined as a percentage reading of a substance
> (which does make me wonder if it is meant to be percentage of the volume or
> percentage of the mass?)  Either way, if can't convert to a density measurement
> as it's a unit free ratio (I think).
>

And this is the main reason behind introducing a new channel type.

> >
> > >  };
> > >
> > >  enum iio_modifier {
> > > @@ -87,6 +88,8 @@ enum iio_modifier {
> > >         IIO_MOD_VOC,
> > >         IIO_MOD_LIGHT_UV,
> > >         IIO_MOD_LIGHT_DUV,
> > > +       IIO_MOD_PM2p5,
> >
> > I know this is unit of measure but the lowercase p in IIO_MOD_PM2p5 is
> > a bit non-standard for iio defines/enum.
> It is a bit odd and will get us scripted reports so maybe best to
> just go upper case and not worry about it.
>

Initially I came up with IIO_MOD_PM2_5 but eventually replaced
underscore with 'p' meaning 'decimal point'. Anyway, I am okay with the
suggested change.

> Jonathan
> >
> > - Matt
> >
> > > +       IIO_MOD_PM10,
> > >  };
> > >
> > >  enum iio_event_type {
> > > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> > > index ac2de6b7e89f..f0fcfeddba2b 100644
> > > --- a/tools/iio/iio_event_monitor.c
> > > +++ b/tools/iio/iio_event_monitor.c
> > > @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > >         [IIO_GRAVITY] = "gravity",
> > >         [IIO_POSITIONRELATIVE] = "positionrelative",
> > >         [IIO_PHASE] = "phase",
> > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > >  };
> > >
> > >  static const char * const iio_ev_type_text[] = {
> > > @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
> > >         [IIO_MOD_Q] = "q",
> > >         [IIO_MOD_CO2] = "co2",
> > >         [IIO_MOD_VOC] = "voc",
> > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > +       [IIO_MOD_PM10] = "pm10",
> > >  };
> > >
> > >  static bool event_is_known(struct iio_event_data *event)
> > > @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
> > >         case IIO_GRAVITY:
> > >         case IIO_POSITIONRELATIVE:
> > >         case IIO_PHASE:
> > > +       case IIO_MASSCONCENTRATION:
> > >                 break;
> > >         default:
> > >                 return false;
> > > @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
> > >         case IIO_MOD_Q:
> > >         case IIO_MOD_CO2:
> > >         case IIO_MOD_VOC:
> > > +       case IIO_MOD_PM2p5:
> > > +       case IIO_MOD_PM10:
> > >                 break;
> > >         default:
> > >                 return false;
> > > --
> > > 2.19.2
> > >
>
Tomasz Duszynski Nov. 25, 2018, 3:44 p.m. UTC | #7
On Sun, Nov 25, 2018 at 06:14:44AM -0800, Matt Ranostay wrote:
> On Sun, Nov 25, 2018 at 6:03 AM Jonathan Cameron
> <jic23@jic23.retrosnub.co.uk> wrote:
> >
> > On Sun, 25 Nov 2018 05:51:32 -0800
> > Matt Ranostay <matt.ranostay@konsulko.com> wrote:
> >
> > > On Sat, Nov 24, 2018 at 2:14 PM Tomasz Duszynski <tduszyns@gmail.com> wrote:
> > > >
> > > > 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, two modifiers are introduced used for distinguishing
> > > > between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> > > > IIO_MOD_PM10 and IIO_MOD_PM2p5.
> > > >
> > > > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > > > ---
> > > >  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
> > > >  drivers/iio/industrialio-core.c         |  3 +++
> > > >  include/uapi/linux/iio/types.h          |  3 +++
> > > >  tools/iio/iio_event_monitor.c           |  6 ++++++
> > > >  4 files changed, 22 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > > > index 8127a08e366d..ce0ed140660d 100644
> > > > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > > > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > > > @@ -1684,4 +1684,13 @@ KernelVersion:   4.18
> > > >  Contact:       linux-iio@vger.kernel.org
> > > >  Description:
> > > >                 Raw (unscaled) phase difference reading from channel Y
> > > > -               that can be processed to radians.
> > > > \ No newline at end of file
> > > > +               that can be processed to radians.
> > > > +
> > > > +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_pm10_input
> > > > +What:          /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> > > > +KernelVersion: 4.21
> > > > +Contact:       linux-iio@vger.kernel.org
> > > > +Description:
> > > > +               Mass concentration reading of particulate matter in ug / m3.
> > > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > > > index a062cfddc5af..2a9ef600c1fb 100644
> > > > --- a/drivers/iio/industrialio-core.c
> > > > +++ b/drivers/iio/industrialio-core.c
> > > > @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > > >         [IIO_GRAVITY]  = "gravity",
> > > >         [IIO_POSITIONRELATIVE]  = "positionrelative",
> > > >         [IIO_PHASE] = "phase",
> > > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > > >  };
> > > >
> > > >  static const char * const iio_modifier_names[] = {
> > > > @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
> > > >         [IIO_MOD_Q] = "q",
> > > >         [IIO_MOD_CO2] = "co2",
> > > >         [IIO_MOD_VOC] = "voc",
> > > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > > +       [IIO_MOD_PM10] = "pm10",
> > > >  };
> > > >
> > > >  /* relies on pairs of these shared then separate */
> > > > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> > > > index 92baabc103ac..465044b42af5 100644
> > > > --- a/include/uapi/linux/iio/types.h
> > > > +++ b/include/uapi/linux/iio/types.h
> > > > @@ -46,6 +46,7 @@ enum iio_chan_type {
> > > >         IIO_GRAVITY,
> > > >         IIO_POSITIONRELATIVE,
> > > >         IIO_PHASE,
> > > > +       IIO_MASSCONCENTRATION,
> > >
> > > So I'm guessing IIO_CONCENTRATION can't be scaled to the micro-grams
> > > per cubic meter?
> >
> > Currently concentration is defined as a percentage reading of a substance
> > (which does make me wonder if it is meant to be percentage of the volume or
> > percentage of the mass?)  Either way, if can't convert to a density measurement
> > as it's a unit free ratio (I think).
>
> Seems like it can be both..  guessing all the atmosphere ( CO2, VOC,
> etc) ones are mass/density because on how they work.

Hmm, but still percentage was picked up for IIO_CONCENTRATION which does
really match PM expectations. Perhaps if units were sticked to modifiers
it whould be easier to reuse that.

> But the electro-conductivity sensor that is using IIO_CONCENTRATION
> channels is likely from percentage of volume.
>
> - Matt
>
> >
> > >
> > > >  };
> > > >
> > > >  enum iio_modifier {
> > > > @@ -87,6 +88,8 @@ enum iio_modifier {
> > > >         IIO_MOD_VOC,
> > > >         IIO_MOD_LIGHT_UV,
> > > >         IIO_MOD_LIGHT_DUV,
> > > > +       IIO_MOD_PM2p5,
> > >
> > > I know this is unit of measure but the lowercase p in IIO_MOD_PM2p5 is
> > > a bit non-standard for iio defines/enum.
> > It is a bit odd and will get us scripted reports so maybe best to
> > just go upper case and not worry about it.
> >
> > Jonathan
> > >
> > > - Matt
> > >
> > > > +       IIO_MOD_PM10,
> > > >  };
> > > >
> > > >  enum iio_event_type {
> > > > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> > > > index ac2de6b7e89f..f0fcfeddba2b 100644
> > > > --- a/tools/iio/iio_event_monitor.c
> > > > +++ b/tools/iio/iio_event_monitor.c
> > > > @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > > >         [IIO_GRAVITY] = "gravity",
> > > >         [IIO_POSITIONRELATIVE] = "positionrelative",
> > > >         [IIO_PHASE] = "phase",
> > > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > > >  };
> > > >
> > > >  static const char * const iio_ev_type_text[] = {
> > > > @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
> > > >         [IIO_MOD_Q] = "q",
> > > >         [IIO_MOD_CO2] = "co2",
> > > >         [IIO_MOD_VOC] = "voc",
> > > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > > +       [IIO_MOD_PM10] = "pm10",
> > > >  };
> > > >
> > > >  static bool event_is_known(struct iio_event_data *event)
> > > > @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
> > > >         case IIO_GRAVITY:
> > > >         case IIO_POSITIONRELATIVE:
> > > >         case IIO_PHASE:
> > > > +       case IIO_MASSCONCENTRATION:
> > > >                 break;
> > > >         default:
> > > >                 return false;
> > > > @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
> > > >         case IIO_MOD_Q:
> > > >         case IIO_MOD_CO2:
> > > >         case IIO_MOD_VOC:
> > > > +       case IIO_MOD_PM2p5:
> > > > +       case IIO_MOD_PM10:
> > > >                 break;
> > > >         default:
> > > >                 return false;
> > > > --
> > > > 2.19.2
> > > >
> >
Jonathan Cameron Dec. 1, 2018, 3:48 p.m. UTC | #8
On Sun, 25 Nov 2018 16:44:23 +0100
Tomasz Duszynski <tduszyns@gmail.com> wrote:

> On Sun, Nov 25, 2018 at 06:14:44AM -0800, Matt Ranostay wrote:
> > On Sun, Nov 25, 2018 at 6:03 AM Jonathan Cameron
> > <jic23@jic23.retrosnub.co.uk> wrote:  
> > >
> > > On Sun, 25 Nov 2018 05:51:32 -0800
> > > Matt Ranostay <matt.ranostay@konsulko.com> wrote:
> > >  
> > > > On Sat, Nov 24, 2018 at 2:14 PM Tomasz Duszynski <tduszyns@gmail.com> wrote:  
> > > > >
> > > > > 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, two modifiers are introduced used for distinguishing
> > > > > between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> > > > > IIO_MOD_PM10 and IIO_MOD_PM2p5.
> > > > >
> > > > > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > > > > ---
> > > > >  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
> > > > >  drivers/iio/industrialio-core.c         |  3 +++
> > > > >  include/uapi/linux/iio/types.h          |  3 +++
> > > > >  tools/iio/iio_event_monitor.c           |  6 ++++++
> > > > >  4 files changed, 22 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > > > > index 8127a08e366d..ce0ed140660d 100644
> > > > > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > > > > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > > > > @@ -1684,4 +1684,13 @@ KernelVersion:   4.18
> > > > >  Contact:       linux-iio@vger.kernel.org
> > > > >  Description:
> > > > >                 Raw (unscaled) phase difference reading from channel Y
> > > > > -               that can be processed to radians.
> > > > > \ No newline at end of file
> > > > > +               that can be processed to radians.
> > > > > +
> > > > > +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_pm10_input
> > > > > +What:          /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> > > > > +KernelVersion: 4.21
> > > > > +Contact:       linux-iio@vger.kernel.org
> > > > > +Description:
> > > > > +               Mass concentration reading of particulate matter in ug / m3.
> > > > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > > > > index a062cfddc5af..2a9ef600c1fb 100644
> > > > > --- a/drivers/iio/industrialio-core.c
> > > > > +++ b/drivers/iio/industrialio-core.c
> > > > > @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > > > >         [IIO_GRAVITY]  = "gravity",
> > > > >         [IIO_POSITIONRELATIVE]  = "positionrelative",
> > > > >         [IIO_PHASE] = "phase",
> > > > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > > > >  };
> > > > >
> > > > >  static const char * const iio_modifier_names[] = {
> > > > > @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
> > > > >         [IIO_MOD_Q] = "q",
> > > > >         [IIO_MOD_CO2] = "co2",
> > > > >         [IIO_MOD_VOC] = "voc",
> > > > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > > > +       [IIO_MOD_PM10] = "pm10",
> > > > >  };
> > > > >
> > > > >  /* relies on pairs of these shared then separate */
> > > > > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> > > > > index 92baabc103ac..465044b42af5 100644
> > > > > --- a/include/uapi/linux/iio/types.h
> > > > > +++ b/include/uapi/linux/iio/types.h
> > > > > @@ -46,6 +46,7 @@ enum iio_chan_type {
> > > > >         IIO_GRAVITY,
> > > > >         IIO_POSITIONRELATIVE,
> > > > >         IIO_PHASE,
> > > > > +       IIO_MASSCONCENTRATION,  
> > > >
> > > > So I'm guessing IIO_CONCENTRATION can't be scaled to the micro-grams
> > > > per cubic meter?  
> > >
> > > Currently concentration is defined as a percentage reading of a substance
> > > (which does make me wonder if it is meant to be percentage of the volume or
> > > percentage of the mass?)  Either way, if can't convert to a density measurement
> > > as it's a unit free ratio (I think).  
> >
> > Seems like it can be both..  guessing all the atmosphere ( CO2, VOC,
> > etc) ones are mass/density because on how they work.  
> 
> Hmm, but still percentage was picked up for IIO_CONCENTRATION which does
> really match PM expectations. Perhaps if units were sticked to modifiers
> it whould be easier to reuse that.

It gets very messy if we start doing that modifiers, I'd rather stick to
different channel types.  We already do this with other channel types
position / positionrelative for example.

It isn't as though it's actually possible to convert between the two without
knowing what the particles actually are...

Jonathan
> 
> > But the electro-conductivity sensor that is using IIO_CONCENTRATION
> > channels is likely from percentage of volume.
> >
> > - Matt
> >  
> > >  
> > > >  
> > > > >  };
> > > > >
> > > > >  enum iio_modifier {
> > > > > @@ -87,6 +88,8 @@ enum iio_modifier {
> > > > >         IIO_MOD_VOC,
> > > > >         IIO_MOD_LIGHT_UV,
> > > > >         IIO_MOD_LIGHT_DUV,
> > > > > +       IIO_MOD_PM2p5,  
> > > >
> > > > I know this is unit of measure but the lowercase p in IIO_MOD_PM2p5 is
> > > > a bit non-standard for iio defines/enum.  
> > > It is a bit odd and will get us scripted reports so maybe best to
> > > just go upper case and not worry about it.
> > >
> > > Jonathan  
> > > >
> > > > - Matt
> > > >  
> > > > > +       IIO_MOD_PM10,
> > > > >  };
> > > > >
> > > > >  enum iio_event_type {
> > > > > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> > > > > index ac2de6b7e89f..f0fcfeddba2b 100644
> > > > > --- a/tools/iio/iio_event_monitor.c
> > > > > +++ b/tools/iio/iio_event_monitor.c
> > > > > @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > > > >         [IIO_GRAVITY] = "gravity",
> > > > >         [IIO_POSITIONRELATIVE] = "positionrelative",
> > > > >         [IIO_PHASE] = "phase",
> > > > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > > > >  };
> > > > >
> > > > >  static const char * const iio_ev_type_text[] = {
> > > > > @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
> > > > >         [IIO_MOD_Q] = "q",
> > > > >         [IIO_MOD_CO2] = "co2",
> > > > >         [IIO_MOD_VOC] = "voc",
> > > > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > > > +       [IIO_MOD_PM10] = "pm10",
> > > > >  };
> > > > >
> > > > >  static bool event_is_known(struct iio_event_data *event)
> > > > > @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
> > > > >         case IIO_GRAVITY:
> > > > >         case IIO_POSITIONRELATIVE:
> > > > >         case IIO_PHASE:
> > > > > +       case IIO_MASSCONCENTRATION:
> > > > >                 break;
> > > > >         default:
> > > > >                 return false;
> > > > > @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
> > > > >         case IIO_MOD_Q:
> > > > >         case IIO_MOD_CO2:
> > > > >         case IIO_MOD_VOC:
> > > > > +       case IIO_MOD_PM2p5:
> > > > > +       case IIO_MOD_PM10:
> > > > >                 break;
> > > > >         default:
> > > > >                 return false;
> > > > > --
> > > > > 2.19.2
> > > > >  
> > >
Matt Ranostay Dec. 2, 2018, 11:32 a.m. UTC | #9
On Sat, Dec 1, 2018 at 5:48 PM Jonathan Cameron
<jic23@jic23.retrosnub.co.uk> wrote:
>
> On Sun, 25 Nov 2018 16:44:23 +0100
> Tomasz Duszynski <tduszyns@gmail.com> wrote:
>
> > On Sun, Nov 25, 2018 at 06:14:44AM -0800, Matt Ranostay wrote:
> > > On Sun, Nov 25, 2018 at 6:03 AM Jonathan Cameron
> > > <jic23@jic23.retrosnub.co.uk> wrote:
> > > >
> > > > On Sun, 25 Nov 2018 05:51:32 -0800
> > > > Matt Ranostay <matt.ranostay@konsulko.com> wrote:
> > > >
> > > > > On Sat, Nov 24, 2018 at 2:14 PM Tomasz Duszynski <tduszyns@gmail.com> wrote:
> > > > > >
> > > > > > 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, two modifiers are introduced used for distinguishing
> > > > > > between coarse (PM10) and fine particles (PM2p5) measurements, i.e
> > > > > > IIO_MOD_PM10 and IIO_MOD_PM2p5.
> > > > > >
> > > > > > Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
> > > > > > ---
> > > > > >  Documentation/ABI/testing/sysfs-bus-iio | 11 ++++++++++-
> > > > > >  drivers/iio/industrialio-core.c         |  3 +++
> > > > > >  include/uapi/linux/iio/types.h          |  3 +++
> > > > > >  tools/iio/iio_event_monitor.c           |  6 ++++++
> > > > > >  4 files changed, 22 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> > > > > > index 8127a08e366d..ce0ed140660d 100644
> > > > > > --- a/Documentation/ABI/testing/sysfs-bus-iio
> > > > > > +++ b/Documentation/ABI/testing/sysfs-bus-iio
> > > > > > @@ -1684,4 +1684,13 @@ KernelVersion:   4.18
> > > > > >  Contact:       linux-iio@vger.kernel.org
> > > > > >  Description:
> > > > > >                 Raw (unscaled) phase difference reading from channel Y
> > > > > > -               that can be processed to radians.
> > > > > > \ No newline at end of file
> > > > > > +               that can be processed to radians.
> > > > > > +
> > > > > > +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_pm10_input
> > > > > > +What:          /sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
> > > > > > +KernelVersion: 4.21
> > > > > > +Contact:       linux-iio@vger.kernel.org
> > > > > > +Description:
> > > > > > +               Mass concentration reading of particulate matter in ug / m3.
> > > > > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > > > > > index a062cfddc5af..2a9ef600c1fb 100644
> > > > > > --- a/drivers/iio/industrialio-core.c
> > > > > > +++ b/drivers/iio/industrialio-core.c
> > > > > > @@ -87,6 +87,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > > > > >         [IIO_GRAVITY]  = "gravity",
> > > > > >         [IIO_POSITIONRELATIVE]  = "positionrelative",
> > > > > >         [IIO_PHASE] = "phase",
> > > > > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > > > > >  };
> > > > > >
> > > > > >  static const char * const iio_modifier_names[] = {
> > > > > > @@ -127,6 +128,8 @@ static const char * const iio_modifier_names[] = {
> > > > > >         [IIO_MOD_Q] = "q",
> > > > > >         [IIO_MOD_CO2] = "co2",
> > > > > >         [IIO_MOD_VOC] = "voc",
> > > > > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > > > > +       [IIO_MOD_PM10] = "pm10",
> > > > > >  };
> > > > > >
> > > > > >  /* relies on pairs of these shared then separate */
> > > > > > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> > > > > > index 92baabc103ac..465044b42af5 100644
> > > > > > --- a/include/uapi/linux/iio/types.h
> > > > > > +++ b/include/uapi/linux/iio/types.h
> > > > > > @@ -46,6 +46,7 @@ enum iio_chan_type {
> > > > > >         IIO_GRAVITY,
> > > > > >         IIO_POSITIONRELATIVE,
> > > > > >         IIO_PHASE,
> > > > > > +       IIO_MASSCONCENTRATION,
> > > > >
> > > > > So I'm guessing IIO_CONCENTRATION can't be scaled to the micro-grams
> > > > > per cubic meter?
> > > >
> > > > Currently concentration is defined as a percentage reading of a substance
> > > > (which does make me wonder if it is meant to be percentage of the volume or
> > > > percentage of the mass?)  Either way, if can't convert to a density measurement
> > > > as it's a unit free ratio (I think).
> > >
> > > Seems like it can be both..  guessing all the atmosphere ( CO2, VOC,
> > > etc) ones are mass/density because on how they work.
> >
> > Hmm, but still percentage was picked up for IIO_CONCENTRATION which does
> > really match PM expectations. Perhaps if units were sticked to modifiers
> > it whould be easier to reuse that.
>
> It gets very messy if we start doing that modifiers, I'd rather stick to
> different channel types.  We already do this with other channel types
> position / positionrelative for example.
>
> It isn't as though it's actually possible to convert between the two without
> knowing what the particles actually are...

Wondering if some of the current chemical sensors in the tree should
be switched to IIO_MASSCONCENTRATION, and only one I can think is
truly by volume is the electro-conductivity sensor (part of the
atlas-ph-sensor.c)

- Matt

>
> Jonathan
> >
> > > But the electro-conductivity sensor that is using IIO_CONCENTRATION
> > > channels is likely from percentage of volume.
> > >
> > > - Matt
> > >
> > > >
> > > > >
> > > > > >  };
> > > > > >
> > > > > >  enum iio_modifier {
> > > > > > @@ -87,6 +88,8 @@ enum iio_modifier {
> > > > > >         IIO_MOD_VOC,
> > > > > >         IIO_MOD_LIGHT_UV,
> > > > > >         IIO_MOD_LIGHT_DUV,
> > > > > > +       IIO_MOD_PM2p5,
> > > > >
> > > > > I know this is unit of measure but the lowercase p in IIO_MOD_PM2p5 is
> > > > > a bit non-standard for iio defines/enum.
> > > > It is a bit odd and will get us scripted reports so maybe best to
> > > > just go upper case and not worry about it.
> > > >
> > > > Jonathan
> > > > >
> > > > > - Matt
> > > > >
> > > > > > +       IIO_MOD_PM10,
> > > > > >  };
> > > > > >
> > > > > >  enum iio_event_type {
> > > > > > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
> > > > > > index ac2de6b7e89f..f0fcfeddba2b 100644
> > > > > > --- a/tools/iio/iio_event_monitor.c
> > > > > > +++ b/tools/iio/iio_event_monitor.c
> > > > > > @@ -60,6 +60,7 @@ static const char * const iio_chan_type_name_spec[] = {
> > > > > >         [IIO_GRAVITY] = "gravity",
> > > > > >         [IIO_POSITIONRELATIVE] = "positionrelative",
> > > > > >         [IIO_PHASE] = "phase",
> > > > > > +       [IIO_MASSCONCENTRATION] = "massconcentration",
> > > > > >  };
> > > > > >
> > > > > >  static const char * const iio_ev_type_text[] = {
> > > > > > @@ -115,6 +116,8 @@ static const char * const iio_modifier_names[] = {
> > > > > >         [IIO_MOD_Q] = "q",
> > > > > >         [IIO_MOD_CO2] = "co2",
> > > > > >         [IIO_MOD_VOC] = "voc",
> > > > > > +       [IIO_MOD_PM2p5] = "pm2p5",
> > > > > > +       [IIO_MOD_PM10] = "pm10",
> > > > > >  };
> > > > > >
> > > > > >  static bool event_is_known(struct iio_event_data *event)
> > > > > > @@ -156,6 +159,7 @@ static bool event_is_known(struct iio_event_data *event)
> > > > > >         case IIO_GRAVITY:
> > > > > >         case IIO_POSITIONRELATIVE:
> > > > > >         case IIO_PHASE:
> > > > > > +       case IIO_MASSCONCENTRATION:
> > > > > >                 break;
> > > > > >         default:
> > > > > >                 return false;
> > > > > > @@ -200,6 +204,8 @@ static bool event_is_known(struct iio_event_data *event)
> > > > > >         case IIO_MOD_Q:
> > > > > >         case IIO_MOD_CO2:
> > > > > >         case IIO_MOD_VOC:
> > > > > > +       case IIO_MOD_PM2p5:
> > > > > > +       case IIO_MOD_PM10:
> > > > > >                 break;
> > > > > >         default:
> > > > > >                 return false;
> > > > > > --
> > > > > > 2.19.2
> > > > > >
> > > >
>
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index 8127a08e366d..ce0ed140660d 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -1684,4 +1684,13 @@  KernelVersion:	4.18
 Contact:	linux-iio@vger.kernel.org
 Description:
 		Raw (unscaled) phase difference reading from channel Y
-		that can be processed to radians.
\ No newline at end of file
+		that can be processed to radians.
+
+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_pm10_input
+What:		/sys/bus/iio/devices/iio:deviceX/in_massconcentrationY_pm10_input
+KernelVersion:	4.21
+Contact:	linux-iio@vger.kernel.org
+Description:
+		Mass concentration reading of particulate matter in ug / m3.
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index a062cfddc5af..2a9ef600c1fb 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -87,6 +87,7 @@  static const char * const iio_chan_type_name_spec[] = {
 	[IIO_GRAVITY]  = "gravity",
 	[IIO_POSITIONRELATIVE]  = "positionrelative",
 	[IIO_PHASE] = "phase",
+	[IIO_MASSCONCENTRATION] = "massconcentration",
 };
 
 static const char * const iio_modifier_names[] = {
@@ -127,6 +128,8 @@  static const char * const iio_modifier_names[] = {
 	[IIO_MOD_Q] = "q",
 	[IIO_MOD_CO2] = "co2",
 	[IIO_MOD_VOC] = "voc",
+	[IIO_MOD_PM2p5] = "pm2p5",
+	[IIO_MOD_PM10] = "pm10",
 };
 
 /* relies on pairs of these shared then separate */
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
index 92baabc103ac..465044b42af5 100644
--- a/include/uapi/linux/iio/types.h
+++ b/include/uapi/linux/iio/types.h
@@ -46,6 +46,7 @@  enum iio_chan_type {
 	IIO_GRAVITY,
 	IIO_POSITIONRELATIVE,
 	IIO_PHASE,
+	IIO_MASSCONCENTRATION,
 };
 
 enum iio_modifier {
@@ -87,6 +88,8 @@  enum iio_modifier {
 	IIO_MOD_VOC,
 	IIO_MOD_LIGHT_UV,
 	IIO_MOD_LIGHT_DUV,
+	IIO_MOD_PM2p5,
+	IIO_MOD_PM10,
 };
 
 enum iio_event_type {
diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
index ac2de6b7e89f..f0fcfeddba2b 100644
--- a/tools/iio/iio_event_monitor.c
+++ b/tools/iio/iio_event_monitor.c
@@ -60,6 +60,7 @@  static const char * const iio_chan_type_name_spec[] = {
 	[IIO_GRAVITY] = "gravity",
 	[IIO_POSITIONRELATIVE] = "positionrelative",
 	[IIO_PHASE] = "phase",
+	[IIO_MASSCONCENTRATION] = "massconcentration",
 };
 
 static const char * const iio_ev_type_text[] = {
@@ -115,6 +116,8 @@  static const char * const iio_modifier_names[] = {
 	[IIO_MOD_Q] = "q",
 	[IIO_MOD_CO2] = "co2",
 	[IIO_MOD_VOC] = "voc",
+	[IIO_MOD_PM2p5] = "pm2p5",
+	[IIO_MOD_PM10] = "pm10",
 };
 
 static bool event_is_known(struct iio_event_data *event)
@@ -156,6 +159,7 @@  static bool event_is_known(struct iio_event_data *event)
 	case IIO_GRAVITY:
 	case IIO_POSITIONRELATIVE:
 	case IIO_PHASE:
+	case IIO_MASSCONCENTRATION:
 		break;
 	default:
 		return false;
@@ -200,6 +204,8 @@  static bool event_is_known(struct iio_event_data *event)
 	case IIO_MOD_Q:
 	case IIO_MOD_CO2:
 	case IIO_MOD_VOC:
+	case IIO_MOD_PM2p5:
+	case IIO_MOD_PM10:
 		break;
 	default:
 		return false;