mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Antoniu Miclaus <antoniu.miclaus@analog.com>
To: "Nuno Sá" <nuno.sa@analog.com>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
	"Joshua Crofts" <joshua.crofts1@gmail.com>,
	"Radu Sabau" <radu.sabau@analog.com>,
	"Janani Sunil" <janani.sunil@analog.com>,
	"Salih Erim" <salih.erim@amd.com>,
	"Jishnu Prakash" <jishnu.prakash@oss.qualcomm.com>,
	"Jakub Szczudlo" <jakubszczudlo40@gmail.com>,
	linux@analog.com, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: [PATCH 3/4] iio: adc: ade9000: add support for ADE9039
Date: Mon, 12 Oct 2026 14:13:39 +0300	[thread overview]
Message-ID: <20261012111342.48040-4-antoniu.miclaus@analog.com> (raw)
In-Reply-To: <20261012111342.48040-1-antoniu.miclaus@analog.com>

The ADE9039 is a polyphase energy metering device that is register
compatible with the ADE9000 for every register the driver touches. The
differences relevant to the driver are that it shares the full-scale codes
of the ADE9078 rather than those of the ADE9000, and that it has no total
reactive power register: the register map has no AVAR at 0x211 and no
AVAROS at 0x010, only the fundamental AFVAR and AFVAROS.

Add a chip_info for it and a channel table that keeps the dip/swell events
of the ADE9000 but drops the three total reactive power channels. The
fundamental reactive energy channels are unaffected, as AFVARHR is present.

No change is needed in the CALIBBIAS path: with no channel carrying the
AVAR address, that case is simply never reached for this part.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/adc/Kconfig   |  1 +
 drivers/iio/adc/ade9000.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 02de4809ae31..3052a86c460f 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -603,6 +603,7 @@ config ADE9000
 	    - ADE9000
 	    - ADE9078
 	    - ADE9430
+	    - ADE9039
 
 	  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 03b69556b62f..e7f509bbac77 100644
--- a/drivers/iio/adc/ade9000.c
+++ b/drivers/iio/adc/ade9000.c
@@ -683,6 +683,8 @@ ADE9000_DECLARE_CHANNELS(ade9000_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL,
 			 ADE9000_POWER_REACTIVE_ENTRY);
 ADE9000_DECLARE_CHANNELS(ade9078_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL_NO_EVENTS,
 			 ADE9000_POWER_REACTIVE_ENTRY);
+ADE9000_DECLARE_CHANNELS(ade9039_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL,
+			 ADE9000_NO_POWER_REACTIVE_ENTRY);
 
 /*
  * Full-scale codes referred from the respective datasheets. These are the
@@ -718,6 +720,16 @@ static const struct ade9000_chip_info ade9430_chip_info = {
 	.has_digital_integrator = false, /* no on-chip digital integrator */
 };
 
+static const struct ade9000_chip_info ade9039_chip_info = {
+	.name = "ade9039",
+	.channels = ade9039_channels,
+	.num_channels = ARRAY_SIZE(ade9039_channels),
+	.rms_full_scale_codes = 52866837,
+	.watt_full_scale_codes = 20823646,
+	.pcf_full_scale_codes = 74680000,
+	.has_digital_integrator = true,
+};
+
 static const struct reg_sequence ade9000_initialization_sequence[] = {
 	{ ADE9000_REG_PGA_GAIN, ADE9000_PGA_GAIN },
 	{ ADE9000_REG_CONFIG0, ADE9000_CONFIG0 },
@@ -1883,6 +1895,7 @@ 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 },
+	{ .name = "ade9039", .driver_data = (kernel_ulong_t)&ade9039_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(spi, ade9000_id);
@@ -1891,6 +1904,7 @@ 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 },
+	{ .compatible = "adi,ade9039", .data = &ade9039_chip_info },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ade9000_of_match);
-- 
2.43.0


  parent reply	other threads:[~2026-10-12 11:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 11:13 [PATCH 0/4] " Antoniu Miclaus
2026-10-12 11:13 ` [PATCH 1/4] iio: adc: ade9000: parameterise the reactive power channel Antoniu Miclaus
2026-10-12 13:51   ` Joshua Crofts
2026-10-12 11:13 ` [PATCH 2/4] dt-bindings: iio: adc: adi,ade9000: add adi,ade9039 compatible Antoniu Miclaus
2026-10-12 13:46   ` Joshua Crofts
2026-10-12 18:59   ` Conor Dooley
2026-10-12 11:13 ` Antoniu Miclaus [this message]
2026-10-12 13:50   ` [PATCH 3/4] iio: adc: ade9000: add support for ADE9039 Joshua Crofts
2026-10-12 11:13 ` [PATCH 4/4] docs: iio: ade9000: document ADE9039 support Antoniu Miclaus
2026-10-12 13:49   ` Joshua Crofts
2026-10-13  9:51 ` [PATCH 0/4] iio: adc: ade9000: add support for ADE9039 Nuno Sá

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261012111342.48040-4-antoniu.miclaus@analog.com \
    --to=antoniu.miclaus@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jakubszczudlo40@gmail.com \
    --cc=janani.sunil@analog.com \
    --cc=jic23@kernel.org \
    --cc=jishnu.prakash@oss.qualcomm.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=radu.sabau@analog.com \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=salih.erim@amd.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®