AD8366 Driver upstream update#3026
Closed
rodrigo455 wants to merge 22 commits intomirror_ci/jic23/iio/testingfrom
Closed
AD8366 Driver upstream update#3026rodrigo455 wants to merge 22 commits intomirror_ci/jic23/iio/testingfrom
rodrigo455 wants to merge 22 commits intomirror_ci/jic23/iio/testingfrom
Conversation
378f2b8 to
df90254
Compare
573459b to
3982c2b
Compare
nunojsa
reviewed
Nov 24, 2025
Collaborator
nunojsa
left a comment
There was a problem hiding this comment.
You should still add your sob tag for Michael's patches. If you actually change them in any meaningful way you should add co-authored-by tag. See git log for examples
df90254 to
02e319f
Compare
7770c62 to
7dea437
Compare
c477eb9 to
289f20e
Compare
4882618 to
d6de80f
Compare
1733322 to
439d0e8
Compare
b338055 to
4eff7cb
Compare
nunojsa
reviewed
Jan 18, 2026
Collaborator
nunojsa
left a comment
There was a problem hiding this comment.
Just some minor stuff. Feel free to send the patches
| F: Documentation/devicetree/bindings/iio/adc/adi,ad7780.yaml | ||
| F: drivers/iio/adc/ad7780.c | ||
|
|
||
| ANALOG DEVICES INC AD8366 DRIVER |
Collaborator
There was a problem hiding this comment.
Not really related to the change but on the commit message replace: s/fragment/entry
| * HMC1119 0.25 dB LSB, 7-Bit, Silicon Digital Attenuator | ||
| * | ||
| * Copyright 2012-2019 Analog Devices Inc. | ||
| * Copyright 2012-2026 Analog Devices Inc. |
Collaborator
There was a problem hiding this comment.
Could mention this change in the commit message
| .gain_max = 20500, | ||
| .gain_step = 253, | ||
| .num_channels = 2, | ||
| .pack_code = ad8366_pack_code, |
Collaborator
There was a problem hiding this comment.
Note that given that you're doing the above, you might be asked to ditch the array in favor of dedicated variables (that is the preferred way in IIO).
Not all backends support the full set of capabilities provided by the industrialio-backend framework. Capability bits can be used in frontends and backends for checking for a certain feature set, or if using related functions can be expected to fail. Capability bits should be set by a compatible backend and provided when registering the backend. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
axi-adc and axi-ad485x backend variants provide calibration support, whereas the axi-ad408x does not. Set accordingly. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Backends support the buffer/enable capabilities so advertise it while registering in case a frontend makes checks for it. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This backend supports the added CAP_ENABLE capability. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Create alias for the device pointer to simplify referencing and keeping syntax and column width shorter. Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add capability checks for operation with backends that do not necessarily support full set of features, but are otherwise compatible with the device. This ensures a fully functional device, but with limited capabilities. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The hx9023s requires a firmware blob containing board-specific configuration data used to initialize its internal sensing engine. Although the silicon is identical across platforms, different products may use different electrode layouts, PCB routing, cover materials and mechanical stack-ups. These physical differences require distinct calibration parameters and register configuration tables in order for the sensor to operate correctly. The driver has always required firmware and historically assumed a single default firmware file name suitable for the reference design. However, this assumption does not hold for boards with different physical sensor layouts. The default firmware file name remains unchanged and continues to be used for existing platforms. Allowing the firmware file name to be specified via device tree enables selecting the appropriate hardware-specific configuration when the board design differs. This property does not change the existing ABI and is optional. Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add an optional firmware-name property to specify the firmware file. If not provided, the driver falls back to the default firmware name. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
devm_kzalloc() returns NULL on allocation failure. The appropriate error code for this condition is -ENOMEM, not -EINVAL. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
adf4350_parse_dt() returns NULL only when devm_kzalloc() fails. The caller should return -ENOMEM in this case, not -EINVAL. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch series updates the AD8366 amplifier/attenuator driver with modern device resource management, including support for additional device variants. Adds support for multiple digital step attenuators: - 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 - HMC271A: 1 dB LSB, 5-bit, Digital Attenuator, 0.7 - 3.7 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 Device Tree Support: - Adds device tree binding documentation - Adds device tree compatible strings for all supported devices - Favor chip info tables over device type. # Describe the purpose of this series. The information you put here # will be used by the project maintainer to make a decision whether # your patches should be reviewed, and in what priority order. Please be # very detailed and link to any relevant discussions or sites that the # maintainer can review to better understand your proposed changes. If you # only have a single patch in your series, the contents of the cover # letter will be appended to the "under-the-cut" portion of the patch. # Lines starting with # will be removed from the cover letter. You can # use them to add notes or reminders to yourself. If you want to use # markdown headers in your cover letter, start the line with ">#". # You can add trailers to the cover letter. Any email addresses found in # these trailers will be added to the addresses specified/generated # during the b4 send stage. You can also run "b4 prep --auto-to-cc" to # auto-populate the To: and Cc: trailers based on the code being # modified. To: linux-kernel@vger.kernel.org To: Michael Hennerich <michael.hennerich@analog.com> To: linux-iio@vger.kernel.org To: devicetree@vger.kernel.org Cc: Michael Hennerich <Michael.Hennerich@analog.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Jonathan Cameron <jic23@kernel.org> Cc: David Lechner <dlechner@baylibre.com> Cc: Nuno Sá <nuno.sa@analog.com> Cc: Andy Shevchenko <andy@kernel.org> Cc: Rob Herring <robh@kernel.org> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org> Cc: Conor Dooley <conor+dt@kernel.org> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com> --- Changes in v6: - EDITME: describe what is new in this series revision. - EDITME: use bulletpoints and terse descriptions. - Link to v5: https://lore.kernel.org/r/20260216-iio-ad8366-update-v5-0-7e6091357d02@analog.com Changes in v5: - Another review of include headers. - Reset changes going before regulator changes - Chip info table adjustments. - Consume enable gpio before the reset. - Link to v4: https://lore.kernel.org/r/20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com Changes in v4: - Review of included headers. - Split of device-tree support patch. - Consume reset controller rather than gpio. - Link to v3: https://lore.kernel.org/r/20260203-iio-ad8366-update-v3-0-5d5636b5181a@analog.com Changes in v3: - Add compatible checks for dt-binding gpio properties. - Remove reset and enable gpio from device state struct. - Split refactoring commits. - Drop part of the refactoring in favor of a cleaner diff. - Get included header files sorted. - Link to v2: https://lore.kernel.org/r/20260126-iio-ad8366-update-v2-0-c9a4d31aeb01@analog.com Changes in v2: - Reorganize commits with cleanups before features. - Link to v1: https://lore.kernel.org/r/20260119-iio-ad8366-update-v1-0-8044e23e964a@analog.com --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 6, "change-id": "20251121-iio-ad8366-update-56abac58bbca", "prefixes": [], "history": { "v1": [ "20260119-iio-ad8366-update-v1-0-8044e23e964a@analog.com" ], "v2": [ "20260126-iio-ad8366-update-v2-0-c9a4d31aeb01@analog.com" ], "v3": [ "20260203-iio-ad8366-update-v3-0-5d5636b5181a@analog.com" ], "v4": [ "20260210-iio-ad8366-update-v4-0-15505f7b15b4@analog.com" ], "v5": [ "20260216-iio-ad8366-update-v5-0-7e6091357d02@analog.com" ] } } }
Add maintainers entry for drivers/iio/amplifiers/ad8366.c Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
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 <conor.dooley@microchip.com> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
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 Adding the following missing headers: + linux/array_size.h: for ARRAY_SIZE + linux/bits.h: for BIT + linux/dev_printk.h: for dev_err + linux/math.h: for abs + linux/mutex.h: for mutex_lock, mutex_unlock + linux/mod_devicetable.h: for spi_device_id + linux/types.h for NULL, __aligned Additionally, those include directives are alphabetically sorted. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Create local device pointer in the probe function to shorten lines, making the code easier to read. The local device pointer replaces &spi->dev and will be reused across other probe function places in later patches. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Adopt proper mutex lifecycle with devm_mutex_init(), replacing mutex_init(). Mutex init is moved up (before regulator init), so that goto statement in the error path is avoided (which will be cleaned up later). Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
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 <rodrigo.alencar@analog.com>
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. The reset controller init is moved out from the switch case and optionally initialized for every device variant. Although not all devices have a reset pin the code does not need to change if it is not wired. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
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. The linux/array_size.h include is removed as number of channels is provided by chip info table. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Drop the enum ID, split chip info table into per-device structs and add of_match_table. Additionally, add 'name' field into the chip info struct, dropping the usage of spi_get_device_id(). Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
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 <rodrigo.alencar@analog.com>
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 <alexandru.ardelean@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Co-developed-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
This series modernizes the AD8366 amplifier/attenuator driver and adds support for additional device variants.
Device Tree Support:
PR Type
PR Checklist