iio: amplifiers: add support for ADL8113 Low Noise Amplifier
Antoniu Miclaus
maintainerv6 cover iio: amplifiers: add support for ADL8113 Low Noise Amplifier
This patch series adds support for the Analog Devices ADL8113, a 10MHz to 12GHz Low Noise Amplifier with integrated bypass switches.
The ADL8113 provides four operation modes controlled by two GPIO pins:
- Internal Amplifier (14dB gain)
- Internal Bypass (-2dB insertion loss)
- External Bypass A (configurable gain) - Signal routes from RFIN to OUT_A and from IN_A to RFOUT
- External Bypass B (configurable gain) - Signal routes from RFIN to OUT_B and from IN_B to RFOUT
The driver allows selecting between these paths via the IIO hardwaregain attribute, with optional external amplifier gains configured through device tree properties.
Antoniu Miclaus (2):
dt-bindings: iio: amplifiers: add adl8113
iio: amplifiers: adl8113: add driver support
.../bindings/iio/amplifiers/adi,adl8113.yaml | 87 ++++++ drivers/iio/amplifiers/Kconfig | 12 + drivers/iio/amplifiers/Makefile | 1 + drivers/iio/amplifiers/adl8113.c | 290 ++++++++++++++++++ 4 files changed, 390 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/amplifiers/adi,adl8113.yaml create mode 100644 drivers/iio/amplifiers/adl8113.c
Signature · 1 line
2.43.0
Antoniu Miclaus
maintainerPATCH v6 1/2 dt-bindings: iio: amplifiers: add adl8113
Add devicetree bindings for adl8113.
---
changes in v6:
- Use items list for ctrl-gpios instead of minItems/maxItems
- Simplify ctrl-gpios item descriptions (remove GPIO_ACTIVE_HIGH mentions)
- Remove maxItems (implied by items list)
.../bindings/iio/amplifiers/adi,adl8113.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/amplifiers/adi,adl8113.yaml
Documentation/devicetree/bindings/iio/amplifiers/adi,adl8113.yaml new file +87 -0
@@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/amplifiers/adi,adl8113.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices ADL8113 Low Noise Amplifier with integrated bypass switches + +maintainers: + - Antoniu Miclaus <[email protected]> + +description: | + The ADL8113 is a 10MHz to 12GHz Low Noise Amplifier with integrated bypass + switches controlled by two GPIO pins (VA and VB). The device supports four + operation modes: + - Internal Amplifier: VA=0, VB=0 - Signal passes through the internal LNA + - Internal Bypass: VA=1, VB=1 - Signal bypasses through internal path + - External Bypass A: VA=0, VB=1 - Signal routes from RFIN to OUT_A and from IN_A to RFOUT + - External Bypass B: VA=1, VB=0 - Signal routes from RFIN to OUT_B and from IN_B to RFOUT + + https://www.analog.com/en/products/adl8113.html + +properties: + compatible: + const: adi,adl8113 + + vdd1-supply: true + + vdd2-supply: true + + vss2-supply: true + + ctrl-gpios: + items: + - description: VA control pin + - description: VB control pin + + adi,external-bypass-a-gain-db: + description: + Gain in dB of external amplifier connected to bypass path A (OUT_A/IN_A). + When specified, this gain value becomes selectable via the hardwaregain + attribute and automatically routes through the external A path. + + adi,external-bypass-b-gain-db: + description: + Gain in dB of external amplifier connected to bypass path B (OUT_B/IN_B). + When specified, this gain value becomes selectable via the hardwaregain + attribute and automatically routes through the external B path. + +required: + - compatible + - ctrl-gpios + - vdd1-supply + - vdd2-supply + - vss2-supply + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + /* Basic configuration with only internal paths */ + amplifier { + compatible = "adi,adl8113"; + ctrl-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>, + <&gpio 23 GPIO_ACTIVE_HIGH>; + vdd1-supply = <&vdd1_5v>; + vdd2-supply = <&vdd2_3v3>; + vss2-supply = <&vss2_neg>; + }; + + - | + #include <dt-bindings/gpio/gpio.h> + + /* Configuration with external bypass amplifiers */ + amplifier { + compatible = "adi,adl8113"; + ctrl-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>, + <&gpio 25 GPIO_ACTIVE_HIGH>; + vdd1-supply = <&vdd1_5v>; + vdd2-supply = <&vdd2_3v3>; + vss2-supply = <&vss2_neg>; + adi,external-bypass-a-gain-db = <20>; /* 20dB external amp on path A */ + adi,external-bypass-b-gain-db = <6>; /* 6dB external amp on path B */ + }; +...
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerRe: [PATCH v6 1/2] dt-bindings: iio: amplifiers: add adl8113
Quoted 1 line · On Fri, 5 Dec 2025 16:40:40 +0200 Antoniu Miclaus <[email protected]>…
Add devicetree bindings for adl8113.
If you roll a v7 I'd add some description of the 'interesting' bit in here - which is the gains for the two external bypass paths. I like the solution but i would like more eyes to focus on that!
Other than that this looks good to me. Maybe I'll add something to this description if I apply this version.
Jonathan
Quoted 105 lines
Signed-off-by Antoniu Miclaus <[email protected]>---
changes in v6:
- Use items list for ctrl-gpios instead of minItems/maxItems
- Simplify ctrl-gpios item descriptions (removeGPIO_ACTIVE_HIGHmentions)
- Remove maxItems (implied by items list).../bindings/iio/amplifiers/adi,adl8113.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/amplifiers/adi,adl8113.yamlDocumentation/devicetree/bindings/iio/amplifiers/adi,adl8113.yaml new file +87
-0@@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/amplifiers/adi,adl8113.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices ADL8113 Low Noise Amplifier with integrated bypass switches + +maintainers: + - Antoniu Miclaus <[email protected]> + +description: | + The ADL8113 is a 10MHz to 12GHz Low Noise Amplifier with integrated bypass + switches controlled by two GPIO pins (VA and VB). The device supports four + operation modes: + - Internal Amplifier: VA=0, VB=0 - Signal passes through the internal LNA + - Internal Bypass: VA=1, VB=1 - Signal bypasses through internal path + - External Bypass A: VA=0, VB=1 - Signal routes from RFIN to OUT_A and from IN_A to RFOUT + - External Bypass B: VA=1, VB=0 - Signal routes from RFIN to OUT_B and from IN_B to RFOUT + + https://www.analog.com/en/products/adl8113.html + +properties: + compatible: + const: adi,adl8113 + + vdd1-supply: true + + vdd2-supply: true + + vss2-supply: true + + ctrl-gpios: + items: + - description: VA control pin + - description: VB control pin + + adi,external-bypass-a-gain-db: + description: + Gain in dB of external amplifier connected to bypass path A (OUT_A/IN_A). + When specified, this gain value becomes selectable via the hardwaregain + attribute and automatically routes through the external A path. + + adi,external-bypass-b-gain-db: + description: + Gain in dB of external amplifier connected to bypass path B (OUT_B/IN_B). + When specified, this gain value becomes selectable via the hardwaregain + attribute and automatically routes through the external B path. + +required: + - compatible + - ctrl-gpios + - vdd1-supply + - vdd2-supply + - vss2-supply + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + /* Basic configuration with only internal paths */ + amplifier { + compatible = "adi,adl8113"; + ctrl-gpios = <&gpio 22 GPIO_ACTIVE_HIGH>, + <&gpio 23 GPIO_ACTIVE_HIGH>; + vdd1-supply = <&vdd1_5v>; + vdd2-supply = <&vdd2_3v3>; + vss2-supply = <&vss2_neg>; + }; + + - | + #include <dt-bindings/gpio/gpio.h> + + /* Configuration with external bypass amplifiers */ + amplifier { + compatible = "adi,adl8113"; + ctrl-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>, + <&gpio 25 GPIO_ACTIVE_HIGH>; + vdd1-supply = <&vdd1_5v>; + vdd2-supply = <&vdd2_3v3>; + vss2-supply = <&vss2_neg>; + adi,external-bypass-a-gain-db = <20>; /* 20dB external amp on path A */ + adi,external-bypass-b-gain-db = <6>; /* 6dB external amp on path B */ + }; +...
Re: [PATCH v6 1/2] dt-bindings: iio: amplifiers: add adl8113
In reply to Antoniu MiclausQuoted 9 lines · Antoniu Miclaus
Add devicetree bindings for adl8113.
Signed-off-by Antoniu Miclaus <[email protected]>---
changes in v6:
- Use items list for ctrl-gpios instead of minItems/maxItems
- Simplify ctrl-gpios item descriptions (removeGPIO_ACTIVE_HIGHmentions)
- Remove maxItems (implied by items list)
Quoted 4 lines
.../bindings/iio/amplifiers/adi,adl8113.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/amplifiers/adi,adl8113.yaml
Antoniu Miclaus
maintainerPATCH v6 2/2 iio: amplifiers: adl8113: add driver support
In reply to Antoniu MiclausAdd support for adl8113 10MHz to 12GHz Low Noise Amplifier with 10MHz to 14GHz bypass switches.
---
no changes in v6.
drivers/iio/amplifiers/Kconfig | 12 ++ drivers/iio/amplifiers/Makefile | 1 + drivers/iio/amplifiers/adl8113.c | 290 +++++++++++++++++++++++++++++++ 3 files changed, 303 insertions(+) create mode 100644 drivers/iio/amplifiers/adl8113.c
drivers/iio/amplifiers/Kconfig +12 -0
@@ -36,6 +36,18 @@ config ADA4250 To compile this driver as a module, choose M here: the module will be called ada4250. +config ADL8113 + tristate "Analog Devices ADL8113 Low Noise Amplifier" + depends on GPIOLIB + help + Say yes here to build support for Analog Devices ADL8113 Low Noise + Amplifier with integrated bypass switches. The device supports four + operation modes controlled by GPIO pins: internal amplifier, + internal bypass, and two external bypass modes. + + To compile this driver as a module, choose M here: the + module will be called adl8113. + config HMC425 tristate "Analog Devices HMC425A and similar GPIO Gain Amplifiers" depends on GPIOLIB
drivers/iio/amplifiers/Makefile +1 -0
@@ -6,4 +6,5 @@ # When adding new entries keep the list in alphabetical order obj-$(CONFIG_AD8366) += ad8366.o obj-$(CONFIG_ADA4250) += ada4250.o +obj-$(CONFIG_ADL8113) += adl8113.o obj-$(CONFIG_HMC425) += hmc425a.o
drivers/iio/amplifiers/adl8113.c new file +290 -0
290 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support
Quoted 2 lines · Antoniu Miclaus
Add support for adl8113 10MHz to 12GHz Low Noise Amplifier with 10MHz to 14GHz bypass switches.
...
Quoted 1 line
no changes in v6.
This is surprisingly interesting.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support
In reply to Antoniu MiclausQuoted 5 lines · On Fri, 5 Dec 2025 16:40:41 +0200 Antoniu Miclaus <[email protected]>…
Add support for adl8113 10MHz to 12GHz Low Noise Amplifier with 10MHz to 14GHz bypass switches.
Signed-off-by Antoniu Miclaus <[email protected]>---
Hi Antoniu,
Quoted 1 line
no changes in v6.
Given I assume you just missed Andy's prior review I'll take a look at this version with assumption both sets of comments will be sorted for v7.
A few things inline.
drivers/iio/amplifiers/adl8113.c line 32
Quoted 11 lines
drivers/iio/amplifiers/adl8113.c new file +5
-0+struct adl8113_gain_config { +enum adl8113_signal_path path; +int gain_db; +int va; +int vb;
What are va and vb for? Currently seem unused because you derive them from path at use point.
drivers/iio/amplifiers/adl8113.c line 157
Quoted 13 lines
drivers/iio/amplifiers/adl8113.c new file +10
-0+}; + +static const struct iio_info adl8113_info = { + .read_raw = adl8113_read_raw, + .write_raw = adl8113_write_raw, +}; + +static int adl8113_init_gain_configs (struct device *dev,struct adl8113_state *st) +{ +int external_a_gain, external_b_gain, i =0 , j;
Preference for not hiding initializations in a list where only one is initialized.
int external_a_gain, external_b_gain, j; int i = 0;
makes it easier to spot.
drivers/iio/amplifiers/adl8113.c line 165
Quoted 8 lines
drivers/iio/amplifiers/adl8113.c new file +8
-0+ +/* +* Allocate for all 4 possible paths: +* - Internal amp and bypass (always present) +* - External bypass A and B (optional, or INT_MIN for testing) +*/ + st->gain_configs =devm_kcalloc (dev,4 , +sizeof (*st->gain_configs),GFP_KERNEL );
Slightly odd wrap. I'd move the sizeof() up a line.
drivers/iio/amplifiers/adl8113.c line 171
Quoted 6 lines
drivers/iio/amplifiers/adl8113.c new file +6
-0+if (!st->gain_configs) +return -ENOMEM ; + +/* Always include internal amplifier (14dB) */ + st->gain_configs[i].path =ADL8113_INTERNAL_AMP ; + st->gain_configs[i].gain_db =14 ;
Could do this as something like:
st->gain_configs[i++] = (struct adl8113_gain_config) {
.path = ADL8113_INTERNAL_AMP,
.gain_db = 14,
};
st->gain_configs[i++] = (struct adl8113_gain_config) {
.path = ADL8113_INTERNAL_BYPASS,
.gain_db = -2,
};etc.
Quoted 16 lines
drivers/iio/amplifiers/adl8113.c new file +16
-0+ i++; + +/* Always include internal bypass (-2dB insertion loss) */ + st->gain_configs[i].path =ADL8113_INTERNAL_BYPASS ; + st->gain_configs[i].gain_db =-2 ; + i++; + +/* Add external bypass A if configured */ +if (!device_property_read_u32 (dev,"adi,external-bypass-a-gain-db" , + &external_a_gain)) { + st->gain_configs[i].path =ADL8113_EXTERNAL_A ; + st->gain_configs[i].gain_db = external_a_gain; + i++; + } + +/* Add external bypass B if configured */
drivers/iio/amplifiers/adl8113.c line 197
Quoted 10 lines
drivers/iio/amplifiers/adl8113.c new file +10
-0+if (!device_property_read_u32 (dev,"adi,external-bypass-b-gain-db" , + &external_b_gain)) { + st->gain_configs[i].path =ADL8113_EXTERNAL_B ; + st->gain_configs[i].gain_db = external_b_gain; + i++; + } + +/* +* If there's a free external bypass path, add one with INT_MIN gain +* to represent "nothing connected" for testing purposes
I don't follow this one. What sort of testing purpose? Something we want in a real system?
Quoted 10 lines
drivers/iio/amplifiers/adl8113.c new file +10
-0+*/ +if (!device_property_present (dev,"adi,external-bypass-a-gain-db" )) { + st->gain_configs[i].path =ADL8113_EXTERNAL_A ; + st->gain_configs[i].gain_db =INT_MIN ; + i++; + }else if (!device_property_present (dev,"adi,external-bypass-b-gain-db" )) { + st->gain_configs[i].path =ADL8113_EXTERNAL_B ; + st->gain_configs[i].gain_db =INT_MIN ; + i++; + }
drivers/iio/amplifiers/adl8113.c line 217
Quoted 10 lines
drivers/iio/amplifiers/adl8113.c new file +10
-0+ + st->num_gain_configs = i; + +/* Check for duplicate gain values */ +for (i =0 ; i < st->num_gain_configs -1 ; i++) { +for (j = i +1 ; j < st->num_gain_configs; j++) { +if (st->gain_configs[i].gain_db == st->gain_configs[j].gain_db) +return dev_err_probe (dev, -EINVAL , +"Duplicate gain values not allowed: %d dB\n" , + st->gain_configs[i].gain_db);
What happens if we just don't bother enforcing this? I assume the second of the duplicates can't be selected? Do we care beyond it being silly?
Quoted 5 lines
drivers/iio/amplifiers/adl8113.c new file +5
-0+ } + } + +return 0 ; +}
Re: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support
Quoted 2 lines · Jonathan Cameron
On Fri, 5 Dec 2025 16:40:41 +0200
Antoniu Miclaus <[email protected]> wrote:
...
Quoted 5 lines
drivers/iio/amplifiers/adl8113.c line 171
Quoted 3 lines
drivers/iio/amplifiers/adl8113.c new file +3
-0+/* Always include internal amplifier (14dB) */ + st->gain_configs[i].path =ADL8113_INTERNAL_AMP ; + st->gain_configs[i].gain_db =14 ;Could do this as something like:
I remember a discussion where it was against this approach due to compiler warnings or so. However, IIRC, there was slightly different pattern, i.e.
foo[i].bar = ... foo[i++].baz = ...
That said, I have no objection to your proposal, but we need to use it with a good compile test coverage (clang with make W=1 for a starter.
OTOH, the original code is robust enough...
Quoted 4 lines
st->gain_configs[i++] = (struct adl8113_gain_config) {
.path = ADL8113_INTERNAL_AMP,
.gain_db = 14,
};...and doesn't require a good understanding of differences between designated initialisers and compound literals.
Quoted 4 lines
st->gain_configs[i++] = (struct adl8113_gain_config) {
.path = ADL8113_INTERNAL_BYPASS,
.gain_db = -2,
};Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support
Quoted 12 lines · On Sat, 6 Dec 2025 22:48:19 +0200 Andy Shevchenko…
Quoted 2 lines · Jonathan Cameron
On Fri, 5 Dec 2025 16:40:41 +0200
Antoniu Miclaus <[email protected]> wrote:...
Quoted 5 lines
drivers/iio/amplifiers/adl8113.c line 171
Quoted 3 lines
drivers/iio/amplifiers/adl8113.c new file +3
-0+/* Always include internal amplifier (14dB) */ + st->gain_configs[i].path =ADL8113_INTERNAL_AMP ; + st->gain_configs[i].gain_db =14 ;Could do this as something like:
Quoted 8 lines
I remember a discussion where it was against this approach due to compiler warnings or so. However, IIRC, there was slightly different pattern, i.e.
foo[i].bar = ... foo[i++].baz = ...That said, I have no objection to your proposal, but we need to use it with a good compile test coverage (clang with
make W=1for a starter.
That's my standard 1st build choice now because it seems to be fussiest ;) I haven't tried this one however.
Googling came up with a link saying GCC gives warnings on cases where not all structure elements are set. I think they always should be here though which may make this fine (and act as a correct warning if they aren't). That only works if the two uninitialized structure elements are dropped obviously!
Quoted 10 lines
OTOH, the original code is robust enough...
Quoted 4 lines
st->gain_configs[i++] = (struct adl8113_gain_config) { .path = ADL8113_INTERNAL_AMP, .gain_db = 14, };...and doesn't require a good understanding of differences between designated initialisers and compound literals.
Fair enough. Original is better than the i++ in only the second in my view.
Jonathan
Quoted 7 lines
Quoted 5 lines
st->gain_configs[i++] = (struct adl8113_gain_config) { .path = ADL8113_INTERNAL_BYPASS, .gain_db = -2, };
Miclaus, Antoniu
maintainerRE: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support
In reply to Jonathan CameronHi,
Quoted 36 lines
Could do this as something like:
st->gain_configs[i++] = (struct adl8113_gain_config) { .path = ADL8113_INTERNAL_AMP, .gain_db = 14, }; st->gain_configs[i++] = (struct adl8113_gain_config) { .path = ADL8113_INTERNAL_BYPASS, .gain_db = -2, };etc.
Quoted 21 lines
drivers/iio/amplifiers/adl8113.c new file +21
-0+ i++; + +/* Always include internal bypass (-2dB insertion loss) */ + st->gain_configs[i].path =ADL8113_INTERNAL_BYPASS ; + st->gain_configs[i].gain_db =-2 ; + i++; + +/* Add external bypass A if configured */ +if (!device_property_read_u32 (dev,"adi,external-bypass-a-gain-db" , + &external_a_gain)) { + st->gain_configs[i].path =ADL8113_EXTERNAL_A ; + st->gain_configs[i].gain_db = external_a_gain; + i++; + } + +/* Add external bypass B if configured */ +if (!device_property_read_u32 (dev,"adi,external-bypass-b-gain-db" , + &external_b_gain)) { + st->gain_configs[i].path =ADL8113_EXTERNAL_B ; + st->gain_configs[i].gain_db = external_b_gain; + i++;
Quoted 8 lines
drivers/iio/amplifiers/adl8113.c line 197
Quoted 5 lines
drivers/iio/amplifiers/adl8113.c new file +5
-0+ } + +/* +* If there's a free external bypass path, add one with INT_MIN gain +* to represent "nothing connected" for testing purposes I don't follow this one. What sort of testing purpose? Something we want in a real system?
This addition was suggested by David in v4. But I can revert it in the next series.
Regards,
Antoniu
Jonathan Cameron
maintainerRe: [PATCH v6 2/2] iio: amplifiers: adl8113: add driver support
Quoted 45 lines · Antoniu
Hi,
Quoted 36 lines
Could do this as something like:
st->gain_configs[i++] = (struct adl8113_gain_config) { .path = ADL8113_INTERNAL_AMP, .gain_db = 14, }; st->gain_configs[i++] = (struct adl8113_gain_config) { .path = ADL8113_INTERNAL_BYPASS, .gain_db = -2, };etc.
Quoted 21 lines
drivers/iio/amplifiers/adl8113.c new file +21
-0+ i++; + +/* Always include internal bypass (-2dB insertion loss) */ + st->gain_configs[i].path =ADL8113_INTERNAL_BYPASS ; + st->gain_configs[i].gain_db =-2 ; + i++; + +/* Add external bypass A if configured */ +if (!device_property_read_u32 (dev,"adi,external-bypass-a-gain-db" , + &external_a_gain)) { + st->gain_configs[i].path =ADL8113_EXTERNAL_A ; + st->gain_configs[i].gain_db = external_a_gain; + i++; + } + +/* Add external bypass B if configured */ +if (!device_property_read_u32 (dev,"adi,external-bypass-b-gain-db" , + &external_b_gain)) { + st->gain_configs[i].path =ADL8113_EXTERNAL_B ; + st->gain_configs[i].gain_db = external_b_gain; + i++;Quoted 8 lines
drivers/iio/amplifiers/adl8113.c line 197
Quoted 5 lines
drivers/iio/amplifiers/adl8113.c new file +5
-0+ } + +/* +* If there's a free external bypass path, add one with INT_MIN gain +* to represent "nothing connected" for testing purposes I don't follow this one. What sort of testing purpose? Something we want in a real system?
Quoted 1 line
This addition was suggested by David in v4. But I can revert it in the next series.
Ok. I looked back and found it. I don't mind this feature with more explanation. However, I'm not sure it's actually useful other than for replicating figure 121 on the datasheet which I can't really see as particularly useful for testing. Mind you I've no real idea how these are used :)
Jonathan
Quoted 3 lines
Regards,
Antoniu