Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: amplifiers: hmc425a: Add Support HMC540S 4-bit Attenuator

This adds support for the Analog Devices HMC540s 1 dB LSB
Silicon MMIC 4-Bit Digital Positive Control Attenuator, 0.1 - 8 GHz

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Ana-Maria Cusco <ana-maria.cusco@analog.com>
Link: https://lore.kernel.org/r/20230816110906.144540-1-ana-maria.cusco@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Michael Hennerich and committed by
Jonathan Cameron
77865a8f 711fb79a

+17
+17
drivers/iio/amplifiers/hmc425a.c
··· 21 21 22 22 enum hmc425a_type { 23 23 ID_HMC425A, 24 + ID_HMC540S, 24 25 }; 25 26 26 27 struct hmc425a_chip_info { ··· 71 70 case ID_HMC425A: 72 71 gain = ~code * -500; 73 72 break; 73 + case ID_HMC540S: 74 + gain = ~code * -1000; 75 + break; 74 76 } 75 77 76 78 *val = gain / 1000; ··· 109 105 switch (st->type) { 110 106 case ID_HMC425A: 111 107 code = ~((abs(gain) / 500) & 0x3F); 108 + break; 109 + case ID_HMC540S: 110 + code = ~((abs(gain) / 1000) & 0xF); 112 111 break; 113 112 } 114 113 ··· 164 157 /* Match table for of_platform binding */ 165 158 static const struct of_device_id hmc425a_of_match[] = { 166 159 { .compatible = "adi,hmc425a", .data = (void *)ID_HMC425A }, 160 + { .compatible = "adi,hmc540s", .data = (void *)ID_HMC540S }, 167 161 {}, 168 162 }; 169 163 MODULE_DEVICE_TABLE(of, hmc425a_of_match); ··· 178 170 .gain_min = -31500, 179 171 .gain_max = 0, 180 172 .default_gain = -0x40, /* set default gain -31.5db*/ 173 + }, 174 + [ID_HMC540S] = { 175 + .name = "hmc540s", 176 + .channels = hmc425a_channels, 177 + .num_channels = ARRAY_SIZE(hmc425a_channels), 178 + .num_gpios = 4, 179 + .gain_min = -15000, 180 + .gain_max = 0, 181 + .default_gain = -0x10, /* set default gain -15.0db*/ 181 182 }, 182 183 }; 183 184