Skip to content

Conversation

@rodrigo455
Copy link
Collaborator

@rodrigo455 rodrigo455 commented Nov 21, 2025

PR Description

This series modernizes the AD8366 amplifier/attenuator driver and adds support for additional device variants.

  • Adds support for HMC271 (legacy/obsolete part maintained in ADI tree)
  • 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
  • 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

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

This patch series modernizes the AD8366 amplifier/attenuator driver with
several improvements and adds support for additional device variants.

Device Support Expansion:
- Adds support for HMC271 (legacy/obsolete part maintained in ADI tree)
- 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
- 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

# 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.

Signed-off-by: Rodrigo Alencar <[email protected]>

--- b4-submit-tracking ---
# This section is used internally by b4 prep for tracking purposes.
{
  "series": {
    "revision": 1,
    "change-id": "20251121-iio-ad8366-update-56abac58bbca",
    "prefixes": []
  }
}
@rodrigo455 rodrigo455 marked this pull request as draft November 21, 2025 16:56
@rodrigo455 rodrigo455 force-pushed the staging/jic23_iio_ad8366-update branch from 378f2b8 to df90254 Compare November 21, 2025 17:08
@github-actions github-actions bot force-pushed the mirror_ci/jic23/iio/testing branch 3 times, most recently from 573459b to 3982c2b Compare November 23, 2025 23:59
Copy link
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

* HMC1119 0.25 dB LSB, 7-Bit, Silicon Digital Attenuator
*
* Copyright 2012-2019 Analog Devices Inc.
* Copyright 2012-2021 Analog Devices Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are changing this, better to update to the current year :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a later commit performs the update. I haven't modified the commits I cherry-picked

}

st->enable_gpio = devm_gpiod_get(&spi->dev, "enable",
GPIOD_OUT_HIGH);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really mandatory? Im also not seeing it being used anywhere so I kind of wonder why do we need it and how is it different from the reset gpio (I have not looked into the datasheet)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is optional, will fix it. apparently only a few of those may have reset/enable pins, most of them do not.

break;
case ID_ADRF5731:
gain = -30000 + code * 500;
gain = -1 * code * 500;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the first patch in the series. Fixes go first since we want to backport them and do not want to depend on additional patches

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one goes right after the support added to ADRF573x, no?
I cherry-picked Michael's commits, haven't changed them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, if this is fixing a patch in this series, just squash it then. It does not make sense (from an upstream perspective,) to send a patch with a bug to then fix it in the same patch series.

@@ -0,0 +1,98 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on the commit subject. Don't mention "binding" in the subject. It is already obvious and the maintainers will complain it. See the git log for examples. Also, the binding should come before the driver changes.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of changes for one patch. Do one logical change per patch if you really want to modernize it.

st->enable_gpio = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(st->enable_gpio))
return dev_err_probe(&spi->dev, PTR_ERR(st->enable_gpio),
"Failed to get enable GPIO\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to go into the patch adding this. Does not make sense to only fix it now

{ .compatible = "adi,hmc792a" },
{ .compatible = "adi,hmc1018a" },
{ .compatible = "adi,hmc1019a" },
{ .compatible = "adi,hmc1119" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are adding this, you might get asked to remove the enum (for the device ID) and have a struct per model. It is the preferred way in IIO

rodrigo455 and others added 5 commits November 24, 2025 13:53
Add device tree binding documentation for amplifiers and digital
attenuators. This covers different device variants with similar
SPI control.

Signed-off-by: Rodrigo Alencar <[email protected]>
This patch adds support for 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

Co-authored-by: Alexandru Ardelean <[email protected]>
Co-authored-by: Michael Hennerich <[email protected]>
Signed-off-by: Alexandru Ardelean <[email protected]>
Signed-off-by: Michael Hennerich <[email protected]>
Signed-off-by: Rodrigo Alencar <[email protected]>
use guard() from cleanup for mutex locking.
replace mutex_init() for devm_mutex_init().

Signed-off-by: Rodrigo Alencar <[email protected]>
Device resource managed simplified with:
- voltage regulator managed 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.

Also, dev_err_probe() is used to report probe errors.

Signed-off-by: Rodrigo Alencar <[email protected]>
device-tree support achieved dropping the enum ID in favor of the
chip info table. With this, switch cases on the device type were dropped.

Signed-off-by: Rodrigo Alencar <[email protected]>
@rodrigo455 rodrigo455 force-pushed the staging/jic23_iio_ad8366-update branch from df90254 to 02e319f Compare November 24, 2025 18:09
@github-actions github-actions bot force-pushed the mirror_ci/jic23/iio/testing branch from 3982c2b to e333a0d Compare November 24, 2025 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants