[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250727141844.500c7416@jic23-huawei>
Date: Sun, 27 Jul 2025 14:18:44 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: <robh@...nel.org>, <conor+dt@...nel.org>, <devicetree@...r.kernel.org>,
<linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/5] iio: add power and energy measurement modifiers
On Mon, 21 Jul 2025 14:24:41 +0300
Antoniu Miclaus <antoniu.miclaus@...log.com> 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
>
> These modifiers enable proper representation of power measurement
> devices like energy meters and power analyzers.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
This series seems to have dropped it's cover letter between v1 and v2.
Make sure it's there for v3.
> ---
> changes in v2:
> - drop _accum modifiers
> - drop dip/swell modifiers
> - change power factor to be a chan_info
Do we ever need to getting for an IIO buffer?
> - voltage -> altvoltage for rms
> Documentation/ABI/testing/sysfs-bus-iio | 14 ++++++++++++++
> drivers/iio/industrialio-core.c | 5 +++++
> include/linux/iio/types.h | 1 +
> include/uapi/linux/iio/types.h | 4 ++++
> 4 files changed, 24 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index 3bc386995fb6..0948611227a8 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -169,7 +169,12 @@ Description:
> is required is a consistent labeling. Units after application
> of scale and offset are millivolts.
>
> +What: /sys/bus/iio/devices/iio:deviceX/in_altvoltageY_rms_raw
> +
> What: /sys/bus/iio/devices/iio:deviceX/in_powerY_raw
> +What: /sys/bus/iio/devices/iio:deviceX/in_powerY_active_raw
> +What: /sys/bus/iio/devices/iio:deviceX/in_powerY_reactive_raw
> +What: /sys/bus/iio/devices/iio:deviceX/in_powerY_apparent_raw
> KernelVersion: 4.5
> Contact: linux-iio@...r.kernel.org
> Description:
> @@ -178,6 +183,8 @@ Description:
> unique to allow association with event codes. Units after
> application of scale and offset are milliwatts.
>
> +What: /sys/bus/iio/devices/iio:deviceX/in_powerY_power_factor
> +
> What: /sys/bus/iio/devices/iio:deviceX/in_capacitanceY_raw
> KernelVersion: 3.2
> Contact: linux-iio@...r.kernel.org
> @@ -1593,6 +1600,12 @@ Description:
>
> What: /sys/.../iio:deviceX/in_energy_input
> What: /sys/.../iio:deviceX/in_energy_raw
> +What: /sys/.../iio:deviceX/in_energyY_active_raw
> +What: /sys/.../iio:deviceX/in_energyY_reactive_raw
> +What: /sys/.../iio:deviceX/in_energyY_apparent_raw
> +What: /sys/.../iio:deviceX/in_energyY_active_accum_raw
> +What: /sys/.../iio:deviceX/in_energyY_reactive_accum_raw
> +What: /sys/.../iio:deviceX/in_energyY_apparent_accum_raw
Seems the docs are still here from v1 for accum versions.
> /* relies on pairs of these shared then separate */
> @@ -189,6 +193,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_POWER_FACTOR] = "power_factor",
I thought David comment on this in v1. No _ in new info elements because
of the complexity it makes for userspace. We sometimes do accept them still
if they are related to an existing element - hence trough_raw a few lines up.
> };
> /**
> * 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..f26a0fbd6ab4 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_POWER_FACTOR,
> };
> enum iio_event_type {
Powered by blists - more mailing lists