From nobody Sat Jul 25 02:41:18 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 605353F20E9; Mon, 20 Jul 2026 11:08:45 +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=1784545727; cv=none; b=YGN3BT8jOHE8j4zAGc5smZVzlNtstiVQqnVPtsb1YhJYr8COpIAP+R9i/R7OrStBkeGkwCZl2F5zkHrjksY+rD8RGq+7zqOplLV59cONWDPzdVi4I8Jjf+5y5XcfPV3YBJIBQf+MeQ1SVuW2WbT6ixIDLigZNydnkkkbykspKTA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784545727; c=relaxed/simple; bh=uT/zc99mVf3s7Hmj8rwxs4ZijjtL2jLkEAf16R9LFvg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VPTWIPIcV9ObpQGDYjRva+tC3L+kG6TYmuOK6vZ0BHmQFi73G/dWjwWUFhcEHX3iyzWjcq1FBcclf0U4FPm/KC9JKOBMUUL3qD8h6A1FQ6Ou0gZscJ/1/e+R+V15pKvjYsakhnaxwkVlOK7eTSXeqBWT2o2XX/UX9U3kK8zb3wc= 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=cw0oGM9Q; 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="cw0oGM9Q" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66KAxiPI1900811; Mon, 20 Jul 2026 07:08:40 -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=TM++2 /VR0NEPFrGX0br9YVMBKHflkZsoAgOwD7Eph74=; b=cw0oGM9Q8yIwMuHyl3USZ 71S8q0PaQnrMzfSZ8OiwjjoAa5InmsN8g8gsM+jtRhav003rY0VbPnyPZJyGX58D bL6f60lSlKHmFzU1OePEbXz3t+1okHox9sYv8LXXIgUrabfZ+lbcLd/na+4jfyP8 jTsYz68ng1zqrc5xWl3chH6z1gMn8UmF4cEalC+Qd+cemQtGFrodvan/uK3j4q6P 1TYgDPUYEcgVQeem9eH/40KswTgfjoWIfmlTioI8qo3TNTbLJ0kCtg/fGRXqtcQg xZ8YxpumAZzJtbeN0iBej7eutRI6JqCHkC0RKZ8v6c7gl6dQG8ImeaKGyRsMOcvN A== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4fg3axxmdq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2026 07:08:39 -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 66KB8cKv062894 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 20 Jul 2026 07:08:38 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) 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; Mon, 20 Jul 2026 07:08:38 -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; Mon, 20 Jul 2026 07:08:38 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.186]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66KB8HRI024360; Mon, 20 Jul 2026 07:08:29 -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 , Marcelo Schmitt , Radu Sabau , Jorge Marques , Matti Vaittinen , Jonathan Santos , Jishnu Prakash , , , , , Subject: [PATCH 1/4] iio: adc: ade9000: introduce chip_info structure Date: Mon, 20 Jul 2026 14:07:44 +0300 Message-ID: <20260720110754.7674-2-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260720110754.7674-1-antoniu.miclaus@analog.com> References: <20260720110754.7674-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-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfX50OpuXYeTP4Q K4zhoY/EaP/G8mZkALGCqRmZO1sT8GcaFq/4cKXVKreP1sCQOKNo7op5JnpVU8pVCLpqkZvJgYo PpvExbzXH2/T8Bz+cVEtqo0+80tIa9meJXlMVjn6IGzM1oaAnok0pAvDtjQ6GJ1sTk4XRTkQ3s/ m5QQcJdwH0VmR54fc74PmAeyXrLnVHM2o6j4FNKRxBuo8GOHXHcfulM/xDQVvu5cJD+wlwWN+VW XntMWt0KMjc09+wUOelO3cSkhcarlZOp/BOhOIUa4vfnKTb4vqZhzLA5BkqKp6qJffNddgoMP2W 5OBafC0zFdvAAMGO3W0ALXyyE4t+hJWV36aQQKnd1BEXkzf3GcQD5uCZCsKnKKjnb7XIPx+kcVC 4QN4AqvvtVJYPOFDyJsnBmzbzBiqHOtLUy6pjbooTV5kmSX43fKRVY1j6gFjK2RwCdNfZp4ooTJ Y6f1LFpQH7ZqksUQkhQ== X-Authority-Analysis: v=2.4 cv=evjvCIpX c=1 sm=1 tr=0 ts=6a5e01b7 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=uXIjobp8t2wMuQ0fPvqm:22 a=gAnH3GRIAAAA:8 a=Zyf-6xheGXU4bo_EAj4A:9 X-Proofpoint-GUID: GK8RpXk1XaxdAtnUJFQkucEP_Y0Qmv03 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfX7IJBeO6M6dTh fo+za/yQvdW1kxMQ+nHwC+CDtD8UMV78GIiP+DPAM5xVkRvQbyscsXSSR+hvREfWGULDmKE28rM u9wRw5tME89JJKBVlDcRTYdtg1+txYMH0EaMD4Y172M+33Dg6S3k X-Proofpoint-ORIG-GUID: GK8RpXk1XaxdAtnUJFQkucEP_Y0Qmv03 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-20_02,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1011 malwarescore=0 adultscore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200124 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 --- 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 b80cdd8ad982..38a5c7e043b3 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 datasheet. These are the digital cod= es + * 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 Sat Jul 25 02:41:18 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 9C22B3F1ADF; Mon, 20 Jul 2026 11:08:46 +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=1784545728; cv=none; b=tRK9x3hupaIbJldLouDy245Dcipm4l0rYJsNd1FJPH1TyYuVR7n07UkaS6vmPLrSrgsx4HwdnoeScqThZZPVsiNsu0VVTdPbG1uutTiIY7s48LcDsF55JK7asyaLOIlfQaJ1QsacgNE6Wn0KvjRGekn9qdtkxmVliBoclQzLSFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784545728; c=relaxed/simple; bh=v1sCRWM9xMdaxe4qPggvFj4kJMWlYs0TapUVjV+VZFU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Sb4c9t3sqDUFYYhb9vibmf1LFCKBWZGCA/q4aQSKCqlYY58qtILmkbi1a/UGWn1K0die9uKGj9V0xkO8KehTPUJDFHI6oBA5AyJexlfbFys51gbjiPMzikf/7uQNe9lmgnCUZJ1/bGX/jBe5CmcuRZ1X3iuHBZ0YjPfrcBNXkDU= 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=q6Im3MaD; 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="q6Im3MaD" 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 66KB0TAW1666664; Mon, 20 Jul 2026 07:08: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=QvoP+ d++6POfSEeQbspRUUqnawBPutV4uvkkFraJnCk=; b=q6Im3MaDC/HCn/Vg/uHsB NF25++jY6QlmteZt0j12Lvu+tPNH3/NbGO6BgBrKYWuKgpML1oPIpT1VS+j2svFy 9yMAPVwVPMuMFDojKva3WVdkeKaQb8gCBoEKK5iD4TckH04IkaU3tP/aw0Ef1VYb PTTfc/DLxux3cUU+HeFz0oB2Qt8V96XUFB4DIRpaXGa7iFHv2PO0KolGycA0vfX/ /Tx7PRRQpKDxb07ZKHxKGOchvfgZZxf8rklWYhezNG6Tr/sMKjjX8qMk1nJ+M1lh DxRqFcvtoypfTmP60wkzePBPjXfcWNyrEAy2o2YjKz8RvBwp+xGQOUkXNd6Pq5fX Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4fg6d1e9b0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2026 07:08: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 66KB8dXA062900 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 20 Jul 2026 07:08: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; Mon, 20 Jul 2026 07:08: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; Mon, 20 Jul 2026 07:08:39 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.186]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66KB8HRJ024360; Mon, 20 Jul 2026 07:08:32 -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 , Marcelo Schmitt , Radu Sabau , Jorge Marques , Matti Vaittinen , Jonathan Santos , Jishnu Prakash , , , , , Subject: [PATCH 2/4] dt-bindings: iio: adc: adi,ade9000: add adi,ade9078 compatible Date: Mon, 20 Jul 2026 14:07:45 +0300 Message-ID: <20260720110754.7674-3-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260720110754.7674-1-antoniu.miclaus@analog.com> References: <20260720110754.7674-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-Authority-Analysis: v=2.4 cv=ds/rzVg4 c=1 sm=1 tr=0 ts=6a5e01b8 cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=0sLvza09kfJOxVLZPwjg:22 a=Z0pTeXoby7EwIRygza74:22 a=gEfo2CItAAAA:8 a=gAnH3GRIAAAA:8 a=0G5oFKN4N_cOIownKFoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=sptkURWiP4Gy88Gu7hUp:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfX/6C+xId1XTo0 nBaz6AvDMBdjukgKBiHYpfYHOUDnaBLm+UgSDABLMVe1dt2eGP4QVY6pDOTH3Iqyk1rkHfzSrCn R4PdA11hrVOwZOsXJ323HMuFNJzGTo2z23HqrLRcOorrDVtDIz7G X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfXxaQf0Edx3IHQ 4Pq4FibbRom/tifDyjEF5SDvci58rddNip8x4m/a+ptw+Pk8Cotiefmn4yW+La5a/fKdJ4O0yMy xu56u0v8VPiqVVZ0EZ8ubiaLVHFwwaV3PldtFl34+td2V7Ga7Oo8W281UGrTyFAhblLP1uP/JiJ CKN6DGtQIdeHxk1tkfIX9Mz0Jdjkloj1kJn868keUNwwuN6FXWotaRvRTHi6av8MygeI/yIstYY h5QKiaN60Ha1bm+2q+ezcw2Nesqh9adToESbD37HUE91IiLLTKVvj+8bjUasKuluNiQAFbh9Uir dwwjXVzM9uRtCKZyVqVDIvnqHKDmNDAhAwepcfADvmK4FsMKPZ/XvavpyWiOsRuK3l9acW1g9yh CYU9+bM6IbSFqACqIYfRnEi43v0w8W6ZZda+yXNLdECXiweBs6/tkwfoVOqnHhakxvYFp3NpPZZ vSKhHNplRBTEh3tPKMQ== X-Proofpoint-GUID: 5cQMAQByALub4IkH53X0b7W80dk0UdxQ X-Proofpoint-ORIG-GUID: 5cQMAQByALub4IkH53X0b7W80dk0UdxQ 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-20_02,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 malwarescore=0 clxscore=1011 spamscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200124 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 --- .../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 Sat Jul 25 02:41:18 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 764BE3F23C2; Mon, 20 Jul 2026 11:08: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=1784545734; cv=none; b=NpHz1wLT5EgjeXXGZqFvyonTEoJNY2Lbl1vvC7TRdwcr0nIt8ALNA5XRQNheG5B9MN0Q1d5RkcpsROwkIU9ZZy995fwfedcf2DRhuWahbL1ZPhZqeLFH46117Z0SLzzD4WC48LHEIklyUBgB9W7v0nJ1AGtUGhyq5o6mmj+yV/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784545734; c=relaxed/simple; bh=Bd0qTMCXEkBOff1wTYgGYCASTpFouChBbH8c8NsXXZI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Pl3ojOWm58LyRkaT78WHO7+wwo4S9ylC2lgDIfDW9cfm/Hg5gVVfzeNpZvPHvPFq/GLMusqkCO2TfdPfTEa3ufQdzyAjH9OUdd57v9Ox6JPR3PY2X6HL5Of6WDghi7hQQpKnP4s/Uz4+xnso75OchtaVcg3RFl9S2rp/fmW4FtY= 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=1IhqIWF4; 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="1IhqIWF4" 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 66KB0Reg1666543; Mon, 20 Jul 2026 07:08:46 -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=i/bH/ YoroegUuRyJZXyfiQjCt9c+sT8fUTx6rjDyRqg=; b=1IhqIWF4CBKsatuTCR57/ qMkUWrtObP4vh0yErs715nX3O92yYhaKEkv10JkM9PhVLTo1dsOkNyid3mG7FgGO ULGN0OioAHswpQvdAAB3/5txtRlglcWatQno8nw/WmZAZoYZHgxaSPlgGwDJS98a 14wt9xLEMZ0CwpeyTS2AQgKcmNPYCA+HIqXEGGrFFMJAY//Ign3Sk+YQB1Eb4d93 0oH82AVFYO6XD6t2mFJZ9hjkkdal6a4K9JbrG9gCIKRIYA/kDwFJcgpNRe8YVnez xY+cbq9sd3oNz2oSqut9QM+X1nO9FMelrlUwlnV4mSMD0ktyxUSrvM8OaesvpTiw Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4fg6d1e9b4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2026 07:08:45 -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 66KB8i9Q062906 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 20 Jul 2026 07:08:44 -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; Mon, 20 Jul 2026 07:08:44 -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; Mon, 20 Jul 2026 07:08:44 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.186]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66KB8HRK024360; Mon, 20 Jul 2026 07:08:35 -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 , Marcelo Schmitt , Radu Sabau , Jorge Marques , Matti Vaittinen , Jonathan Santos , Jishnu Prakash , , , , , Subject: [PATCH 3/4] iio: adc: ade9000: add support for ADE9078 Date: Mon, 20 Jul 2026 14:07:46 +0300 Message-ID: <20260720110754.7674-4-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260720110754.7674-1-antoniu.miclaus@analog.com> References: <20260720110754.7674-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=ds/rzVg4 c=1 sm=1 tr=0 ts=6a5e01bd 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=aCWRDxNZ2XHDlcVCpRwA:9 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfX9S/2d0skrW7W XR6dGXDORnTFRFp65tP7DRUed71UQlV35CNHfNxEm7GDQ2616raUZzOlKFk5S1hvJmH+woOnb85 3Lc1BlnhHWK6oa9o6sJlWc+fPEiTcJGcKW00Typ87racyZHgjeOi X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfX8jkkc5eE2q59 h+pHFI1VqQPvZbjAYny3D4X7gWd2eRn4h4WK9uo0JFbufhQa4wlRlf8oXDPJy9f5AtCzMp5cO5Q 2HeqMs/E3xS3SPYTzEBPWf83VqZZawk0PUMzFv3cyPho3RZbWNsFRApR/dOUXmra690ClE6sVuO 0xDQiXeWBZoVCIpreAjyslpyXGxrSZgpoRuM8LShaKxifB2jmJb2x/x0TFLrQ6NSjA2KVvIIJeB flW0wRc1oBUkb7xqo82SjuK8sW6JPLK3+Klk+oJ/W2lL0eEKepkSqyqlLc3jDqNKlPmd76jdoac wX7W20UZPdRYZ1a5i02j9KR7oa3pld+sK52a53ZvtKbxrg/LVPxWoAstCd/v0wiI+rnkuFsP31l 5/hslH+YMcZIu/3E1/hVFk8SDS+26sJOqHZ62nxi/NB/epQDeuEzJQo4ekz5CmqqcNJfTqh+3c5 Ls0L1QvX6qHunoDDB4g== X-Proofpoint-GUID: o7vtFxIT9WnGLPO4K49hz7j4SCCHb07z X-Proofpoint-ORIG-GUID: o7vtFxIT9WnGLPO4K49hz7j4SCCHb07z 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-20_02,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 adultscore=0 malwarescore=0 clxscore=1015 spamscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200124 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. The RMS voltage channel macro is split into a shared base and two variants so the event-less table can reuse the common definition. Signed-off-by: Antoniu Miclaus --- drivers/iio/adc/Kconfig | 14 ++--- drivers/iio/adc/ade9000.c | 121 +++++++++++++++++++++++++------------- 2 files changed, 86 insertions(+), 49 deletions(-) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index d1b198cb8a80..33f2c281b1aa 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -573,20 +573,20 @@ config AD9467 called ad9467. =20 config ADE9000 - tristate "Analog Devices ADE9000 Multiphase Energy, and Power Quality Mon= itoring IC Driver" + tristate "Analog Devices ADE9000/ADE9078 Multiphase Energy, and Power Qua= lity Monitoring IC 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 Analog Devices ADE9000 and + ADE9078, highly accurate, multiphase energy and power quality + monitoring integrated circuits. =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 38a5c7e043b3..0de55b7ad1ea 100644 --- a/drivers/iio/adc/ade9000.c +++ b/drivers/iio/adc/ade9000.c @@ -502,7 +502,7 @@ static const struct iio_chan_spec_ext_info ade9000_ext_= info[] =3D { .scan_index =3D -1 \ } =20 -#define ADE9000_ALTVOLTAGE_RMS_CHANNEL(num) { \ +#define ADE9000_ALTVOLTAGE_RMS_CHANNEL_BASE(num) \ .type =3D IIO_ALTVOLTAGE, \ .channel =3D num, \ .address =3D ADE9000_ADDR_ADJUST(ADE9000_REG_AVRMS, num), \ @@ -512,9 +512,18 @@ static const struct iio_chan_spec_ext_info ade9000_ext= _info[] =3D { .info_mask_separate =3D BIT(IIO_CHAN_INFO_RAW) | \ BIT(IIO_CHAN_INFO_SCALE) | \ BIT(IIO_CHAN_INFO_CALIBBIAS), \ + .scan_index =3D -1 + +/* With swell/dip (sag) events - ADE9000 only */ +#define ADE9000_ALTVOLTAGE_RMS_CHANNEL(num) { \ + ADE9000_ALTVOLTAGE_RMS_CHANNEL_BASE(num), \ .event_spec =3D ade9000_rms_voltage_events, \ .num_event_specs =3D ARRAY_SIZE(ade9000_rms_voltage_events), \ - .scan_index =3D -1 \ +} + +/* Without swell/dip events - parts lacking DIP_LVL/SWELL_LVL hardware */ +#define ADE9000_ALTVOLTAGE_RMS_CHANNEL_NO_EVENTS(num) { \ + ADE9000_ALTVOLTAGE_RMS_CHANNEL_BASE(num), \ } =20 #define ADE9000_POWER_ACTIVE_CHANNEL(num) { \ @@ -598,48 +607,65 @@ 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 datasheet. These are the digital cod= es - * produced when the ADC inputs are at full scale. + * 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", @@ -650,6 +676,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 +1835,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 Sat Jul 25 02:41:18 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 E181C3F44D3; Mon, 20 Jul 2026 11:08: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=1784545736; cv=none; b=gfPANtxBVzE3k4+m8mEHHGnycliNlUvTjQ8BxGDvF+Bt42JyeaLJjc9Wi/inCbrZmYHorvK3uNjIHHfzy3amNR39EDHD05do3iQDJYngsSF1RzCfT+VwfLasjr0mHedBDRaF+w3I8zUsWc3GXbRj2AFL9AWRbHk7JfnpGLxxq1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784545736; c=relaxed/simple; bh=hWFe0ecnQcUQSMIYZD+mzmuzSF2Cw8zD7HT3rsKQcXU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bzs8hvtjLMAlTevO/Gk8PQwCu36tYiWkrc0iLalc44NoxhRdxGigcx3IcQCkxp732WWARNSzb1lVBLUq8mfVvJO86L/5o7AhSR9JNz8gNvIpd0PxrWCDZ/p71byTzme1HA+twQz9/rxL/jB9kQwmcqkCA/ZNaIQX9Rg58JTfpQM= 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=LIpkVI8F; 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="LIpkVI8F" 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 66KB037Y1779716; Mon, 20 Jul 2026 07:08:48 -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=qdPT8 ZxebWPScerPBsarwdPl2SnE05MlhbpNzsiEUB4=; b=LIpkVI8F/RGzui6vDROr9 8nFfNpPFrOBO3ZIc821KaaUXh3Mop+fk8J/4JQcwOroAc51ieHLeWBUmDb6Fyrd9 yolXOFnvJ1rdW5kDfwlqZSdxvd33j3GDtxS6SYQ0IOFt9SYvyBoOiRTHLlKWxA1M 4fT8GSBWD5BXfyaIj7/T6DjwimaTbJqxBIGBbOnYJVq8rFUgLuQUY6RtwLfztpOZ yfm0yu6XIAFcGb95215KnsFD4jFDiUXpBWEKvQXR9UXF6uC2WV0YKQU7V5xHZ3uG ksgV9OUNR4HWwrm/OwkxdmGMsTjIZJhrYDPSBC4jHA71oLqTlBXh2ZSQ0SNFoveM g== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 4fgttgbrsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Jul 2026 07:08:48 -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 66KB8lgd062909 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 20 Jul 2026 07:08:47 -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; Mon, 20 Jul 2026 07:08:47 -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; Mon, 20 Jul 2026 07:08:47 -0400 Received: from HYB-b1tGeUj4GP1.ad.analog.com (HYB-b1tGeUj4GP1.ad.analog.com [10.48.65.186]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 66KB8HRL024360; Mon, 20 Jul 2026 07:08:38 -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 , Marcelo Schmitt , Radu Sabau , Jorge Marques , Matti Vaittinen , Jonathan Santos , Jishnu Prakash , , , , , Subject: [PATCH 4/4] docs: iio: ade9000: document ADE9078 support Date: Mon, 20 Jul 2026 14:07:47 +0300 Message-ID: <20260720110754.7674-5-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260720110754.7674-1-antoniu.miclaus@analog.com> References: <20260720110754.7674-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: OduvDxZK793egffVO1Cc0si5fjo4khDi X-Authority-Analysis: v=2.4 cv=DagnbPtW c=1 sm=1 tr=0 ts=6a5e01c0 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=gAnH3GRIAAAA:8 a=dVqSPRu-xMqTFQGYfZQA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfX0+lr27AQn7g7 novLIl9Ry0bMJZMVOOJ3Q50mmAjKPGxgMgQc4Mnz7HBtnPv/w6ECXlAjQ6Z02wBihV3BBcuHPe1 jte+GC80DWnlVo2tU5gh7990whcg7qLhq/0CHPUyQEY7P5dImtBw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDEyNCBTYWx0ZWRfX5Ze2mEmHU3My 1l2mYmV2Lvx2eeswhefPHua1bsCJZTOrRsLVVSM9eXLcqoXsytKNf/9J+aBnDJK8DFJAF70o1y5 nQGzhMtCgev1+xAjaBVgFzA7Uw/hXJjQ7OP/80w8tmXMafZ0DQagh87t/wynzfORdX7tWHpSImP QUPNR7AAZnJiFLi7kqfUp/Vaby1S7+IEv7BYiBhWISS7i6UYpd+m4J6QSz1oprMPl7QXqeABlFF pWZsA4N/TqTlN0KE40sx+gQPCY7etvJGax3+EkrSTYn4GOsDXclnHoCiHsxybnJ2RcKx/DvUK6j WuC8g1OKrdfXL11L1cZ4y7uEtYfffXm6h4R/Vmf/yfP61/qY+nM5ydY/5doDd6lDiYYOHWDE0Ar mIzX5jOVv/t6LT62a178vzqQJlJFJMUFnG9w7PshChTUjgqXdu6IbIhx+TLEzS69e9PxLPyjBx6 BkPuOPTJbrWG3ns4Wlw== X-Proofpoint-GUID: OduvDxZK793egffVO1Cc0si5fjo4khDi 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-20_02,2026-07-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 clxscore=1015 suspectscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200124 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 --- 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