Re: [PATCH 3/4] iio: adc: ade9000: add support for ADE9430

From: Jonathan Cameron

Date: Sun Sep 13 2026 - 18:19:48 EST


On Mon, 7 Sep 2026 13:16:20 +0300
Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx> wrote:

> The ADE9430 is a polyphase energy metering device that is register
> compatible with the ADE9000. The differences relevant to the driver are
> the absence of the on-chip dip/swell detection, the absence of an on-chip
> digital integrator (the ADE9430 uses an external analog integrator for
> Rogowski coils, so the DICOEFF register does not exist) and slightly
> different full-scale ADC codes.
>
> Reuse the dip/swell-less channel table introduced for the ADE9078 and add
> a matching chip_info describing the ADE9430 full-scale codes. Add a
> has_digital_integrator flag to the chip_info so the DICOEFF write is only
> issued on parts that implement the register, and skip it for the ADE9430.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx>

I guess it is simple enough that I'm not that bothered, but my
normal preference would be to introduce the 'has_digital_integrator'
as a precursor where all device set that to true, then follow up with
the new part.

> diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c
> index 0f64bfb221da..2f5fe016a82f 100644
> --- a/drivers/iio/adc/ade9000.c
> +++ b/drivers/iio/adc/ade9000.c

> };
>
> struct ade9000_state {
> @@ -668,6 +670,7 @@ static const struct iio_chan_spec_ext_info ade9000_ext_info[] = {
>
> ADE9000_DECLARE_CHANNELS(ade9000_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL);
> ADE9000_DECLARE_CHANNELS(ade9078_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL_NO_EVENTS);
> +ADE9000_DECLARE_CHANNELS(ade9430_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL_NO_EVENTS);

It it is identical. Just use the ade9078_channels. This sort of reuse
of exiting chan_spec arrays on new devices is very common in drivers
that support a lot of parts. Don't worry about the name. They should
be named after the first device that needed that particular chan_spec
array.