[PATCH 3/4] iio: adc: ade9000: add support for ADE9430
From: Antoniu Miclaus
Date: Mon Sep 07 2026 - 06:28:28 EST
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>
---
drivers/iio/adc/Kconfig | 1 +
drivers/iio/adc/ade9000.c | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 6431592c5fa3..85a10524c76a 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -587,6 +587,7 @@ config ADE9000
integrated circuits:
- ADE9000
- ADE9078
+ - ADE9430
The devices feature high-precision analog-to-digital converters
and digital signal processing to compute RMS values, power factor,
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
@@ -290,6 +290,7 @@ enum ade9000_wfb_cfg {
* @rms_full_scale_codes: digital code produced at full-scale RMS input
* @watt_full_scale_codes: digital code produced at full-scale power input
* @pcf_full_scale_codes: digital code produced at full-scale xI_PCF/xV_PCF input
+ * @has_digital_integrator: part has an on-chip digital integrator (DICOEFF)
*
* The full-scale codes are taken from the respective datasheets and are used to
* derive the IIO scale of the raw measurement channels.
@@ -301,6 +302,7 @@ struct ade9000_chip_info {
unsigned int rms_full_scale_codes;
unsigned int watt_full_scale_codes;
unsigned int pcf_full_scale_codes;
+ bool has_digital_integrator;
};
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);
/*
* Full-scale codes referred from the respective datasheets. These are the
@@ -680,6 +683,7 @@ static const struct ade9000_chip_info ade9000_chip_info = {
.rms_full_scale_codes = 52702092,
.watt_full_scale_codes = 20694066,
.pcf_full_scale_codes = 74532013,
+ .has_digital_integrator = true,
};
static const struct ade9000_chip_info ade9078_chip_info = {
@@ -689,6 +693,16 @@ static const struct ade9000_chip_info ade9078_chip_info = {
.rms_full_scale_codes = 52866837,
.watt_full_scale_codes = 20823646,
.pcf_full_scale_codes = 74680000,
+ .has_digital_integrator = true,
+};
+
+static const struct ade9000_chip_info ade9430_chip_info = {
+ .name = "ade9430",
+ .channels = ade9430_channels,
+ .num_channels = ARRAY_SIZE(ade9430_channels),
+ .rms_full_scale_codes = 52702092,
+ .watt_full_scale_codes = 20694066,
+ .pcf_full_scale_codes = 74532013,
};
static const struct reg_sequence ade9000_initialization_sequence[] = {
@@ -704,7 +718,6 @@ static const struct reg_sequence ade9000_initialization_sequence[] = {
{ ADE9000_REG_EVENT_MASK, ADE9000_EVENT_DISABLE },
{ ADE9000_REG_WFB_CFG, ADE9000_WFB_CFG },
{ ADE9000_REG_VLEVEL, ADE9000_VLEVEL },
- { ADE9000_REG_DICOEFF, ADE9000_DICOEFF },
{ ADE9000_REG_EGY_TIME, ADE9000_EGY_TIME },
{ ADE9000_REG_EP_CFG, ADE9000_EP_CFG },
/* Clear all pending status bits by writing 1s */
@@ -1672,6 +1685,14 @@ static int ade9000_setup(struct ade9000_state *st)
if (ret)
return dev_err_probe(dev, ret, "Failed to write register sequence");
+ /* The ADE9430 has no on-chip digital integrator and lacks DICOEFF. */
+ if (st->info->has_digital_integrator) {
+ ret = regmap_write(st->regmap, ADE9000_REG_DICOEFF,
+ ADE9000_DICOEFF);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to set DICOEFF\n");
+ }
+
fsleep(2000);
return 0;
@@ -1842,6 +1863,7 @@ static int ade9000_probe(struct spi_device *spi)
static const struct spi_device_id ade9000_id[] = {
{ .name = "ade9000", .driver_data = (kernel_ulong_t)&ade9000_chip_info },
{ .name = "ade9078", .driver_data = (kernel_ulong_t)&ade9078_chip_info },
+ { .name = "ade9430", .driver_data = (kernel_ulong_t)&ade9430_chip_info },
{ }
};
MODULE_DEVICE_TABLE(spi, ade9000_id);
@@ -1849,6 +1871,7 @@ MODULE_DEVICE_TABLE(spi, ade9000_id);
static const struct of_device_id ade9000_of_match[] = {
{ .compatible = "adi,ade9000", .data = &ade9000_chip_info },
{ .compatible = "adi,ade9078", .data = &ade9078_chip_info },
+ { .compatible = "adi,ade9430", .data = &ade9430_chip_info },
{ }
};
MODULE_DEVICE_TABLE(of, ade9000_of_match);
--
2.43.0