From nobody Fri Oct 2 13:07:19 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C39B13D79FB; Fri, 31 Jul 2026 08:30:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486655; cv=none; b=pW+qbrDCAvS+RkMKvHHkBIkz1/ROE5uztunGdhbZ5NeBn/Nsmm6GON5e1CCI9yCZo3O//BZrWsfDFpapOrkX2XVix5G90njuFve8RKRr2KGnl2AFv7EYp270r4ZpOSSBRAQjqqRT0ntG17PZDgYbdS3gjsglWgsnbITBWloIDIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486655; c=relaxed/simple; bh=0VvITTeunSEU6FCLG4ijPHfeaeaSvHajzzyBtcY6sRs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FZocl3ubRyELaEHafaKARMHjgXYh0sg9W0Vs1BSs3ssNdJlEkbjc2ez1vF12hiLwA4Iam6cwdjKbMyDBovDG35N9FIszw/apqmli9EiR+F/cUHTMg/aaf8/yBk8z8fqyY9zKwXUx5HjakimrHZPBE+ab+76+eaRTX7kv098Ky98= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=oZEhuk1n; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="oZEhuk1n" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66V7xZPK2896907; Fri, 31 Jul 2026 04:30:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=63ZkX 592KKn9v//pOFBQ06ZojesSMW5WCSx2R34ED7M=; b=oZEhuk1nRV1tzP7BxEXnn zD+6zd1TiCz3gAwB+BYo9QrTgMfbCY02h5IVfr41z/P70Bnxdy/QpCK70g+cWQIW x8uVJt0u2TTget8TZRUfvinpF7hrTFikLY1mtY7wh/wYE5ZtI3Wxw6BK6jZQW0iX rOt/hOYVTY0UM/VrknmZnAYdLIQ3EDnj/miE091S1NoxUGHO3PsPdbygmYiqwi8x 2gJy5nyMEE+WBV2Hb5Olf3WXe/BaZ9EYgAbJZjJ+SkRK1/UPYa15IsdDM9YQ5Pvu IoDwYdJsU+A1umY5PIuDBBSxJo/+XCner1MCNC9q9S+PTzjDZ1CyPtIPCDd6BqQ+ Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4fqag4kd2d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 04:30:34 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 66V8UXsh039897 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 31 Jul 2026 04:30:33 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Fri, 31 Jul 2026 04:30:32 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Fri, 31 Jul 2026 04:30:32 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.148]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66V8UDN7026738; Fri, 31 Jul 2026 04:30:27 -0400 From: Antoniu Miclaus To: Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Michael Hennerich , Jonathan Cameron , David Lechner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , Radu Sabau , Marcelo Schmitt , Jorge Marques , Salih Erim , Matti Vaittinen , Jishnu Prakash , , , , , Subject: [PATCH v2 1/4] iio: adc: ade9000: introduce chip_info structure Date: Fri, 31 Jul 2026 11:29:47 +0300 Message-ID: <20260731082951.1228-2-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260731082951.1228-1-antoniu.miclaus@analog.com> References: <20260731082951.1228-1-antoniu.miclaus@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=V/tNF+ni c=1 sm=1 tr=0 ts=6a6c5d2a cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=Z0pTeXoby7EwIRygza74:22 a=gAnH3GRIAAAA:8 a=Zyf-6xheGXU4bo_EAj4A:9 X-Proofpoint-GUID: VCE5jxiVnDK2FL-w2cCEbtRTRTTUqeBB X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfX3iBvKTDR7yeh xbPvp9dC4h6oNpBwKuiB0nWK6cDZlpQQGOhuKe60QjUIP1PTDW0F5xhF92uuRw3dTJjW1kM04lQ GsdhX78i21YRSGsBbZvqbTda47GI+EVHfa1YuzY/bK+Z2irqzc3NVTeYnszsZXR0mhZW90D8/XF vuj2t1HpQ9J8TE1TtEP/Y/uHbAycMgxlzhP0Nae8uSBKrSsDgYavfK4HGWSqgqsmfx1XRRTDdW8 qXod3HXT84KwlUDgmGWMunobrHInszzYmQcc+hSWnzCzrLSlD8K9BhMuJTZYK/kIDxpnCysNalw MU763uRtKDSG8lAPbVuB3LdYi/AUJkwEZgHGk6Szti6eoeJRg6sjEBkCM80BYQ9y6ePsXL1QCUP 0NMERIg3Dm0JN3HDJCTkC1p9okQ8A/6ibUXkupb7UQEJvUSls5Unvw45DdRbwP3BU7Hg/n95GOK 8EoE+z22YJPBikUZZ5A== X-Proofpoint-ORIG-GUID: VCE5jxiVnDK2FL-w2cCEbtRTRTTUqeBB X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfX+Nx6bFnGrok3 sart7jNbakh4Xihee0NdpUKN8AKJIqd23aFAZKgXlznnLPXS1Kn3mQmY1nVocID6eMx/rJbkHQy YxkEAXfVgRASwjgUGQdxDc3nzA1KTOtga7JsFl5p8P97KkxlJFnP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_03,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 impostorscore=0 spamscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310060 Content-Type: text/plain; charset="utf-8" The driver currently hardcodes the device name and the full-scale ADC codes used to derive the IIO scale attributes. In preparation for supporting additional parts of the ADE9000 family, move these part-specific values into a new struct ade9000_chip_info and retrieve it via spi_get_device_match_data() at probe time. The channel table and its size are also referenced through the chip_info so that parts with a different channel layout can be added without touching the probe path. No functional change intended for the ADE9000. Signed-off-by: Antoniu Miclaus --- Changes in v2: - introduce the "respective datasheets" comment wording here to avoid churn in the ADE9078 patch. drivers/iio/adc/ade9000.c | 63 +++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c index c6c3ea953fea..030bb9109ab6 100644 --- a/drivers/iio/adc/ade9000.c +++ b/drivers/iio/adc/ade9000.c @@ -242,14 +242,6 @@ #define ADE9000_LAST_PAGE_BIT BIT(15) #define ADE9000_MIDDLE_PAGE_BIT BIT(7) =20 -/* - * Full scale Codes referred from Datasheet. Respective digital codes are - * produced when ADC inputs are at full scale. - */ -#define ADE9000_RMS_FULL_SCALE_CODES 52866837 -#define ADE9000_WATT_FULL_SCALE_CODES 20694066 -#define ADE9000_PCF_FULL_SCALE_CODES 74770000 - /* Phase and channel definitions */ #define ADE9000_PHASE_A_NR 0 #define ADE9000_PHASE_B_NR 1 @@ -290,7 +282,29 @@ enum ade9000_wfb_cfg { #define ADE9000_ADDR_ADJUST(addr, chan) \ (((chan) =3D=3D 0 ? 0 : (chan) =3D=3D 1 ? 2 : 4) << 4 | (addr)) =20 +/** + * struct ade9000_chip_info - part-specific configuration + * @name: IIO device name reported to userspace + * @channels: channel specification for this part + * @num_channels: number of entries in @channels + * @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_PC= F input + * + * The full-scale codes are taken from the respective datasheets and are u= sed to + * derive the IIO scale of the raw measurement channels. + */ +struct ade9000_chip_info { + const char *name; + const struct iio_chan_spec *channels; + unsigned int num_channels; + unsigned int rms_full_scale_codes; + unsigned int watt_full_scale_codes; + unsigned int pcf_full_scale_codes; +}; + struct ade9000_state { + const struct ade9000_chip_info *info; struct completion reset_completion; struct mutex lock; /* Protects SPI transactions */ u8 wf_src; @@ -623,6 +637,19 @@ static const struct iio_chan_spec ade9000_channels[] = =3D { ADE9000_POWER_FACTOR_CHANNEL(ADE9000_PHASE_C_NR), }; =20 +/* + * Full-scale codes referred from the respective datasheets. These are the + * digital codes produced when the ADC inputs are at full scale. + */ +static const struct ade9000_chip_info ade9000_chip_info =3D { + .name =3D "ade9000", + .channels =3D ade9000_channels, + .num_channels =3D ARRAY_SIZE(ade9000_channels), + .rms_full_scale_codes =3D 52866837, + .watt_full_scale_codes =3D 20694066, + .pcf_full_scale_codes =3D 74770000, +}; + static const struct reg_sequence ade9000_initialization_sequence[] =3D { { ADE9000_REG_PGA_GAIN, ADE9000_PGA_GAIN }, { ADE9000_REG_CONFIG0, ADE9000_CONFIG0 }, @@ -1064,7 +1091,7 @@ static int ade9000_read_raw(struct iio_dev *indio_dev, case ADE9000_REG_CI_PCF: case ADE9000_REG_CV_PCF: *val =3D 1; - *val2 =3D ADE9000_PCF_FULL_SCALE_CODES; + *val2 =3D st->info->pcf_full_scale_codes; return IIO_VAL_FRACTIONAL; case ADE9000_REG_AIRMS: case ADE9000_REG_AVRMS: @@ -1073,14 +1100,14 @@ static int ade9000_read_raw(struct iio_dev *indio_d= ev, case ADE9000_REG_CIRMS: case ADE9000_REG_CVRMS: *val =3D 1; - *val2 =3D ADE9000_RMS_FULL_SCALE_CODES; + *val2 =3D st->info->rms_full_scale_codes; return IIO_VAL_FRACTIONAL; default: return -EINVAL; } case IIO_POWER: *val =3D 1; - *val2 =3D ADE9000_WATT_FULL_SCALE_CODES; + *val2 =3D st->info->watt_full_scale_codes; return IIO_VAL_FRACTIONAL; default: break; @@ -1692,6 +1719,10 @@ static int ade9000_probe(struct spi_device *spi) =20 st =3D iio_priv(indio_dev); =20 + st->info =3D spi_get_device_match_data(spi); + if (!st->info) + return -ENODEV; + regmap =3D devm_regmap_init(dev, NULL, st, &ade9000_regmap_config); if (IS_ERR(regmap)) return dev_err_probe(dev, PTR_ERR(regmap), "Unable to allocate ADE9000 r= egmap"); @@ -1726,7 +1757,7 @@ static int ade9000_probe(struct spi_device *spi) if (ret) return ret; =20 - indio_dev->name =3D "ade9000"; + indio_dev->name =3D st->info->name; indio_dev->info =3D &ade9000_info; indio_dev->modes =3D INDIO_DIRECT_MODE; indio_dev->setup_ops =3D &ade9000_buffer_ops; @@ -1736,8 +1767,8 @@ static int ade9000_probe(struct spi_device *spi) return dev_err_probe(&spi->dev, ret, "Failed to get and enable vdd regulator\n"); =20 - indio_dev->channels =3D ade9000_channels; - indio_dev->num_channels =3D ARRAY_SIZE(ade9000_channels); + indio_dev->channels =3D st->info->channels; + indio_dev->num_channels =3D st->info->num_channels; =20 ret =3D devm_iio_kfifo_buffer_setup(dev, indio_dev, &ade9000_buffer_ops); @@ -1768,13 +1799,13 @@ static int ade9000_probe(struct spi_device *spi) }; =20 static const struct spi_device_id ade9000_id[] =3D { - { .name =3D "ade9000" }, + { .name =3D "ade9000", .driver_data =3D (kernel_ulong_t)&ade9000_chip_inf= o }, { } }; MODULE_DEVICE_TABLE(spi, ade9000_id); =20 static const struct of_device_id ade9000_of_match[] =3D { - { .compatible =3D "adi,ade9000" }, + { .compatible =3D "adi,ade9000", .data =3D &ade9000_chip_info }, { } }; MODULE_DEVICE_TABLE(of, ade9000_of_match); --=20 2.43.0 From nobody Fri Oct 2 13:07:19 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BFFC3D6CC1; Fri, 31 Jul 2026 08:30:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486653; cv=none; b=I9MkMv9aGUrAD6bKuI+sLmxOaZg+SVuRqe7QQ+I2TFfS97jcVIJ91E3CcwH+AWTEI4hlNsWWpuGok1iGoSZQ8PToGq5Amqpq2lAfQ4FtXQ4co/mtWRw0Gx7HoHWsB1wO3ernIeXi1pcWQCgxOj52O3Qp+EEELfDdvrcaFADhneE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486653; c=relaxed/simple; bh=W5Z8av5sCnv2yz5kgM2/4a0qp9r6/NLPnwJl75cKxi0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EEMkiup7iFufCfkA4gYU4LkLrxziYmY5K5gAinPMoF0GuaYR/0IU47rxmK0UTAxcaYRCebW5Hcd0m7edSpvJc2Tfeeu1LGoBlr+KrjMEwaqMiLmKDzu6qZR8xIIELQg1lMCQqzbu4P9rWrsImTwnNi0sYq2DhstXQ05wXEgLqKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=ndNTVDxN; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="ndNTVDxN" Received: from pps.filterd (m0516787.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66V7wn493068291; Fri, 31 Jul 2026 04:30:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=yPZ3z rgj6+4iyZXG/R2leQ7sIsZNXpfKMiX7xRQxvwg=; b=ndNTVDxNx83sYUr+c3b89 XkfBMPDow8WSUJsxjthRhYuBoonppX8lUAO4gsqzxL8/Oqd5n9Hzp052TVWf52cS GLCtnK7LV8hphw+WsXMcjaZndMJrxMyztmyFs2QDiBnE+mv7BEOguj9DyIdEefR9 nn6+0VDi1k65cjHGymiZqWY6up9dWVizYdo3Hq4UY/encuVNXzlToQSHlcKaS76V VSsDSD89+kULMCLFdTIPsb8CpR4qec7XEwO+X0u1c6I+tqaKbFzXaVZh+yBK829d N810GrzWQBaMZ4FoezwIYrUIfrtW1GKBMg3xCYrrPlvKtlxCDNoWX7hpXzvSD4Y2 w== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4fqj4f9hug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 04:30:36 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 66V8UZNe039903 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 31 Jul 2026 04:30:35 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Fri, 31 Jul 2026 04:30:35 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Fri, 31 Jul 2026 04:30:35 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.148]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66V8UDN8026738; Fri, 31 Jul 2026 04:30:30 -0400 From: Antoniu Miclaus To: Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Michael Hennerich , Jonathan Cameron , David Lechner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , Radu Sabau , Marcelo Schmitt , Jorge Marques , Salih Erim , Matti Vaittinen , Jishnu Prakash , , , , , Subject: [PATCH v2 2/4] dt-bindings: iio: adc: adi,ade9000: add adi,ade9078 compatible Date: Fri, 31 Jul 2026 11:29:48 +0300 Message-ID: <20260731082951.1228-3-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260731082951.1228-1-antoniu.miclaus@analog.com> References: <20260731082951.1228-1-antoniu.miclaus@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: L7BSXLcF1x8U0XhgD-3ixYI0Ue0g00kj X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfX8jxxt0G009y4 vVSirLY63fqkJpPTO8fqmc1UrC0Li6sgg1N/PlJiTBqk7qYd4pLx3AqnsDLh1Z4SfozwqpM37fU f1VLeueXSaKxkLSCsoyHd2D0F+87dj7ELWo2o4B3BUTBbDsg0KxRbiZs8BurF2jaSjxjf5CwGQw 7CweQ1jO52O/Dh/eiZzCMkSD69y63aNqmr3htS3fHxRgcXBBXd2xbufIGwr5YMMLaG6L57S/X+7 iOneb7JyDzv0a/tSK2U3W9S6tRq2uKYlB5ZxnDJakLsUvsyNuoVN0M7NyejdUQZ5tmV4xXgMO7y Sli5fvzozFIR0AD3nIDLWGPDWcMiNBK0zJcK7RUKx3oODzXrwC99LFr5z8BeZu5e9nYuQMYqCNE AgD07bvv9bsWhCP4BViHDiIOXqpS/qZAxYzkPdFpmo64zHU26bHrdtV4Hi9bzH2PBoi79XOAmBh hEn9eaVv4qtjRgghgHw== X-Authority-Analysis: v=2.4 cv=EMk2FVZC c=1 sm=1 tr=0 ts=6a6c5d2d cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=OmVn7CZJonkx5R5zMQLL:22 a=gEfo2CItAAAA:8 a=gAnH3GRIAAAA:8 a=0G5oFKN4N_cOIownKFoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=sptkURWiP4Gy88Gu7hUp:22 X-Proofpoint-GUID: L7BSXLcF1x8U0XhgD-3ixYI0Ue0g00kj X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfX8ocT+ojA++Fz Hi5mARkDvO8+fM/DPjbmSAPAgLf4F63OglDuDD8pPjdZskXLuT2n9k8631jyHKMkcN6MCrKBhH5 8TN81vxSDzmG1n3154LoiLTNKLVHj1oZz0+ia9ddOpgN+WlOp7sC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_03,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 phishscore=0 spamscore=0 suspectscore=0 clxscore=1011 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310060 The ADE9078 is a polyphase energy metering device from the same family as the ADE9000. It is register-compatible with the ADE9000 but does not provide the on-chip dip/swell detection and is limited to a 10 MHz SPI clock. Add the new compatible along with a conditional constraint lowering the maximum spi-max-frequency for the ADE9078. Signed-off-by: Antoniu Miclaus Reviewed-by: Rob Herring (Arm) --- no changes in v2. .../bindings/iio/adc/adi,ade9000.yaml | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ade9000.yaml b/D= ocumentation/devicetree/bindings/iio/adc/adi,ade9000.yaml index f22eba0250ee..1e940e8c7297 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ade9000.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ade9000.yaml @@ -5,21 +5,23 @@ $id: http://devicetree.org/schemas/iio/adc/adi,ade9000.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 -title: Analog Devices ADE9000 High Performance, Polyphase Energy Metering +title: Analog Devices ADE9000/ADE9078 High Performance, Polyphase Energy M= etering =20 maintainers: - Antoniu Miclaus =20 description: | - The ADE9000 is a highly accurate, fully integrated, multiphase energy an= d power - quality monitoring device. Superior analog performance and a digital sig= nal - processing (DSP) core enable accurate energy monitoring over a wide dyna= mic - range. An integrated high end reference ensures low drift over temperatu= re - with a combined drift of less than =C2=B125 ppm/=C2=B0C maximum for the = entire channel - including a programmable gain amplifier (PGA) and an analog-to-digital - converter (ADC). + The ADE9000 and ADE9078 are highly accurate, fully integrated, multiphase + energy and power quality monitoring devices. Superior analog performance= and a + digital signal processing (DSP) core enable accurate energy monitoring o= ver a + wide dynamic range. An integrated high end reference ensures low drift o= ver + temperature with a combined drift of less than =C2=B125 ppm/=C2=B0C maxi= mum for the + entire channel including a programmable gain amplifier (PGA) and an + analog-to-digital converter (ADC). The ADE9078 does not provide the on-c= hip + dip/swell detection available on the ADE9000. =20 https://www.analog.com/media/en/technical-documentation/data-sheets/ADE9= 000.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/ADE9= 078.pdf =20 $ref: /schemas/spi/spi-peripheral-props.yaml# =20 @@ -27,6 +29,7 @@ properties: compatible: enum: - adi,ade9000 + - adi,ade9078 =20 reg: maxItems: 1 @@ -67,6 +70,17 @@ required: - reg - vdd-supply =20 +allOf: + - if: + properties: + compatible: + contains: + const: adi,ade9078 + then: + properties: + spi-max-frequency: + maximum: 10000000 + unevaluatedProperties: false =20 examples: --=20 2.43.0 From nobody Fri Oct 2 13:07:19 2026 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FA4B3D953A; Fri, 31 Jul 2026 08:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486655; cv=none; b=frerlM9xs9zXrMjAwWvXlMP1M3nqrl0uI3eVKEWnN/lBPsHbuJFF5L2sGe3VjlR1HnW296K7zQIr3Ghrvfpa6fLfIGsN2tIJ+b9jlT3/L1EX3zdJzklovYDqUdHoQN0p5K92paTm/I2N7d8gzHN6C5Cr7VEsO11L76I4nqSUQUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486655; c=relaxed/simple; bh=80lx2QP9Q84pUQbWXF6tTDBmLo/A1sVN7UUPcL6f0PY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cLX2PkXWFFgaU32PKu2zrnOz/k5WtAXhbMsfMNAuKKB+0/+TiIbiQbiOPFPmTPKJaNoRbTNMHhcAaWrN/kkdGKJ8atMcUXC1/kMikAbQTcPZPPLFSFhWBPkulYcfZVYILYUsE+rUapKDLM+X9GqE7g8hzBPdjGlggIBmIxM6gOI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=h0g018h1; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="h0g018h1" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66V7xZPL2896907; Fri, 31 Jul 2026 04:30:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=fkL1q HNxjHzfC8+5BLUM/Ym9nmK/SDKvYfqICN+Jz0k=; b=h0g018h1frosAIJHfLpjz 9UuZrLYOFHe6eFRacgLHBVzDeCHrCaDABTh8BRupgBmY/mO0lZ1pCqwYtW+d9xHo EfTN2pahL9SH6cE+qG00jdXGFjDp8jAAVRTa+Mz0N8W9zIb62x5vyTweh0L2aBgk nuwH+0jwKdgoLIveW311o5T2vEgtuhTUGFA7iJKGRfkX5q7SqvlYA0v791rp6isf 9RHPvoA/U5K2E5DOWOcvWSSNP3vsNmvcK38t87pFkNzKp3MBdXS+w8AxyPunzeD9 v15IkrOi3OaycltiLcVGH8iVeknxB7o9ls8inTV54EcofSA8/8hpAr4BKta4uRct A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4fqag4kd6u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 04:30:40 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 66V8UdeE039906 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 31 Jul 2026 04:30:39 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Fri, 31 Jul 2026 04:30:39 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Fri, 31 Jul 2026 04:30:39 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.148]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66V8UDN9026738; Fri, 31 Jul 2026 04:30:33 -0400 From: Antoniu Miclaus To: Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Michael Hennerich , Jonathan Cameron , David Lechner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Shuah Khan , Radu Sabau , Marcelo Schmitt , Jorge Marques , Salih Erim , Matti Vaittinen , Jishnu Prakash , , , , , Subject: [PATCH v2 3/4] iio: adc: ade9000: add support for ADE9078 Date: Fri, 31 Jul 2026 11:29:49 +0300 Message-ID: <20260731082951.1228-4-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260731082951.1228-1-antoniu.miclaus@analog.com> References: <20260731082951.1228-1-antoniu.miclaus@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=V/tNF+ni c=1 sm=1 tr=0 ts=6a6c5d30 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=Z0pTeXoby7EwIRygza74:22 a=gAnH3GRIAAAA:8 a=YwgtIo4Oc6jtI8F_Jh8A:9 X-Proofpoint-GUID: gYnP_IoxA3uisTU5tvHJ0ssfbgObGVyC X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfX6Npl/6OXbv81 KDBC3pr1AMI0JqA1tt0o9lTCl8uiP2+k4xmLrTr6wtJkyyQc9wcl8Pm0ke7xJCkYvEXJlu1zz9e u8KcxyB0t4QMdhIhpMKEcTLzxyiVlfwDdnRPrd43EQvERt5Marl8UvQabbESj6Gpx5FrDvq9IGW s4ZCdk3D6L8EPRe1FyBkMnBxNbMdqaVXoNP922pvCgBumuOOh7M8maOIXVWsbPUZoMNdsV+xaUO X/Y2WT/TSjwRf2h1VooVFy8ipzQsUk0J92qWeQUb/byfnwitp07e+X+W0KxaEXm4PmIKwqw+KqX B9FwwafNS+A78MYgc6OVAKV6qGBphd+z6mGQURq2tYeAmFbZvn/PBfm4tXqWe1Zh70VAaaMrijF B3mu0jrNpFmzPIg39jg+kCZqKwnjRLlHPav9rUF9j7KFahPhzvmCstBhvBnaH/iNH7u5J4w7lFu IRhptASyhcRt9PA5ZjQ== X-Proofpoint-ORIG-GUID: gYnP_IoxA3uisTU5tvHJ0ssfbgObGVyC X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfX2QJ/bBMD4OeP TU/CErnV5oEbHoMu4pDZdctqduM55jNrWZW6bod1JFvjZY2x+yy60DpqVlRm6JyaYUD30no++3g Q+LNua9EbFEhCXAT9+Y5+EQ51+UN/6EaQxPIygI7lqJ7vhn252MS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_03,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 impostorscore=0 spamscore=0 suspectscore=0 clxscore=1011 priorityscore=1501 malwarescore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310060 Content-Type: text/plain; charset="utf-8" The ADE9078 is a polyphase energy metering device that is register compatible with the ADE9000. The main differences relevant to the driver are the absence of the on-chip dip/swell detection and slightly different full-scale ADC codes. Add a dedicated channel table that omits the swell/dip voltage events and a matching chip_info describing the ADE9078 full-scale codes. A separate RMS voltage channel macro variant is added that drops the swell/dip event spec so the ADE9078 channel table can omit those events. Signed-off-by: Antoniu Miclaus --- Changes in v2: - use a generic Kconfig title and list the supported parts. - duplicate the RMS voltage macro instead of a shared base macro. - drop the full-scale codes comment change and reword the commit message. drivers/iio/adc/Kconfig | 16 ++--- drivers/iio/adc/ade9000.c | 119 ++++++++++++++++++++++++++------------ 2 files changed, 90 insertions(+), 45 deletions(-) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 642c42b1fae7..daebffa93a83 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -573,20 +573,22 @@ config AD9467 called ad9467. =20 config ADE9000 - tristate "Analog Devices ADE9000 Multiphase Energy, and Power Quality Mon= itoring IC Driver" + tristate "Analog Devices Multiphase Energy and Power Quality Monitoring I= C Driver" depends on SPI select REGMAP_SPI select IIO_BUFFER select IIO_KFIFO_BUF help - Say yes here to build support for the Analog Devices ADE9000, - a highly accurate, multiphase energy and power quality monitoring - integrated circuit. + Say yes here to build support for the following Analog Devices + highly accurate, multiphase energy and power quality monitoring + integrated circuits: + - ADE9000 + - ADE9078 =20 - The device features high-precision analog-to-digital converters + The devices feature high-precision analog-to-digital converters and digital signal processing to compute RMS values, power factor, - frequency, and harmonic analysis. It supports SPI communication - and provides buffered data output through the IIO framework. + frequency, and harmonic analysis. They support SPI communication + and provide buffered data output through the IIO framework. =20 To compile this driver as a module, choose M here: the module will be called ade9000. diff --git a/drivers/iio/adc/ade9000.c b/drivers/iio/adc/ade9000.c index 030bb9109ab6..fd1362a98052 100644 --- a/drivers/iio/adc/ade9000.c +++ b/drivers/iio/adc/ade9000.c @@ -502,6 +502,7 @@ static const struct iio_chan_spec_ext_info ade9000_ext_= info[] =3D { .scan_index =3D -1 \ } =20 +/* With swell/dip (sag) events - ADE9000 only */ #define ADE9000_ALTVOLTAGE_RMS_CHANNEL(num) { \ .type =3D IIO_ALTVOLTAGE, \ .channel =3D num, \ @@ -517,6 +518,20 @@ static const struct iio_chan_spec_ext_info ade9000_ext= _info[] =3D { .scan_index =3D -1 \ } =20 +/* Without swell/dip events - parts lacking DIP_LVL/SWELL_LVL hardware */ +#define ADE9000_ALTVOLTAGE_RMS_CHANNEL_NO_EVENTS(num) { \ + .type =3D IIO_ALTVOLTAGE, \ + .channel =3D num, \ + .address =3D ADE9000_ADDR_ADJUST(ADE9000_REG_AVRMS, num), \ + .channel2 =3D IIO_MOD_RMS, \ + .modified =3D 1, \ + .indexed =3D 1, \ + .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | \ + BIT(IIO_CHAN_INFO_SCALE) | \ + BIT(IIO_CHAN_INFO_CALIBBIAS), \ + .scan_index =3D -1 \ +} + #define ADE9000_POWER_ACTIVE_CHANNEL(num) { \ .type =3D IIO_POWER, \ .channel =3D num, \ @@ -598,44 +613,61 @@ static const struct iio_chan_spec_ext_info ade9000_ex= t_info[] =3D { .scan_index =3D -1 \ } =20 -static const struct iio_chan_spec ade9000_channels[] =3D { - /* Phase A channels */ - ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_A_NR), - ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_A_NR), - ADE9000_ALTCURRENT_RMS_CHANNEL(ADE9000_PHASE_A_NR), - ADE9000_ALTVOLTAGE_RMS_CHANNEL(ADE9000_PHASE_A_NR), - ADE9000_POWER_ACTIVE_CHANNEL(ADE9000_PHASE_A_NR), - ADE9000_POWER_REACTIVE_CHANNEL(ADE9000_PHASE_A_NR), - ADE9000_POWER_APPARENT_CHANNEL(ADE9000_PHASE_A_NR), - ADE9000_ENERGY_ACTIVE_CHANNEL(ADE9000_PHASE_A_NR, ADE9000_REG_AWATTHR_LO), - ADE9000_ENERGY_APPARENT_CHANNEL(ADE9000_PHASE_A_NR, ADE9000_REG_AVAHR_LO), - ADE9000_ENERGY_REACTIVE_CHANNEL(ADE9000_PHASE_A_NR, ADE9000_REG_AFVARHR_L= O), - ADE9000_POWER_FACTOR_CHANNEL(ADE9000_PHASE_A_NR), - /* Phase B channels */ - ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_B_NR), - ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_B_NR), - ADE9000_ALTCURRENT_RMS_CHANNEL(ADE9000_PHASE_B_NR), - ADE9000_ALTVOLTAGE_RMS_CHANNEL(ADE9000_PHASE_B_NR), - ADE9000_POWER_ACTIVE_CHANNEL(ADE9000_PHASE_B_NR), - ADE9000_POWER_REACTIVE_CHANNEL(ADE9000_PHASE_B_NR), - ADE9000_POWER_APPARENT_CHANNEL(ADE9000_PHASE_B_NR), - ADE9000_ENERGY_ACTIVE_CHANNEL(ADE9000_PHASE_B_NR, ADE9000_REG_BWATTHR_LO), - ADE9000_ENERGY_APPARENT_CHANNEL(ADE9000_PHASE_B_NR, ADE9000_REG_BVAHR_LO), - ADE9000_ENERGY_REACTIVE_CHANNEL(ADE9000_PHASE_B_NR, ADE9000_REG_BFVARHR_L= O), - ADE9000_POWER_FACTOR_CHANNEL(ADE9000_PHASE_B_NR), - /* Phase C channels */ - ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_C_NR), - ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_C_NR), - ADE9000_ALTCURRENT_RMS_CHANNEL(ADE9000_PHASE_C_NR), - ADE9000_ALTVOLTAGE_RMS_CHANNEL(ADE9000_PHASE_C_NR), - ADE9000_POWER_ACTIVE_CHANNEL(ADE9000_PHASE_C_NR), - ADE9000_POWER_REACTIVE_CHANNEL(ADE9000_PHASE_C_NR), - ADE9000_POWER_APPARENT_CHANNEL(ADE9000_PHASE_C_NR), - ADE9000_ENERGY_ACTIVE_CHANNEL(ADE9000_PHASE_C_NR, ADE9000_REG_CWATTHR_LO), - ADE9000_ENERGY_APPARENT_CHANNEL(ADE9000_PHASE_C_NR, ADE9000_REG_CVAHR_LO), - ADE9000_ENERGY_REACTIVE_CHANNEL(ADE9000_PHASE_C_NR, ADE9000_REG_CFVARHR_L= O), - ADE9000_POWER_FACTOR_CHANNEL(ADE9000_PHASE_C_NR), -}; +/* + * Declare a full channel array. @altvoltage_rms picks the RMS voltage cha= nnel + * variant so parts without dip/swell hardware (e.g. ADE9078) omit those e= vents. + */ +#define ADE9000_DECLARE_CHANNELS(_name, altvoltage_rms) \ + static const struct iio_chan_spec _name[] =3D { \ + /* Phase A channels */ \ + ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_A_NR), \ + ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_A_NR), \ + ADE9000_ALTCURRENT_RMS_CHANNEL(ADE9000_PHASE_A_NR), \ + altvoltage_rms(ADE9000_PHASE_A_NR), \ + ADE9000_POWER_ACTIVE_CHANNEL(ADE9000_PHASE_A_NR), \ + ADE9000_POWER_REACTIVE_CHANNEL(ADE9000_PHASE_A_NR), \ + ADE9000_POWER_APPARENT_CHANNEL(ADE9000_PHASE_A_NR), \ + ADE9000_ENERGY_ACTIVE_CHANNEL(ADE9000_PHASE_A_NR, \ + ADE9000_REG_AWATTHR_LO), \ + ADE9000_ENERGY_APPARENT_CHANNEL(ADE9000_PHASE_A_NR, \ + ADE9000_REG_AVAHR_LO), \ + ADE9000_ENERGY_REACTIVE_CHANNEL(ADE9000_PHASE_A_NR, \ + ADE9000_REG_AFVARHR_LO), \ + ADE9000_POWER_FACTOR_CHANNEL(ADE9000_PHASE_A_NR), \ + /* Phase B channels */ \ + ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_B_NR), \ + ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_B_NR), \ + ADE9000_ALTCURRENT_RMS_CHANNEL(ADE9000_PHASE_B_NR), \ + altvoltage_rms(ADE9000_PHASE_B_NR), \ + ADE9000_POWER_ACTIVE_CHANNEL(ADE9000_PHASE_B_NR), \ + ADE9000_POWER_REACTIVE_CHANNEL(ADE9000_PHASE_B_NR), \ + ADE9000_POWER_APPARENT_CHANNEL(ADE9000_PHASE_B_NR), \ + ADE9000_ENERGY_ACTIVE_CHANNEL(ADE9000_PHASE_B_NR, \ + ADE9000_REG_BWATTHR_LO), \ + ADE9000_ENERGY_APPARENT_CHANNEL(ADE9000_PHASE_B_NR, \ + ADE9000_REG_BVAHR_LO), \ + ADE9000_ENERGY_REACTIVE_CHANNEL(ADE9000_PHASE_B_NR, \ + ADE9000_REG_BFVARHR_LO), \ + ADE9000_POWER_FACTOR_CHANNEL(ADE9000_PHASE_B_NR), \ + /* Phase C channels */ \ + ADE9000_CURRENT_CHANNEL(ADE9000_PHASE_C_NR), \ + ADE9000_VOLTAGE_CHANNEL(ADE9000_PHASE_C_NR), \ + ADE9000_ALTCURRENT_RMS_CHANNEL(ADE9000_PHASE_C_NR), \ + altvoltage_rms(ADE9000_PHASE_C_NR), \ + ADE9000_POWER_ACTIVE_CHANNEL(ADE9000_PHASE_C_NR), \ + ADE9000_POWER_REACTIVE_CHANNEL(ADE9000_PHASE_C_NR), \ + ADE9000_POWER_APPARENT_CHANNEL(ADE9000_PHASE_C_NR), \ + ADE9000_ENERGY_ACTIVE_CHANNEL(ADE9000_PHASE_C_NR, \ + ADE9000_REG_CWATTHR_LO), \ + ADE9000_ENERGY_APPARENT_CHANNEL(ADE9000_PHASE_C_NR, \ + ADE9000_REG_CVAHR_LO), \ + ADE9000_ENERGY_REACTIVE_CHANNEL(ADE9000_PHASE_C_NR, \ + ADE9000_REG_CFVARHR_LO), \ + ADE9000_POWER_FACTOR_CHANNEL(ADE9000_PHASE_C_NR), \ + } + +ADE9000_DECLARE_CHANNELS(ade9000_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL); +ADE9000_DECLARE_CHANNELS(ade9078_channels, ADE9000_ALTVOLTAGE_RMS_CHANNEL_= NO_EVENTS); =20 /* * Full-scale codes referred from the respective datasheets. These are the @@ -650,6 +682,15 @@ static const struct ade9000_chip_info ade9000_chip_inf= o =3D { .pcf_full_scale_codes =3D 74770000, }; =20 +static const struct ade9000_chip_info ade9078_chip_info =3D { + .name =3D "ade9078", + .channels =3D ade9078_channels, + .num_channels =3D ARRAY_SIZE(ade9078_channels), + .rms_full_scale_codes =3D 52866837, + .watt_full_scale_codes =3D 20823646, + .pcf_full_scale_codes =3D 74680000, +}; + static const struct reg_sequence ade9000_initialization_sequence[] =3D { { ADE9000_REG_PGA_GAIN, ADE9000_PGA_GAIN }, { ADE9000_REG_CONFIG0, ADE9000_CONFIG0 }, @@ -1800,12 +1841,14 @@ static int ade9000_probe(struct spi_device *spi) =20 static const struct spi_device_id ade9000_id[] =3D { { .name =3D "ade9000", .driver_data =3D (kernel_ulong_t)&ade9000_chip_inf= o }, + { .name =3D "ade9078", .driver_data =3D (kernel_ulong_t)&ade9078_chip_inf= o }, { } }; MODULE_DEVICE_TABLE(spi, ade9000_id); =20 static const struct of_device_id ade9000_of_match[] =3D { { .compatible =3D "adi,ade9000", .data =3D &ade9000_chip_info }, + { .compatible =3D "adi,ade9078", .data =3D &ade9078_chip_info }, { } }; MODULE_DEVICE_TABLE(of, ade9000_of_match); --=20 2.43.0 From nobody Fri Oct 2 13:07:19 2026 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 794193D6CD6; Fri, 31 Jul 2026 08:30:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486654; cv=none; b=tF1UwfsC1jIyxBLzDssLWV53iGJZz/80QTk6veGeb+lANnQSriKTRTiNE4gk1AuaZk1jkNVKm2FcfVZNHYjceXWErFOA8/P7zbLvA3B5V3C7hFrMwlgXcpRSwHB2qvgaPrgqXHYK7IDXNIaarM5F4ZOFBkiFhv0hEusJvLOF6dU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785486654; c=relaxed/simple; bh=6lO9MHfmRpa6O6qi7S/4noXoN2heQ3jAjAFZ6AumsiI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QfnjE24aHlHLTHwK1BdXHgN2Yqkllli6ghXQBc8zxNeYqeGCMsS9KR+pFsjjZlUJNLjPWctStjKX+kbepxL6g8gYg+y2neB7PEpnMP0Zo8gCtcB8bf6OxZM1bVyPdbX5KJH7VuTR+yGNsASAuko7jDGZ/PzylWlyynLfPtPMZE0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=N5juf2XL; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="N5juf2XL" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66V7wtAC2639205; Fri, 31 Jul 2026 04:30:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=ZsfgY +t0vDVH7QvQ4Go+4FMxhU52/s+h1whAHFcJC7A=; b=N5juf2XLbVBEhde/j1SGy OgYNo4++0zmLi0h45T5fx77gzouU3nVhJJYorLYD1h3yeVxdP/QnAUvZJmA/xorW vVl3Yk1XfrTXJvJL6TMDUbU13PzTF3zFi1R8TV5WV6qxIsEyjryz8GQKUnwqDX1I 3wuFarcvewHIo/k1iKjBKa6EPQ2a09LQ/4R8g0nz2CmYPHMqpxukWQNDtQlRzl/S 1Li/NQGhxWs8Ya4vmp917xKNqcBWZ/JDY080DrRbYqStQUF99l3/UqOiqOuNtSkf tInCagAHaA/lzHHEGZnxEWg1rCpSS+B/Uzy/uuyzybmwcSUGX69M7QAELRWYtpiF g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 4fr4s2ms10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2026 04:30:44 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 66V8UhdC039912 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 31 Jul 2026 04:30:43 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Fri, 31 Jul 2026 04:30:42 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.37; Fri, 31 Jul 2026 04:30:42 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.37 via Frontend Transport; Fri, 31 Jul 2026 04:30:41 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.148]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66V8UDNA026738; Fri, 31 Jul 2026 04:30:36 -0400 From: Antoniu Miclaus To: Antoniu Miclaus , =?UTF-8?q?Nuno=20S=C3=A1?= , Michael Hennerich , Jonathan Cameron , David Lechner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , "Shuah Khan" , Radu Sabau , "Marcelo Schmitt" , Jorge Marques , Salih Erim , Matti Vaittinen , Jishnu Prakash , , , , , Subject: [PATCH v2 4/4] docs: iio: ade9000: document ADE9078 support Date: Fri, 31 Jul 2026 11:29:50 +0300 Message-ID: <20260731082951.1228-5-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260731082951.1228-1-antoniu.miclaus@analog.com> References: <20260731082951.1228-1-antoniu.miclaus@analog.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: Hyb2w8owQrDQGXpopuN2lJZW3HTLNUMB X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfXyJMmPXZ+A8JK yfqxoPY6EzsK+T151iUv7ljyWzeic4o9BR7PcagWMGt9fDjrnzZCkhPYJ91xHIr6yqO91L6kE2t Y891d6MEzGrRsIcdhwSDQkhBik/+Irtw4N/BDjTu3OP2nogROMih X-Proofpoint-GUID: Hyb2w8owQrDQGXpopuN2lJZW3HTLNUMB X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMxMDA2MCBTYWx0ZWRfX03/g5QTLgRRF /8pi6oKRddBbFPAS7gROrtjtScXBFTepK3qQzDYpnHPRsS9+En72uKaTGzIos7FyLbsbyTJt+rc oe/gVPuRZNTcxRCydrLvHtuN7DDlVr+bxw7KZLJEsxGfncZXCGYoa9LrvajQRSVDxNNweOoJuqE QT7tFkCLC+TYXH3ps5xCoFWj8RvNKAoXu11m7R2HQq8dU7/0MkFyacIzg76yHVFBwJf+m82TrhK Ch2TpOrZLj3Safc6YEKeRk2TVfOhLNReESP9Wsc7TWqhY8ximGKkYGUvByhNSnvCPRcwM1fF/IP 34pgXoJYc48Azg/87D7f3SJEzYJH0EVvvTDGYBhHt6j5NvbSQE8lkltf9U7rH3MQAlgl2bomFYb wUAGjjCcWF7X/6Hk5kunUwJnCNijU7/MtECIP9MeEY03HsOD2UDF6iw0vp5yOFBgl5JgDIqjx6G fyqnnUL46C8GUVBvzOA== X-Authority-Analysis: v=2.4 cv=PqOjqQM3 c=1 sm=1 tr=0 ts=6a6c5d34 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=N--XFCr6TIEc_64PeIT2:22 a=gAnH3GRIAAAA:8 a=dVqSPRu-xMqTFQGYfZQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_03,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 malwarescore=0 clxscore=1015 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607310060 Add the ADE9078 to the list of supported devices and note that the dip/swell voltage events are only available on the ADE9000. Signed-off-by: Antoniu Miclaus --- no changes in v2. Documentation/iio/ade9000.rst | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Documentation/iio/ade9000.rst b/Documentation/iio/ade9000.rst index c9ff702a4251..72737b5ec59c 100644 --- a/Documentation/iio/ade9000.rst +++ b/Documentation/iio/ade9000.rst @@ -1,24 +1,30 @@ .. SPDX-License-Identifier: GPL-2.0 =20 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -ADE9000 driver -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +ADE9000/ADE9078 driver +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -This driver supports Analog Device's ADE9000 energy measurement IC on SPI = bus. +This driver supports Analog Device's ADE9000 and ADE9078 energy measurement +ICs on SPI bus. =20 1. Supported devices =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 * `ADE9000 `_ - -The ADE9000 is a highly accurate, fully integrated, multiphase energy and = power -quality monitoring device. Superior analog performance and a digital signal -processing (DSP) core enable accurate energy monitoring over a wide dynamic -range. An integrated high end reference ensures low drift over temperature -with a combined drift of less than =C2=B125 ppm/=C2=B0C maximum for the en= tire channel -including a programmable gain amplifier (PGA) and an analog-to-digital +* `ADE9078 `_ + +The ADE9000 and ADE9078 are highly accurate, fully integrated, multiphase = energy +and power quality monitoring devices. Superior analog performance and a di= gital +signal processing (DSP) core enable accurate energy monitoring over a wide +dynamic range. An integrated high end reference ensures low drift over +temperature with a combined drift of less than =C2=B125 ppm/=C2=B0C maximu= m for the entire +channel including a programmable gain amplifier (PGA) and an analog-to-dig= ital converter (ADC). =20 +The ADE9078 does not provide the on-chip dip/swell (sag) detection availab= le on +the ADE9000, so the RMS voltage swell/dip events described below are only +available on the ADE9000. + 2. Device attributes =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.43.0