Re: [PATCH v6 2/6] iio: add power and energy measurement modifiers

From: David Lechner
Date: Fri Aug 29 2025 - 15:47:21 EST


On 8/29/25 6:41 AM, Antoniu Miclaus wrote:
> Add new IIO modifiers to support power and energy measurement devices:
>
> Power modifiers:
> - IIO_MOD_ACTIVE: Real power consumed by the load
> - IIO_MOD_REACTIVE: Power that oscillates between source and load
> - IIO_MOD_APPARENT: Magnitude of complex power
> - IIO_MOD_FUND_REACTIVE: Reactive power at fundamental frequency
> - IIO_MOD_FACTOR: Power factor (ratio of active to apparent power)
>
> Signal quality modifiers:
> - IIO_MOD_RMS: Root Mean Square value

The message doesn't match what got implemented in the patch.

>
> These modifiers enable proper representation of power measurement
> devices like energy meters and power analyzers.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx>
> ---

...

> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 8c9098668772..9e372ed38552 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -153,6 +153,10 @@ static const char * const iio_modifier_names[] = {
> [IIO_MOD_PITCH] = "pitch",
> [IIO_MOD_YAW] = "yaw",
> [IIO_MOD_ROLL] = "roll",
> + [IIO_MOD_RMS] = "rms",
> + [IIO_MOD_ACTIVE] = "active",
> + [IIO_MOD_REACTIVE] = "reactive",
> + [IIO_MOD_APPARENT] = "apparent",
> };
>
> /* relies on pairs of these shared then separate */
> @@ -190,6 +194,7 @@ static const char * const iio_chan_info_postfix[] = {
> [IIO_CHAN_INFO_ZEROPOINT] = "zeropoint",
> [IIO_CHAN_INFO_TROUGH] = "trough_raw",
> [IIO_CHAN_INFO_CONVDELAY] = "convdelay",
> + [IIO_CHAN_INFO_POWERFACTOR] = "powerfactor",
> };
> /**
> * iio_device_id() - query the unique ID for the device
> diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
> index ad2761efcc83..34eebad12d2c 100644
> --- a/include/linux/iio/types.h
> +++ b/include/linux/iio/types.h
> @@ -70,6 +70,7 @@ enum iio_chan_info_enum {
> IIO_CHAN_INFO_ZEROPOINT,
> IIO_CHAN_INFO_TROUGH,
> IIO_CHAN_INFO_CONVDELAY,
> + IIO_CHAN_INFO_POWERFACTOR,
> };
>
> #endif /* _IIO_TYPES_H_ */
> diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
> index 3c3cc1497a1e..6d269b844271 100644
> --- a/include/uapi/linux/iio/types.h
> +++ b/include/uapi/linux/iio/types.h
> @@ -109,6 +109,10 @@ enum iio_modifier {
> IIO_MOD_ROLL,
> IIO_MOD_LIGHT_UVA,
> IIO_MOD_LIGHT_UVB,
> + IIO_MOD_RMS,
> + IIO_MOD_ACTIVE,
> + IIO_MOD_REACTIVE,
> + IIO_MOD_APPARENT,
> };
>
> enum iio_event_type {


Do we need to add these to tools/iio/iio_event_monitor.c as well?