From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AEB552F9D98; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; cv=none; b=coFGoG4y5GYcNzyX8JG4uvdPD8F6HOKPSXqqtIO01UaqGpg2dXuB62Lh3oe4aum3mVFC2waggWf819oWxfXIKsdcnZH5vBUCeev+c3duoA94565gl5bP1OAvYsN8rGStGzq3MfRKyl7ffig4uh2W37CF3U4R8/PrXuZtZH1CWsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; c=relaxed/simple; bh=o3bvt5IVoPOuC7CuBgSGeBwzgK4Z/m9v9mxJ/tknRCE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gJezt62EvNGgusKUu9d95ioLFugt9PELzt/hkKiJ+7QHsiGx3jd1qctnURTCpSo20og2qAgReDuCxmuUyakEtZNzkCxVMMmni97BNdWBlL+RQwhZ1Bb9whf8tYAb3ui/+3P1QvmRHLBTWNaYwmQ4qmXtaakVl418mj24q5riUuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t6J34qRc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t6J34qRc" Received: by smtp.kernel.org (Postfix) with ESMTPS id 68A09C2BC87; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=o3bvt5IVoPOuC7CuBgSGeBwzgK4Z/m9v9mxJ/tknRCE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=t6J34qRcpBoXPEFWMMztTMNULhb5CXeq1toeDHqG1yhatUegCLYJmwkVP0rJ9BzV0 dIvzSMV6yM7hOUsEOY1WiwNLVD1YUSrzxIVEd/UviSgdb4rCK60ncdMraOIfb8wtEm Qk9oTI/b+Y/ISVEuIpt4mHvOKlhWFKKsZaedKBBwL6XBSRf7MqKB8EuDR2t/Ie3uv9 K4PW7lieD5WHUR0DD27FlrBth/t03iDoXi/VtUZfTP2r/1nKLVzgPLfagCgzVSF1Sm cRz9y8rS/fsViqf+rhzjCCq6xs/J86VM9pcvEAm+xH26iVqhAfnUchF+skFXBnBdNQ C1eSyqBmDzNsw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 498FCEB2705; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:01 +0000 Subject: [PATCH v4 01/11] MAINTAINERS: Add missing maintainer entry for AD8366 driver 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 Message-Id: <20260210-iio-ad8366-update-v4-1-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=890; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=IB6nsbVkeaHwQfGZNvFxArIH7f6StXcyc8CEVB24Hfs=; b=4zQ52Qt/ZsCCtthuGrEUHbTy9pNbDTdV69F3DXElL6m8vgEeR7ZSwzn44qomDZapTP2Je1J3x VHTeXFuHlJzBjw5H3GOu0+LLg7PL8SkOFSbm023/VESjxamPfXXlnaH X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Add maintainers entry for drivers/iio/amplifiers/ad8366.c Signed-off-by: Rodrigo Alencar --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1251965d70bd..ec9a6beb7619 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1583,6 +1583,14 @@ W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/adc/adi,ad7780.yaml F: drivers/iio/adc/ad7780.c =20 +ANALOG DEVICES INC AD8366 DRIVER +M: Michael Hennerich +M: Rodrigo Alencar +L: linux-iio@vger.kernel.org +S: Supported +W: https://ez.analog.com/linux-software-drivers +F: drivers/iio/amplifiers/ad8366.c + ANALOG DEVICES INC AD9467 DRIVER M: Michael Hennerich M: Nuno Sa --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AEADC265629; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; cv=none; b=tcB4ukhP58e8T5XW56eSj3yhnuU2cGfwCYMTxpG9MhqEiHnTkvucKJY9koDtBeXK3Zyg6JNcezLMa5CU5DoicEjkSMa2LUpun3JU1RuxHwHEPSwNLMWGUb292HDhmiyG48f+6fGe5Ynck3yrRGdQy88NVxyPYFdG0+prH7bl0Ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; c=relaxed/simple; bh=EZj9PEqcMRD9AXu6Ji7mgkwC/I81mfpx66mtqOW1pvk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Yx0X93rSzQAEeQWjgMtQ8QG6LzFmFMNa4MUKHPV9l4mgmFpSL/FSxremX8Z66HqAU3/canNjGrQ+3yc2mV5/D3tysymsY7h9ehLQpQvEsOHR0LwgnWWs7zZsDqKD3kWvTpAW7CG+5xcmY9Nh0QahRqXRAEdFmW0KKGRfbmGh4OY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=avHwAUvn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="avHwAUvn" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6CB38C19421; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=EZj9PEqcMRD9AXu6Ji7mgkwC/I81mfpx66mtqOW1pvk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=avHwAUvnUEADtqoIGuPqT7X2roc1IskYrncmhwrgzmemz1YiG9QWD0dVjUdad9WJd uL3XTav9Kvl/ARvg2rX4KcLkTv3jIZGaESlL8/3yKLf+98U3UvJ7UTt0zfIhXcMq62 nCK0n5uCLDXX6eXGkmu0yQ+kFsCRW4d43WDON55M52JXHuAB+hog8U//+C4bThH3Wu Pl3PyHKfVf/wJ3Ioex7IgQ0ZcE4FQXBwLaR2RJICA/2TVkBkbqDVP0GEkWrm2eFOB6 8KLT2KLXuGiq3KCAsxu/R8R+ZFjCHMz3udIAwIJ/50AaLJG0YjBlmhE9lz7nCdKapr JqcB5CkF20iwA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DCACEB2700; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:02 +0000 Subject: [PATCH v4 02/11] dt-bindings: iio: amplifiers: Add AD8366 support 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 Message-Id: <20260210-iio-ad8366-update-v4-2-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar , Conor Dooley X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=3583; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=UNy0X4JXjvK2gtiyKRQ2Bqv9CAzSNJz7qZQMTmwPQ1I=; b=0CScqTAdlc9XPijRgNbYQkEpTR+kJFQW+P5n9O7lSps+Y0ltVizkHNygYTaLUzG0HpEb8ws+H BZRIMCalSUfCw0xZ0BOD87aWphNXuxVlln/2u8VIkIPZlrexMLwFMf/ X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Add device tree binding documentation for amplifiers and digital attenuators. This covers different device variants with similar SPI control. Each device has its own gain range and step, hence no fallback compatibles are used. Reviewed-by: Conor Dooley Signed-off-by: Rodrigo Alencar --- .../bindings/iio/amplifiers/adi,ad8366.yaml | 97 ++++++++++++++++++= ++++ MAINTAINERS | 1 + 2 files changed, 98 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.ya= ml b/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml new file mode 100644 index 000000000000..2719de1166a1 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml @@ -0,0 +1,97 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/amplifiers/adi,ad8366.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AD8366 and similar Gain Amplifiers and Digital Attenuators + +maintainers: + - Michael Hennerich + - Rodrigo Alencar + +description: + Digital Variable Gain Amplifiers (VGAs) and Digital Attenuators with + SPI interface. + +properties: + compatible: + enum: + - adi,ad8366 + - adi,ada4961 + - adi,adl5240 + - adi,adrf5720 + - adi,adrf5730 + - adi,adrf5731 + - adi,hmc271a + - adi,hmc792a + - adi,hmc1018a + - adi,hmc1019a + - adi,hmc1119 + + reg: + maxItems: 1 + + vcc-supply: + description: Regulator that provides power to the device. + + reset-gpios: + maxItems: 1 + + enable-gpios: + maxItems: 1 + description: Power-up or Serial Mode Enable GPIO. + +required: + - compatible + - reg + - vcc-supply + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + - if: + not: + properties: + compatible: + contains: + const: adi,hmc271a + then: + properties: + reset-gpios: false + - if: + not: + properties: + compatible: + contains: + anyOf: + - const: adi,ad8366 + - const: adi,ada4961 + - const: adi,adrf5720 + - const: adi,adrf5730 + - const: adi,adrf5731 + - const: adi,hmc792a + - const: adi,hmc1018a + - const: adi,hmc1019a + - const: adi,hmc1119 + then: + properties: + enable-gpios: false + +unevaluatedProperties: false + +examples: + - | + #include + spi { + #address-cells =3D <1>; + #size-cells =3D <0>; + + amplifier@0 { + compatible =3D "adi,ad8366"; + reg =3D <0>; + spi-max-frequency =3D <1000000>; + vcc-supply =3D <&vcc_3v3>; + enable-gpios =3D <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index ec9a6beb7619..ab4e487d603a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1589,6 +1589,7 @@ M: Rodrigo Alencar L: linux-iio@vger.kernel.org S: Supported W: https://ez.analog.com/linux-software-drivers +F: Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml F: drivers/iio/amplifiers/ad8366.c =20 ANALOG DEVICES INC AD9467 DRIVER --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B0F8131A072; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; cv=none; b=G4kzo/wlWyuiIXo0dHdQPjfZIGj8JU929p/G0l5AO1Butuo+Oj+xXZTxQdNF+H/YmlVDPrwhurI1xpyJKfZ6qLg2BJS8OO50+uvSQTObKWF42mlQL8rZBnDRf3Xxf6NJVmjJS9LWbZk3DNVAiYSLqRhxfkJd/jqjLwjKCqAEl5c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; c=relaxed/simple; bh=yoR1fzWyBOkzBi+MwYVZ4VC+/LI5ohoCGPMQMCFSYCg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BGCg2vLlWwxbP7bR2HCJYhljZX5UvVt11Eqeyo87V8sGrPnfk09M3LSFSS/id9b8eD9LNuW8ck8voqnu4FuNmvq0wPl0hQBoAsS6s8MbzF6sTU5ViJtpLjoT9fQAj8qRrHfO73LvTnl6Lj7gmUWGW+M0tGDJX/de5EfeBGM0ydg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hyrU1TDv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hyrU1TDv" Received: by smtp.kernel.org (Postfix) with ESMTPS id 83E3DC4AF0F; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=yoR1fzWyBOkzBi+MwYVZ4VC+/LI5ohoCGPMQMCFSYCg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hyrU1TDv6ZQkRxUvDONN+3ADdtypTIxP2sTGiyHoA9EcdQeQiro3jD08kQUSD2I9w s2/mpjqx5pq9+nJHGJIugLdry78sZWH3g8jywoM45/7m4EN1Xnd+2tyip0fqtmkOz+ MABXPEabr/HnSG5YhIkVtucerl2qYLgOtR9esXQbeSYyTVeKa14bL6QJtvOXz1GZc/ 412WITrqrBl1Fcpt+obEyIkqY0lzdnig4IRX1Yl82tEX7I+gfWtLZLfM3tGzdJxSyT Wgx+XN1s4L41hiMSpNfqVnqGDAz5TbsApAcHrwlOtxsQW/Wang5Dwl6jLbZ7Td9vW1 wqzMSPqdfdg2w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7057DEB2709; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:03 +0000 Subject: [PATCH v4 03/11] iio: amplifiers: ad8366: remove unused include headers 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 Message-Id: <20260210-iio-ad8366-update-v4-3-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=1638; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=CGbPKYHJlOJ9rYJnPGo0vg0Ptr//Gt2yLe6uykPVd2o=; b=3mPIYJQagyjOmd+0ojbhmRX/JbMX/TvzF24B3xqT5vy4n4kq+O9L0k/s4WCzVamj7hSc55pdi c+h4s2TTZ10BOP99kLBplrLssqY16/wSUdx07v06+ORihfZDGRxuqao X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Apply IWYU principle, removing the following headers: - linux/device.h: no usage of devm_add_action_or_reset, device_attr... - linux/kernel.h: no usage of container_of, kasprintf, ... - linux/slab.h: memory management handled by iio - linux/sysfs.h: sysfs interaction is managed by iio - linux/iio/sysfs.h: not using iio device attributes in this driver Being a small patch, the remaining includes are alphabetically sorted. In gcc, compiling with -H allows for dependency visualization, which indicates that except for linux/iio/sysfs.h, all removed headers are indirectly included by the remaining headers. Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index d06ac786501c..6382106ee6c7 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -11,19 +11,14 @@ * Copyright 2012-2019 Analog Devices Inc. */ =20 -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include =20 #include -#include =20 enum ad8366_type { ID_AD8366, --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BE2DD322B88; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; cv=none; b=FBA9UOSrhey/13IikP8I9+XzAiauVahynKsyqJjVchSGaubYAGl+PZImryGqeuc+4PY7RfUO095hVapvE5hQKjnpVHiGZXNb83xrD0SJTsSZ2mxXu3GM2x+CEMTN6eVaxav257FT3YarkJiouLcyUII+l6sX/qp/kRVoP3xlmQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; c=relaxed/simple; bh=HnXuDL6EUjqkpXjKEAnK3sdeskqhNnNnUmEFEmQP8fU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UqLSod8Vm+dsdSiCytBV1b00bp2RcKBw540rdGlE/S8UUdp/nxj/B7RCUZZhqRnTjr2zTArswxLRZQ4A9gJe0uf+GiMLx99P7BJfdgboWtfv11WgpNwGLxXx2Vq0O97ETBzfQ5/t+cDrBN9coasy6BAttoGDN07RTmjhAtpUIVA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YZAjwwXK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YZAjwwXK" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8FC23C4AF11; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=HnXuDL6EUjqkpXjKEAnK3sdeskqhNnNnUmEFEmQP8fU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=YZAjwwXKxqc3guNEJVZYBkgUAiDJpRv5SUsnAX3nMPNGrFGIyKs/ask4jtm0vP3nr +6/3StJiCt1hgef18MTU61NawmOk2Kiq5JyIm6thWJ5bj+ZvyhwwzDKlyQPTlTsRhX bIistFcd8VTIyEvPJ0mknnrLp18q4dDvVYyEnfp/m7pw+b0gtI0nJIZXPerQsFxENR goiBTgzoPemepK4nqb4DNCdJ5BPUa0Yb9TzyTqC+Gnhk2OgtbEAS4wkWZtRwgsichv /yTaU/7bzbfexTRlFIBkniA631XMX+CTndoChvlCVpybhfRqEuNS8YThzy6mezhsyF x/z8udVfN9VTw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D11EB270A; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:04 +0000 Subject: [PATCH v4 04/11] iio: amplifiers: ad8366: add local dev pointer to the probe function 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 Message-Id: <20260210-iio-ad8366-update-v4-4-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=889; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=JmFUgvP/u+bpyvqN7DVDvcGwocNFLn+PaOaZRRviA1w=; b=584fxEGTc98Iyh2c5wyNxfeEZUj5uTEhH/qfrQIsFQtLMGoZjcN0tkP02tGbZwVVO3GvBo8Jv OUFeYiB13X6BpR4UC7+wcFdiLBKeccHnKv5OY0uWz+vDJeHG8v7+/aH X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Create local device pointer in the probe function to shorten lines, making the code easier to read. Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index 6382106ee6c7..3456a31cb1ee 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -240,11 +240,12 @@ static const struct iio_chan_spec ada4961_channels[] = =3D { =20 static int ad8366_probe(struct spi_device *spi) { + struct device *dev =3D &spi->dev; struct iio_dev *indio_dev; struct ad8366_state *st; int ret; =20 - indio_dev =3D devm_iio_device_alloc(&spi->dev, sizeof(*st)); + indio_dev =3D devm_iio_device_alloc(dev, sizeof(*st)); if (indio_dev =3D=3D NULL) return -ENOMEM; =20 --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D889F32ED20; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; cv=none; b=RTszbbpwxmA0vgBZZrFIqW7yhX7Pm/TGP0fm3X5CU3t7pu4Ihu4rUc5t5cqFn/x3mNuDuhxSd/0kYUu8tK7rQvBecuWbsEccWHJApuGGQ3jFMJmq3v/z4Fo0XDu+g4zQOoy/78KcQnyUnQqoSwHiTXhWWHyJpKaaO9cUc4eIeL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; c=relaxed/simple; bh=plu/6l880qGIQgdniL/wvPRi4bACVp25bpy4r1Bt1sA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZRXi8PWI/X3AQWD+hay0lHkYCZZ9BOblbEjnvmt1CJJPyhbwK9UFTrAaeOt1SMxchnhOokrqASDuLqyVdHdH+8xhbOLA67/z4iKXZOUYa77JYh7GZBhB3C9+GSsjDWB9p8qziRLTEhjSa+mXstsBSC9gbPk4V2fV2K6nAb+Wmvk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EYHjQnQE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EYHjQnQE" Received: by smtp.kernel.org (Postfix) with ESMTPS id A09D3C2BCB4; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=plu/6l880qGIQgdniL/wvPRi4bACVp25bpy4r1Bt1sA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=EYHjQnQEi1zBvwt6LEkP7atxc9JDryypFx8EyTLYFcJblPOhvHqxKt/5mod6LRvU2 vzSVjAiL24lu0P/jWDqfWv293oMnZ5hIMyfR/SCsEqvVQqPSx7C56XNrpvOPwnG7mc I+liUZQbN6txHRGT5A5S5ab2MEQoSBcT0/QmhFBFTCotfHOoG1b41qGIjBnsP07f29 k/26dMGClAvX/+vVg20nYCN2Y587vNnmzfxPxdFOmh29gE0GpURj8gpMMzfHXzoLxS cxQXfwLOvonbGm9PB3kHGI/4G3iFp/+AHPunZM1MPA1ywfQISJM71OKa3UjO4VNr9q WyoJN/UmS2CeA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9863BEB2706; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:05 +0000 Subject: [PATCH v4 05/11] iio: amplifiers: ad8366: use devm_mutex_init() and drop mutex_init() 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 Message-Id: <20260210-iio-ad8366-update-v4-5-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=1203; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=N6wBoaEJ3rmqydikLPLchURyMnpaauU46yNuxPpxMDc=; b=DDbvkrLSZsTZmjyq6O/UnXAl2NDHW/6mwqxWsoQ/yhH+wwDAr3xNaWAaazh6gGWyRgrlgPi1j tFzsKZtxU3JBeB5JbVlzKHWpMrwVDsE2ylSCtdlbZcdmNzMB8x8L7jl X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Adopt proper mutex lifecycle with devm_mutex_init(), replacing mutex_init(). Also, Include linux/mutex.h header. Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index 3456a31cb1ee..f0053a09cbb6 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include =20 @@ -251,6 +252,10 @@ static int ad8366_probe(struct spi_device *spi) =20 st =3D iio_priv(indio_dev); =20 + ret =3D devm_mutex_init(dev, &st->lock); + if (ret) + return ret; + st->reg =3D devm_regulator_get(&spi->dev, "vcc"); if (!IS_ERR(st->reg)) { ret =3D regulator_enable(st->reg); @@ -259,7 +264,6 @@ static int ad8366_probe(struct spi_device *spi) } =20 spi_set_drvdata(spi, indio_dev); - mutex_init(&st->lock); st->spi =3D spi; st->type =3D spi_get_device_id(spi)->driver_data; =20 --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D751532E751; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; cv=none; b=iHG9QJa/FLqUq7w+XPR8VxSvWRrN5L5Thx3ZcK02KRJd6GGQ10gc2eIyMydhZ6RcQHcYOBFZ7iEVc5AZacFun+Gth69M6Mh8F09jGYTQjs9o8xwcBg2DQBWbb529kAA1xJsWRqDt2aQgg5Ak4nPw/Q6Qvv9h1Yr7EishxsBtov0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752537; c=relaxed/simple; bh=t+MFc6Y6ftKJJVBy3r8wUyzt4+z9BRslvNWo6wZERl8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DB3qZJepZi0uIidmDsLDvjvHhL75GNFMyPu/yYto5J0ScUclnNrQ/XdlFFzH4KXJlkRt9QHqiWJZr0nB1rBcAe4ZTpIgRtJGVv+KZHRf7SAYdhgeG5pU60uP+1L8vvKTqVcrotJec0KDGFBLTYTwaVqzTpYgioyr6WVYB5H1ylQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HcsrR+GG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HcsrR+GG" Received: by smtp.kernel.org (Postfix) with ESMTPS id B732CC2BCB2; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=t+MFc6Y6ftKJJVBy3r8wUyzt4+z9BRslvNWo6wZERl8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=HcsrR+GG7nVa9PKqsbxImGIPhg/CDoPVpHK29h9Wp+CsLlVNwFbGQoy4/jkhPEDfS bIZIOUyTK0n0DKa59U19d/fmnU2kT6QhYxp2IvPpHOKYYD41aQSDUrhtbgWAdmwtE/ YI5YzSntt/CXEzQgZmonqUQn16Xfn3DCjIx28zbortGC1LcEZumuOmvzD5NqBtjqJi UX4X9ntuMvTL7pvX8Zf9/Rn8MR/z4gtcqQd1fCMt3UJ6DMLHoIdZiBWXLfqgFq7To0 bniFglUVtiwAJdhprwS0OpLg4/7st7rQz2lGO9SSBCEfVehWuZDr5QR6ViAnNlPs5U bqQZGAWL9dnOA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA7FBEB2705; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:06 +0000 Subject: [PATCH v4 06/11] iio: amplifiers: ad8366: replace reset-gpio with reset controller 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 Message-Id: <20260210-iio-ad8366-update-v4-6-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=1768; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=xxSuKq9E/6bGxE6XgUkOFI+Qx13kgVsTJFs9X9iiQRc=; b=dcB2HBQADW0sFtiSzhEK2yJtDD8iig7v+7Xgvf5rjLDEUT3obH+6oIRmcXverU7+0qfG0sNR6 ziDzhGVfElqBjyssVwVTjhFQU9ReFlABf/kXoAkzP3pocd9D5BOi+8l X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Remove reset_gpio from the device state struct and use the reset_control interface instead, using a local variable, as it is not being used anywhere else. Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index f0053a09cbb6..67817dedd75d 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -17,6 +17,7 @@ #include #include #include +#include #include =20 #include @@ -38,7 +39,6 @@ struct ad8366_state { struct spi_device *spi; struct regulator *reg; struct mutex lock; /* protect sensor state */ - struct gpio_desc *reset_gpio; unsigned char ch[2]; enum ad8366_type type; const struct ad8366_info *info; @@ -242,6 +242,7 @@ static const struct iio_chan_spec ada4961_channels[] = =3D { static int ad8366_probe(struct spi_device *spi) { struct device *dev =3D &spi->dev; + struct reset_control *rstc; struct iio_dev *indio_dev; struct ad8366_state *st; int ret; @@ -276,9 +277,9 @@ static int ad8366_probe(struct spi_device *spi) case ID_ADL5240: case ID_HMC792: case ID_HMC1119: - st->reset_gpio =3D devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT= _HIGH); - if (IS_ERR(st->reset_gpio)) { - ret =3D PTR_ERR(st->reset_gpio); + rstc =3D devm_reset_control_get_optional_exclusive_deasserted(dev, NULL); + if (IS_ERR(rstc)) { + ret =3D PTR_ERR(rstc); goto error_disable_reg; } indio_dev->channels =3D ada4961_channels; --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EB16D32ED3A; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; cv=none; b=lCOSSPQjQamPGROMvGPmoH9iajW7xbFUsu6/cE3N4xfSg0LDGKLUC1yPUTvT1oG3T6bf+SaRCt7WB3hgRLcn0SWDUmHTqcZ3r4xaqm4CsK5dLFE3O76NFmC49F5/+ut2rjYvAbIzuDDPFzM+RqxRDUEcxZ48xnhGKGLLnzkk4io= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; c=relaxed/simple; bh=9bhEdZyE426udr5V3ZdReH9PNJlu7ZAy82PbMg/t5Hs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JGmJjpVDxNo/IEyZLHt489WdMuHNrFWNNaVdILa71AVkVJVMQqUBdr++dY5a8ivdhNFwpoFX1WmMLlmV3Ge3FGMiZuK1EAa4GDsUmo98Sv9Af2M7y5dm4RF+Pfjf2u1CM5mUCgOk3AAGjmgJ/LUNxONWcUWJLlgwLNC4FD9lkzk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OEozOCg0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OEozOCg0" Received: by smtp.kernel.org (Postfix) with ESMTPS id C7113C2BC9E; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=9bhEdZyE426udr5V3ZdReH9PNJlu7ZAy82PbMg/t5Hs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=OEozOCg0owq3RF+KB9xK+HP79Jw6a0aBEnw/GEPuWSFGZXvPiYE49iHSdMsnLiVOD VziJXKLiUB3WkKsMLDH4ChKeF6QdZYYPvwxqdvmNvEFF10PJYNpbo3js8XpypdZx72 0T+GLoqYLrEOwVdg2aQt+MKbCdy4DrhdwYdoCjq0vhhKGgIoyoS7U+RUxVrF77OWXK VHKmdSW0X+WZj8KvHvHApSrcXuAFBUMBsjOILTNSlnZNm6IjeVjZqlH+BA4fu1Y104 If35YVcCSrk3zBm7mSYcUG04Jrgp1E7tlhEbvjwjaedwS56eP9KFEpUwMc7GjxtRPw n1UtcVw/bwSIg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC647EB2709; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:07 +0000 Subject: [PATCH v4 07/11] iio: amplifiers: ad8366: refactor device resource management 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 Message-Id: <20260210-iio-ad8366-update-v4-7-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=3237; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=Iqe9a/13m6an1CCQungGiUSkPN31FhHQ76ZeG/vcghA=; b=T8Sd1yRyxrjB/wAll/W9WhydtNy4I7AZzvIVKlITL4Qq2bviYp2zeL9Zw6zqN6ryAX22Mf7Dy Ux6ZF5F/I74BbPr7jwtL/jRk36YoZ4k70W8gqKW5/BOKenNnkfcWtqv X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Adhere modern device resource management with the following: - Voltage regulator managed and enabled internally; - IIO device registration handled with devm_iio_device_register(); - removal of goto's from the probe function; - ad8366_remove() removed as it is not needed anymore; With the drop of goto's dev_err_probe() is used to report probe errors. Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 50 +++++++++----------------------------= ---- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index 67817dedd75d..343f370eae65 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -37,7 +37,6 @@ struct ad8366_info { =20 struct ad8366_state { struct spi_device *spi; - struct regulator *reg; struct mutex lock; /* protect sensor state */ unsigned char ch[2]; enum ad8366_type type; @@ -257,14 +256,10 @@ static int ad8366_probe(struct spi_device *spi) if (ret) return ret; =20 - st->reg =3D devm_regulator_get(&spi->dev, "vcc"); - if (!IS_ERR(st->reg)) { - ret =3D regulator_enable(st->reg); - if (ret) - return ret; - } + ret =3D devm_regulator_get_enable(dev, "vcc"); + if (ret) + return dev_err_probe(dev, ret, "Failed to get regulator\n"); =20 - spi_set_drvdata(spi, indio_dev); st->spi =3D spi; st->type =3D spi_get_device_id(spi)->driver_data; =20 @@ -278,17 +273,15 @@ static int ad8366_probe(struct spi_device *spi) case ID_HMC792: case ID_HMC1119: rstc =3D devm_reset_control_get_optional_exclusive_deasserted(dev, NULL); - if (IS_ERR(rstc)) { - ret =3D PTR_ERR(rstc); - goto error_disable_reg; - } + if (IS_ERR(rstc)) + return dev_err_probe(dev, PTR_ERR(rstc), + "Failed to get reset controller\n"); + indio_dev->channels =3D ada4961_channels; indio_dev->num_channels =3D ARRAY_SIZE(ada4961_channels); break; default: - dev_err(&spi->dev, "Invalid device ID\n"); - ret =3D -EINVAL; - goto error_disable_reg; + return dev_err_probe(dev, -EINVAL, "Invalid device ID\n"); } =20 st->info =3D &ad8366_infos[st->type]; @@ -298,31 +291,9 @@ static int ad8366_probe(struct spi_device *spi) =20 ret =3D ad8366_write(indio_dev, 0, 0); if (ret < 0) - goto error_disable_reg; + return dev_err_probe(dev, ret, "failed to write initial gain\n"); =20 - ret =3D iio_device_register(indio_dev); - if (ret) - goto error_disable_reg; - - return 0; - -error_disable_reg: - if (!IS_ERR(st->reg)) - regulator_disable(st->reg); - - return ret; -} - -static void ad8366_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev =3D spi_get_drvdata(spi); - struct ad8366_state *st =3D iio_priv(indio_dev); - struct regulator *reg =3D st->reg; - - iio_device_unregister(indio_dev); - - if (!IS_ERR(reg)) - regulator_disable(reg); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct spi_device_id ad8366_id[] =3D { @@ -340,7 +311,6 @@ static struct spi_driver ad8366_driver =3D { .name =3D KBUILD_MODNAME, }, .probe =3D ad8366_probe, - .remove =3D ad8366_remove, .id_table =3D ad8366_id, }; =20 --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0F36232FA28; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; cv=none; b=hRyh5K9tUO4LErSKlBdM9JBNpb5jZDAW3QWv2rc+qF0PADLHHuASD+vuzSnsBLAn3Cz3HJSmUaiEXMFzy3PRfWL18i6/GgcjE9nnu5ZlY2eZ8POsiNedC/zobbgv3H7YKUwnHrP3mi/UTh0/n5yEqYuFHkwAG56ZYFdH/32RQ4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; c=relaxed/simple; bh=gFisofjRmRDkCElxihVrUt91J4Goj29Lj706xglJ8+E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f5fwoOq97E+yaQxxu/s5VvM6MssSxUzkYF3+8tiIPtpg6fBEXJPuKrWK6H+nqgJyRyDuxQL7qVkDIfDYZQmDaRSnc/GwWP4EnirDPsC+F5sPLUQufe5I7OdA3oo003vCQkb8Q89kCK9THEQPnEgIi2uXdbwh2Rx9K0+a6BfUK5s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gfKCgE3e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gfKCgE3e" Received: by smtp.kernel.org (Postfix) with ESMTPS id E392BC2BCAF; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752537; bh=gFisofjRmRDkCElxihVrUt91J4Goj29Lj706xglJ8+E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gfKCgE3e5pbICWl4GW+IBvgezP48EPwEIiFubKnU0fXtGZEyQz4c7Iv0rtt6J6xrh 8g/Vx/A2xxKK9sG67H/Atgb3NQkYVBKPgGhqs/qP/xFvbps9lpJmO095XXS/DcaxbF 6VWpbzFdJI7UiT3xaNWdClCYJH8NNBDXVq76XFQsmiPHza0GgticcTqWxI0IGmbZZA 5u3wWoXb4KPwPDPMwe5jrks7oGoz25IYb6mMqoW+urB/YI6oXyn8z806k1SHdQFDxN MCh53/f9tmnfzaSidWE8Yuw5ZeYbYoeM4zYpHiF0Z5ctYYgSGzw5yKzlzVCbhrs6iy AdwvGhC8zS9Rw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC756EB2706; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:08 +0000 Subject: [PATCH v4 08/11] iio: amplifiers: ad8366: prepare for device-tree support 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 Message-Id: <20260210-iio-ad8366-update-v4-8-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=7157; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=Zdn1IjVL+LQBedLBJP4SxLg0QqdNykisF4eKilB9Xc4=; b=JrMfelEnl3N9RfcUtZKGo+WOxkU4yccNxAYuUHxU/1MuiyMyMc3HLkwfSx7RhM3fwVNVD6EYE WEFJ3ejZp/zBLy6U7UYQqhlQZgClhTC6DHdlWlCJf/L3ZglukZ1VUnb X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Drop switch case on the enum ID in favor of extended chip info table, containing: - gain_step, indicating with sign the start of the code range; - num_channels, to indicate the number IIO channels; - pack_code() function to describe how SPI buffer is populated; Which allowed for a simplified read_raw() and write_raw() callbacks. The probe() function was adjusted accordingly. Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 139 +++++++++++++-----------------------= ---- 1 file changed, 46 insertions(+), 93 deletions(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index 343f370eae65..1ae75643e89b 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -19,6 +19,7 @@ #include #include #include +#include =20 #include =20 @@ -30,16 +31,20 @@ enum ad8366_type { ID_HMC1119, }; =20 +struct ad8366_state; + struct ad8366_info { int gain_min; int gain_max; + int gain_step; + int num_channels; + size_t (*pack_code)(struct ad8366_state *st); }; =20 struct ad8366_state { struct spi_device *spi; struct mutex lock; /* protect sensor state */ unsigned char ch[2]; - enum ad8366_type type; const struct ad8366_info *info; /* * DMA (thus cache coherency maintenance) may require the @@ -48,60 +53,58 @@ struct ad8366_state { unsigned char data[2] __aligned(IIO_DMA_MINALIGN); }; =20 +static size_t ad8366_pack_code(struct ad8366_state *st) +{ + u8 ch_a =3D bitrev8(st->ch[0]) >> 2; + u8 ch_b =3D bitrev8(st->ch[1]) >> 2; + + put_unaligned_be16((ch_b << 6) | ch_a, &st->data[0]); + return sizeof(__be16); +} + static const struct ad8366_info ad8366_infos[] =3D { [ID_AD8366] =3D { .gain_min =3D 4500, .gain_max =3D 20500, + .gain_step =3D 253, + .num_channels =3D 2, + .pack_code =3D ad8366_pack_code, }, [ID_ADA4961] =3D { .gain_min =3D -6000, .gain_max =3D 15000, + .gain_step =3D -1000, + .num_channels =3D 1, }, [ID_ADL5240] =3D { .gain_min =3D -11500, .gain_max =3D 20000, + .gain_step =3D 500, + .num_channels =3D 1, }, [ID_HMC792] =3D { .gain_min =3D -15750, .gain_max =3D 0, + .gain_step =3D 250, + .num_channels =3D 1, }, [ID_HMC1119] =3D { .gain_min =3D -31750, .gain_max =3D 0, + .gain_step =3D -250, + .num_channels =3D 1, }, }; =20 -static int ad8366_write(struct iio_dev *indio_dev, - unsigned char ch_a, unsigned char ch_b) +static int ad8366_write_code(struct ad8366_state *st) { - struct ad8366_state *st =3D iio_priv(indio_dev); - int ret; + const struct ad8366_info *inf =3D st->info; =20 - switch (st->type) { - case ID_AD8366: - ch_a =3D bitrev8(ch_a & 0x3F); - ch_b =3D bitrev8(ch_b & 0x3F); + if (inf->pack_code) + spi_write(st->spi, st->data, inf->pack_code(st)); =20 - st->data[0] =3D ch_b >> 4; - st->data[1] =3D (ch_b << 4) | (ch_a >> 2); - break; - case ID_ADA4961: - st->data[0] =3D ch_a & 0x1F; - break; - case ID_ADL5240: - st->data[0] =3D (ch_a & 0x3F); - break; - case ID_HMC792: - case ID_HMC1119: - st->data[0] =3D ch_a; - break; - } - - ret =3D spi_write(st->spi, st->data, indio_dev->num_channels); - if (ret < 0) - dev_err(&indio_dev->dev, "write failed (%d)", ret); - - return ret; + st->data[0] =3D st->ch[0]; + return spi_write(st->spi, st->data, 1); } =20 static int ad8366_read_raw(struct iio_dev *indio_dev, @@ -111,6 +114,7 @@ static int ad8366_read_raw(struct iio_dev *indio_dev, long m) { struct ad8366_state *st =3D iio_priv(indio_dev); + const struct ad8366_info *inf =3D st->info; int ret; int code, gain =3D 0; =20 @@ -118,25 +122,8 @@ static int ad8366_read_raw(struct iio_dev *indio_dev, switch (m) { case IIO_CHAN_INFO_HARDWAREGAIN: code =3D st->ch[chan->channel]; - - switch (st->type) { - case ID_AD8366: - gain =3D code * 253 + 4500; - break; - case ID_ADA4961: - gain =3D 15000 - code * 1000; - break; - case ID_ADL5240: - gain =3D 20000 - 31500 + code * 500; - break; - case ID_HMC792: - gain =3D -1 * code * 500; - break; - case ID_HMC1119: - gain =3D -1 * code * 250; - break; - } - + gain =3D inf->gain_step > 0 ? inf->gain_min : inf->gain_max; + gain +=3D inf->gain_step * code; /* Values in dB */ *val =3D gain / 1000; *val2 =3D (gain % 1000) * 1000; @@ -171,29 +158,14 @@ static int ad8366_write_raw(struct iio_dev *indio_dev, if (gain > inf->gain_max || gain < inf->gain_min) return -EINVAL; =20 - switch (st->type) { - case ID_AD8366: - code =3D (gain - 4500) / 253; - break; - case ID_ADA4961: - code =3D (15000 - gain) / 1000; - break; - case ID_ADL5240: - code =3D ((gain - 500 - 20000) / 500) & 0x3F; - break; - case ID_HMC792: - code =3D (abs(gain) / 500) & 0x3F; - break; - case ID_HMC1119: - code =3D (abs(gain) / 250) & 0x7F; - break; - } + gain -=3D inf->gain_step > 0 ? inf->gain_min : inf->gain_max; + code =3D DIV_ROUND_CLOSEST(gain, inf->gain_step); =20 mutex_lock(&st->lock); switch (mask) { case IIO_CHAN_INFO_HARDWAREGAIN: st->ch[chan->channel] =3D code; - ret =3D ad8366_write(indio_dev, st->ch[0], st->ch[1]); + ret =3D ad8366_write_code(st); break; default: ret =3D -EINVAL; @@ -234,10 +206,6 @@ static const struct iio_chan_spec ad8366_channels[] = =3D { AD8366_CHAN(1), }; =20 -static const struct iio_chan_spec ada4961_channels[] =3D { - AD8366_CHAN(0), -}; - static int ad8366_probe(struct spi_device *spi) { struct device *dev =3D &spi->dev; @@ -261,35 +229,20 @@ static int ad8366_probe(struct spi_device *spi) return dev_err_probe(dev, ret, "Failed to get regulator\n"); =20 st->spi =3D spi; - st->type =3D spi_get_device_id(spi)->driver_data; + st->info =3D &ad8366_infos[spi_get_device_id(spi)->driver_data]; =20 - switch (st->type) { - case ID_AD8366: - indio_dev->channels =3D ad8366_channels; - indio_dev->num_channels =3D ARRAY_SIZE(ad8366_channels); - break; - case ID_ADA4961: - case ID_ADL5240: - case ID_HMC792: - case ID_HMC1119: - rstc =3D devm_reset_control_get_optional_exclusive_deasserted(dev, NULL); - if (IS_ERR(rstc)) - return dev_err_probe(dev, PTR_ERR(rstc), - "Failed to get reset controller\n"); + rstc =3D devm_reset_control_get_optional_exclusive_deasserted(dev, NULL); + if (IS_ERR(rstc)) + return dev_err_probe(dev, PTR_ERR(rstc), + "Failed to get reset controller\n"); =20 - indio_dev->channels =3D ada4961_channels; - indio_dev->num_channels =3D ARRAY_SIZE(ada4961_channels); - break; - default: - return dev_err_probe(dev, -EINVAL, "Invalid device ID\n"); - } - - st->info =3D &ad8366_infos[st->type]; indio_dev->name =3D spi_get_device_id(spi)->name; indio_dev->info =3D &ad8366_info; indio_dev->modes =3D INDIO_DIRECT_MODE; + indio_dev->channels =3D ad8366_channels; + indio_dev->num_channels =3D st->info->num_channels; =20 - ret =3D ad8366_write(indio_dev, 0, 0); + ret =3D ad8366_write_code(st); if (ret < 0) return dev_err_probe(dev, ret, "failed to write initial gain\n"); =20 --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 433F6331226; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; cv=none; b=jg/vnu5LZV0ouzMqcJHnqskjCZqFBeBKmwgGAcGswHa+zPGl8slCla29M/QnK/QWtF/Sh1nL5vTm9He7rfDNmCziTzGYlPDM+Bp8hDnr84TCTL7/wWZgg0tM8QLLjYzBk7jyZBRxXJGp/2f9SIGUZVoOsHZ870Ishtdr0XShaio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; c=relaxed/simple; bh=dBAEJKtc96dEneGGru/3QqhRhpSnPrGxCr2yV8h6zZY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aLUbCVMGnDxFP+W+Gr42qe7mhiroH5tke8QwxOnQ4wMuMiqI4coA1v4m+PSMvXpyvUm2SQEvV/EcqAtQTuP7WSgqk08gIfpM8p/hryyMOlWxqBDq1Zn3+Fslcbly/M8B3/3K1r85rRhxQr0gm3WozNGK2OsVJhdkX45G4pYx+OM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Eof9XVRo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Eof9XVRo" Received: by smtp.kernel.org (Postfix) with ESMTPS id 04310C19421; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752538; bh=dBAEJKtc96dEneGGru/3QqhRhpSnPrGxCr2yV8h6zZY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Eof9XVRoHwuuW8HmMPYXo+AkWQDdGhMLqqYlC3dJAll+Gy1OWXjsm4eevLEsvh+Kb U3+78eUBLadoIaCmUQ55+N9QXbBuzEHd6XYjjcp+giBiLPsWiJq+L16yuj9PLNnobN ejh6l2BxDEpunTVXylGPzP5Q3ondn+Y6+wExaKR5n78+kSKUEx/DrKK09EGYAOrq78 Irq7WrJb835sIKDwMB3aTAR+TUhBg8yc8FtCsKOeR2cyM9tu0rhmyu00fWeDRmAlN3 tXqjY6h10IlYsyroSK+UM8EUJDoOql3gb9B3bddI448kUoxC9AIn8o/e1bJAHzrHfe 5guI9XL74uq2A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECB69EB2700; Tue, 10 Feb 2026 19:42:17 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:09 +0000 Subject: [PATCH v4 09/11] iio: amplifiers: ad8366: add device tree support 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 Message-Id: <20260210-iio-ad8366-update-v4-9-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=4163; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=Q1eL1soBzt5LHgD1qOKJM+53k4PYKZ8/z9tudKqluIA=; b=eQQfhs+zD2dD7LvlR2kiKOJhcwb2MjmslXaewcKN79vRzr8nzAplH+G9TLC97gT1X/JtJSTuS Wa3bZtwwPeoAhiMWpRNdHW9xZOdolbXPvnHVKgQ6d3CVbmRp4k5S1i3 X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Drop the enum ID, split chip info table into per-device structs and add of_match_table. Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 100 +++++++++++++++++++++---------------= ---- 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index 1ae75643e89b..79fb3119d794 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -23,14 +24,6 @@ =20 #include =20 -enum ad8366_type { - ID_AD8366, - ID_ADA4961, - ID_ADL5240, - ID_HMC792, - ID_HMC1119, -}; - struct ad8366_state; =20 struct ad8366_info { @@ -62,38 +55,40 @@ static size_t ad8366_pack_code(struct ad8366_state *st) return sizeof(__be16); } =20 -static const struct ad8366_info ad8366_infos[] =3D { - [ID_AD8366] =3D { - .gain_min =3D 4500, - .gain_max =3D 20500, - .gain_step =3D 253, - .num_channels =3D 2, - .pack_code =3D ad8366_pack_code, - }, - [ID_ADA4961] =3D { - .gain_min =3D -6000, - .gain_max =3D 15000, - .gain_step =3D -1000, - .num_channels =3D 1, - }, - [ID_ADL5240] =3D { - .gain_min =3D -11500, - .gain_max =3D 20000, - .gain_step =3D 500, - .num_channels =3D 1, - }, - [ID_HMC792] =3D { - .gain_min =3D -15750, - .gain_max =3D 0, - .gain_step =3D 250, - .num_channels =3D 1, - }, - [ID_HMC1119] =3D { - .gain_min =3D -31750, - .gain_max =3D 0, - .gain_step =3D -250, - .num_channels =3D 1, - }, +static const struct ad8366_info ad8366_chip_info =3D { + .gain_min =3D 4500, + .gain_max =3D 20500, + .gain_step =3D 253, + .num_channels =3D 2, + .pack_code =3D ad8366_pack_code, +}; + +static const struct ad8366_info ada4961_chip_info =3D { + .gain_min =3D -6000, + .gain_max =3D 15000, + .gain_step =3D -1000, + .num_channels =3D 1, +}; + +static const struct ad8366_info adl5240_chip_info =3D { + .gain_min =3D -11500, + .gain_max =3D 20000, + .gain_step =3D 500, + .num_channels =3D 1, +}; + +static const struct ad8366_info hmc792_chip_info =3D { + .gain_min =3D -15750, + .gain_max =3D 0, + .gain_step =3D 250, + .num_channels =3D 1, +}; + +static const struct ad8366_info hmc1119_chip_info =3D { + .gain_min =3D -31750, + .gain_max =3D 0, + .gain_step =3D -250, + .num_channels =3D 1, }; =20 static int ad8366_write_code(struct ad8366_state *st) @@ -229,7 +224,7 @@ static int ad8366_probe(struct spi_device *spi) return dev_err_probe(dev, ret, "Failed to get regulator\n"); =20 st->spi =3D spi; - st->info =3D &ad8366_infos[spi_get_device_id(spi)->driver_data]; + st->info =3D spi_get_device_match_data(spi); =20 rstc =3D devm_reset_control_get_optional_exclusive_deasserted(dev, NULL); if (IS_ERR(rstc)) @@ -250,18 +245,29 @@ static int ad8366_probe(struct spi_device *spi) } =20 static const struct spi_device_id ad8366_id[] =3D { - {"ad8366", ID_AD8366}, - {"ada4961", ID_ADA4961}, - {"adl5240", ID_ADL5240}, - {"hmc792a", ID_HMC792}, - {"hmc1119", ID_HMC1119}, + {"ad8366", (kernel_ulong_t)&ad8366_chip_info}, + {"ada4961", (kernel_ulong_t)&ada4961_chip_info}, + {"adl5240", (kernel_ulong_t)&adl5240_chip_info}, + {"hmc792a", (kernel_ulong_t)&hmc792_chip_info}, + {"hmc1119", (kernel_ulong_t)&hmc1119_chip_info}, { } }; MODULE_DEVICE_TABLE(spi, ad8366_id); =20 +static const struct of_device_id ad8366_of_match[] =3D { + { .compatible =3D "adi,ad8366", .data =3D &ad8366_chip_info }, + { .compatible =3D "adi,ada4961", .data =3D &ada4961_chip_info }, + { .compatible =3D "adi,adl5240", .data =3D &adl5240_chip_info }, + { .compatible =3D "adi,hmc792a", .data =3D &hmc792_chip_info }, + { .compatible =3D "adi,hmc1119", .data =3D &hmc1119_chip_info }, + { } +}; +MODULE_DEVICE_TABLE(of, ad8366_of_match); + static struct spi_driver ad8366_driver =3D { .driver =3D { - .name =3D KBUILD_MODNAME, + .name =3D KBUILD_MODNAME, + .of_match_table =3D ad8366_of_match, }, .probe =3D ad8366_probe, .id_table =3D ad8366_id, --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5E18B331A5C; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; cv=none; b=CrMsnLEslJUHoI9h4X+3/g1YwtH6s8UqWcVCvf/9A0wVs/0SPnkqLCOla7NG6ilWdX2y1jGdoW4BSAucdNrJGNbAWT4Fa/ioF6SC0V2iUYJChXjLGfZe/4f04ImSvxwF02ZL061XK11LkIYVjWJNxMoYl6HzqTNaIWkE9V9O078= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; c=relaxed/simple; bh=Nckr18q+Pc834VltsB532nh4FNhXlL8U3Bfapvh6vec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FaT9zfYDLP7+z6nK46XEEuVRMd5hUUKqFrQ498rbCGpDQZQIvY/rCWCb4G9bu7R+yBAAbSyMiik+XHMidg4pSPI2XFuCYu9c/SuA8hAPcDTj04XUgoyAQzTzkDh46DNZ0xpb6Y5jnqzkwcTRRCOqmOrUQO51Gb/IyQfttNAfMww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DRegcP0X; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DRegcP0X" Received: by smtp.kernel.org (Postfix) with ESMTPS id 1BE55C4AF49; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752538; bh=Nckr18q+Pc834VltsB532nh4FNhXlL8U3Bfapvh6vec=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=DRegcP0XiYscP+aCrplYWALp91kgy3MXzmwbfdumKASrueTsNqhNFywMsevGgi4cf JJ2a0GolFHuWQQgBcVYlP+zqiCOkb7rqd2Fs65LO8Q3KleXsI+Z47BZ/C+PQcPPdJ0 IcLrv/Cm+y0AZUBEvJfGYzL0sjpaMrSH8jWZcibrNmYzUIYwQ0KHw+7/SiM8DE0eXD VWlnvGhzVJhxrRD3Zj6wYmqN34ikFntxmr+jliCNHKbBWQjakwusA7/frtxVt6sKkH vGiCG+jA+L9h6qbYb2ZxY+iGSV3Z6QyqCAnrJ8f4sVwfBz9ZWpqvAtUFNLOCwMb8ts 6zTA0ex8LkrPg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BD5EEB270A; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:10 +0000 Subject: [PATCH v4 10/11] iio: amplifiers: ad8366: consume enable gpio 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 Message-Id: <20260210-iio-ad8366-update-v4-10-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=1285; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=4a2IBbnyaOJ7gewx1RlFVq18q3wqExfVEKH0FpNfWGQ=; b=ODvCtSxIjNnFuIBGHRSZc7k0d0/Cpiigr+61MAjQv2eUbD9QtJwKDAot2rMbFsXoP/k9CJQ3z FOKcHLmyF4kAFj06z/HtSpakuGw3V8AJ+Fi8DqTtkJJ5+3ono5w91RE X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Some parts may consume enable GPIO to enable serial mode (HMC1119's and HMC792A P/S pin) or powerup the device (e.g. ADA4961's PWUP pin). Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/ad8366.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index 79fb3119d794..b828b4be7b6e 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -204,6 +204,7 @@ static const struct iio_chan_spec ad8366_channels[] =3D= { static int ad8366_probe(struct spi_device *spi) { struct device *dev =3D &spi->dev; + struct gpio_desc *enable_gpio; struct reset_control *rstc; struct iio_dev *indio_dev; struct ad8366_state *st; @@ -231,6 +232,11 @@ static int ad8366_probe(struct spi_device *spi) return dev_err_probe(dev, PTR_ERR(rstc), "Failed to get reset controller\n"); =20 + enable_gpio =3D devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH); + if (IS_ERR(enable_gpio)) + return dev_err_probe(dev, PTR_ERR(enable_gpio), + "Failed to get enable GPIO\n"); + indio_dev->name =3D spi_get_device_id(spi)->name; indio_dev->info =3D &ad8366_info; indio_dev->modes =3D INDIO_DIRECT_MODE; --=20 2.43.0 From nobody Thu Apr 2 15:37:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 711D23321AC; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; cv=none; b=FI7jVdS4EF1sihq7vbY4ZVSi3rMc+zW8O1vbO8volibPVSCpD+KwQOrNoDbkrI4Fjye29v9okq+1MpQwuZYkpH1qGQ2SU6ABe33LjqzbeivSpCaIWyRnS1PeDoBf9BoKXPHBOhBEHTuIdLNrdj5BfROP58tTmVo/p0HmrgRaeCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770752538; c=relaxed/simple; bh=KpXvmFl+syncpkCtaPcSi8srLDjNWaSTi/4gEpXGT+E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i92W0n4hiMfzzEsTZaxuHFAY+nOZVatSigsbA0eVjsVpAWbVmC8nHwqP0Wb+cujFf8LYNNYWW7IHtxyl86dE5F2Jm3MhT35Odsh8lJfOZHCf3E2iHAZuPk8adxwv+zTe+8Fk3G0sTdGSYeLVsJ6QLyMqFajQ7cXhKXUWOondE9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=js+25X4z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="js+25X4z" Received: by smtp.kernel.org (Postfix) with ESMTPS id 28BD6C4AF52; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770752538; bh=KpXvmFl+syncpkCtaPcSi8srLDjNWaSTi/4gEpXGT+E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=js+25X4zMeQr9GcAY4VohrB6tgdj4jysvQczrcoEvu6C2Br5pU9NtunAtDG+6lC/C MtSpzK9mfb16Gq9fLBHYdUMDJQtZPqCkqgt6qcUB+fUtA15EJ0nzFdtyYvX7oKp6ZQ qRm4qXUi5pFKzkEwcjWDR4OXuRXsGoT5JGM82Ekr4wf6wrbh/01JZIEL8pdmI0eGvB 7JP+KbS+Ci4vLC7OnHzQLbU5X5ltVE5Lg6rBCqyL3zCfWBbyX1q6qnM43BZtfDpwhx eiFnUZ4yh9q2QRXhVMC6ijnvI5KW9RfLCCJFzrK6CvR6PH4AOjVcsAKrn1SnX4XnGB oyUj2WHGer74w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CCFEEB2705; Tue, 10 Feb 2026 19:42:18 +0000 (UTC) From: Rodrigo Alencar via B4 Relay Date: Tue, 10 Feb 2026 19:42:11 +0000 Subject: [PATCH v4 11/11] iio: amplifiers: ad8366: update device support 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 Message-Id: <20260210-iio-ad8366-update-v4-11-15505f7b15b4@analog.com> References: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> In-Reply-To: <20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com> To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org Cc: Michael Hennerich , Lars-Peter Clausen , Jonathan Cameron , David Lechner , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Rodrigo Alencar , Alexandru Ardelean , Andy Shevchenko X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770752535; l=6323; i=rodrigo.alencar@analog.com; s=default; h=from:subject:message-id; bh=Qj5k/iG07e3Uu6gv8GR2XRC/GwglthIFM2mL/CXtoTw=; b=j0XrDXYdjK+EqUBWRxDIvGDp2rBhT1rYep0o1nt2OM0d/wHGRadVuwsEyXoovsSwYlXU0L0eM deoajEZqonTBhSU0ygegQ52i03jZHF/pclW7comz/S6xwFCr0ADmsDd X-Developer-Key: i=rodrigo.alencar@analog.com; a=ed25519; pk=ULeHbgU/OYh/PG/4anHDfLgldFItQHAhOktYRVLMFRo= X-Endpoint-Received: by B4 Relay for rodrigo.alencar@analog.com/default with auth_id=561 X-Original-From: Rodrigo Alencar Reply-To: rodrigo.alencar@analog.com From: Rodrigo Alencar Add support for the following digital step attenuators: - HMC271A: 1dB LSB 5-Bit Digital Attenuator SMT, 0.7 - 3.7 GHz - ADRF5720: 0.5 dB LSB, 6-Bit, Digital Attenuator, 9 kHz to 40 GHz - ADRF5730: 0.5 dB LSB, 6-Bit, Digital Attenuator, 100 MHz to 40 GHz - ADRF5731: 2 dB LSB, 4-Bit, Digital Attenuator, 100 MHz to 40 GHz - HMC1018A: 1.0 dB LSB GaAs MMIC 5-BIT DIGITAL ATTENUATOR, 0.1 - 30 GHz - HMC1019A: 0.5 dB LSB GaAs MMIC 5-BIT DIGITAL ATTENUATOR, 0.1 - 30 GHz Additionally, copyright notice was updated with current year. Co-developed-by: Alexandru Ardelean Signed-off-by: Alexandru Ardelean Co-developed-by: Michael Hennerich Signed-off-by: Michael Hennerich Reviewed-by: Andy Shevchenko Signed-off-by: Rodrigo Alencar --- drivers/iio/amplifiers/Kconfig | 6 ++++ drivers/iio/amplifiers/ad8366.c | 69 +++++++++++++++++++++++++++++++++++++= +++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/drivers/iio/amplifiers/Kconfig b/drivers/iio/amplifiers/Kconfig index a8a604863eed..39d280d4d437 100644 --- a/drivers/iio/amplifiers/Kconfig +++ b/drivers/iio/amplifiers/Kconfig @@ -18,7 +18,13 @@ config AD8366 AD8366 Dual-Digital Variable Gain Amplifier (VGA) ADA4961 BiCMOS RF Digital Gain Amplifier (DGA) ADL5240 Digitally controlled variable gain amplifier (VGA) + ADRF5720: 0.5 dB LSB, 6-Bit, Silicon Digital Attenuator + ADRF5730: 0.5 dB LSB, 6-Bit, Silicon Digital Attenuator + ADRF5731: 2 dB LSB, 4-Bit, Silicon Digital Attenuator + HMC271A: 1dB LSB 5-Bit Digital Attenuator SMT HMC792A 0.25 dB LSB GaAs MMIC 6-Bit Digital Attenuator + HMC1018A: 1.0 dB LSB GaAs MMIC 5-BIT Digital Attenuator + HMC1019A: 0.5 dB LSB GaAs MMIC 5-BIT Digital Attenuator HMC1119 0.25 dB LSB, 7-Bit, Silicon Digital Attenuator =20 To compile this driver as a module, choose M here: the diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad836= 6.c index b828b4be7b6e..557243497339 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c @@ -5,10 +5,16 @@ * AD8366 Dual-Digital Variable Gain Amplifier (VGA) * ADA4961 BiCMOS RF Digital Gain Amplifier (DGA) * ADL5240 Digitally controlled variable gain amplifier (VGA) + * ADRF5720: 0.5 dB LSB, 6-Bit, Silicon Digital Attenuator, 9 kHz to 40 = GHz + * ADRF5730: 0.5 dB LSB, 6-Bit, Silicon Digital Attenuator, 100 MHz to 4= 0 GHz + * ADRF5731: 2 dB LSB, 4-Bit, Silicon Digital Attenuator, 100 MHz to 40 = GHz + * HMC271A: 1dB LSB 5-Bit Digital Attenuator SMT, 0.7 - 3.7 GHz * HMC792A 0.25 dB LSB GaAs MMIC 6-Bit Digital Attenuator + * HMC1018A: 1.0 dB LSB GaAs MMIC 5-BIT DIGITAL ATTENUATOR, 0.1 - 30 GHz + * HMC1019A: 0.5 dB LSB GaAs MMIC 5-BIT DIGITAL ATTENUATOR, 0.1 - 30 GHz * HMC1119 0.25 dB LSB, 7-Bit, Silicon Digital Attenuator * - * Copyright 2012-2019 Analog Devices Inc. + * Copyright 2012-2026 Analog Devices Inc. */ =20 #include @@ -55,6 +61,18 @@ static size_t ad8366_pack_code(struct ad8366_state *st) return sizeof(__be16); } =20 +static size_t adrf5731_pack_code(struct ad8366_state *st) +{ + st->data[0] =3D st->ch[0] << 2; + return 1; +} + +static size_t hmc271_pack_code(struct ad8366_state *st) +{ + st->data[0] =3D bitrev8(st->ch[0]) >> 3; + return 1; +} + static const struct ad8366_info ad8366_chip_info =3D { .gain_min =3D 4500, .gain_max =3D 20500, @@ -77,6 +95,29 @@ static const struct ad8366_info adl5240_chip_info =3D { .num_channels =3D 1, }; =20 +static const struct ad8366_info adrf57x0_chip_info =3D { + .gain_min =3D -31500, + .gain_max =3D 0, + .gain_step =3D -500, + .num_channels =3D 1, +}; + +static const struct ad8366_info adrf5731_chip_info =3D { + .gain_min =3D -30000, + .gain_max =3D 0, + .gain_step =3D -2000, + .num_channels =3D 1, + .pack_code =3D adrf5731_pack_code, +}; + +static const struct ad8366_info hmc271_chip_info =3D { + .gain_min =3D -31000, + .gain_max =3D 0, + .gain_step =3D 1000, + .num_channels =3D 1, + .pack_code =3D hmc271_pack_code, +}; + static const struct ad8366_info hmc792_chip_info =3D { .gain_min =3D -15750, .gain_max =3D 0, @@ -84,6 +125,20 @@ static const struct ad8366_info hmc792_chip_info =3D { .num_channels =3D 1, }; =20 +static const struct ad8366_info hmc1018_chip_info =3D { + .gain_min =3D -31000, + .gain_max =3D 0, + .gain_step =3D 1000, + .num_channels =3D 1, +}; + +static const struct ad8366_info hmc1019_chip_info =3D { + .gain_min =3D -15500, + .gain_max =3D 0, + .gain_step =3D 500, + .num_channels =3D 1, +}; + static const struct ad8366_info hmc1119_chip_info =3D { .gain_min =3D -31750, .gain_max =3D 0, @@ -254,7 +309,13 @@ static const struct spi_device_id ad8366_id[] =3D { {"ad8366", (kernel_ulong_t)&ad8366_chip_info}, {"ada4961", (kernel_ulong_t)&ada4961_chip_info}, {"adl5240", (kernel_ulong_t)&adl5240_chip_info}, + {"adrf5720", (kernel_ulong_t)&adrf57x0_chip_info}, + {"adrf5730", (kernel_ulong_t)&adrf57x0_chip_info}, + {"adrf5731", (kernel_ulong_t)&adrf5731_chip_info}, + {"hmc271a", (kernel_ulong_t)&hmc271_chip_info}, {"hmc792a", (kernel_ulong_t)&hmc792_chip_info}, + {"hmc1018a", (kernel_ulong_t)&hmc1018_chip_info}, + {"hmc1019a", (kernel_ulong_t)&hmc1019_chip_info}, {"hmc1119", (kernel_ulong_t)&hmc1119_chip_info}, { } }; @@ -264,7 +325,13 @@ static const struct of_device_id ad8366_of_match[] =3D= { { .compatible =3D "adi,ad8366", .data =3D &ad8366_chip_info }, { .compatible =3D "adi,ada4961", .data =3D &ada4961_chip_info }, { .compatible =3D "adi,adl5240", .data =3D &adl5240_chip_info }, + { .compatible =3D "adi,adrf5720", .data =3D &adrf57x0_chip_info }, + { .compatible =3D "adi,adrf5730", .data =3D &adrf57x0_chip_info }, + { .compatible =3D "adi,adrf5731", .data =3D &adrf5731_chip_info }, + { .compatible =3D "adi,hmc271a", .data =3D &hmc271_chip_info }, { .compatible =3D "adi,hmc792a", .data =3D &hmc792_chip_info }, + { .compatible =3D "adi,hmc1018a", .data =3D &hmc1018_chip_info }, + { .compatible =3D "adi,hmc1019a", .data =3D &hmc1019_chip_info }, { .compatible =3D "adi,hmc1119", .data =3D &hmc1119_chip_info }, { } }; --=20 2.43.0