[PATCH v4 11/11] iio: amplifiers: ad8366: update device support
From: Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org>
Date: 2026-02-10 19:42:18
Also in:
b4-sent, linux-iio, lkml
Subsystem:
analog devices inc ad8366 driver, analog devices inc iio drivers, iio subsystem and drivers, the rest · Maintainers:
Michael Hennerich, Rodrigo Alencar, Nuno Sá, Jonathan Cameron, Linus Torvalds
From: 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 <redacted> Signed-off-by: Alexandru Ardelean <redacted> Co-developed-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Reviewed-by: Andy Shevchenko <redacted> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com> --- 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 To compile this driver as a module, choose M here: the
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.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 40 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. */ #include <linux/bitrev.h>
@@ -55,6 +61,18 @@ static size_t ad8366_pack_code(struct ad8366_state *st) return sizeof(__be16); } +static size_t adrf5731_pack_code(struct ad8366_state *st) +{ + st->data[0] = st->ch[0] << 2; + return 1; +} + +static size_t hmc271_pack_code(struct ad8366_state *st) +{ + st->data[0] = bitrev8(st->ch[0]) >> 3; + return 1; +} + static const struct ad8366_info ad8366_chip_info = { .gain_min = 4500, .gain_max = 20500,
@@ -77,6 +95,29 @@ static const struct ad8366_info adl5240_chip_info = { .num_channels = 1, }; +static const struct ad8366_info adrf57x0_chip_info = { + .gain_min = -31500, + .gain_max = 0, + .gain_step = -500, + .num_channels = 1, +}; + +static const struct ad8366_info adrf5731_chip_info = { + .gain_min = -30000, + .gain_max = 0, + .gain_step = -2000, + .num_channels = 1, + .pack_code = adrf5731_pack_code, +}; + +static const struct ad8366_info hmc271_chip_info = { + .gain_min = -31000, + .gain_max = 0, + .gain_step = 1000, + .num_channels = 1, + .pack_code = hmc271_pack_code, +}; + static const struct ad8366_info hmc792_chip_info = { .gain_min = -15750, .gain_max = 0,
@@ -84,6 +125,20 @@ static const struct ad8366_info hmc792_chip_info = { .num_channels = 1, }; +static const struct ad8366_info hmc1018_chip_info = { + .gain_min = -31000, + .gain_max = 0, + .gain_step = 1000, + .num_channels = 1, +}; + +static const struct ad8366_info hmc1019_chip_info = { + .gain_min = -15500, + .gain_max = 0, + .gain_step = 500, + .num_channels = 1, +}; + static const struct ad8366_info hmc1119_chip_info = { .gain_min = -31750, .gain_max = 0,
@@ -254,7 +309,13 @@ static const struct spi_device_id ad8366_id[] = { {"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[] = { { .compatible = "adi,ad8366", .data = &ad8366_chip_info }, { .compatible = "adi,ada4961", .data = &ada4961_chip_info }, { .compatible = "adi,adl5240", .data = &adl5240_chip_info }, + { .compatible = "adi,adrf5720", .data = &adrf57x0_chip_info }, + { .compatible = "adi,adrf5730", .data = &adrf57x0_chip_info }, + { .compatible = "adi,adrf5731", .data = &adrf5731_chip_info }, + { .compatible = "adi,hmc271a", .data = &hmc271_chip_info }, { .compatible = "adi,hmc792a", .data = &hmc792_chip_info }, + { .compatible = "adi,hmc1018a", .data = &hmc1018_chip_info }, + { .compatible = "adi,hmc1019a", .data = &hmc1019_chip_info }, { .compatible = "adi,hmc1119", .data = &hmc1119_chip_info }, { } };
--
2.43.0