from Analog Devices:
AD8366 Dual-Digital Variable Gain Amplifier (VGA)
ADA4961 BiCMOS RF Digital Gain Amplifier (DGA)
+ ADL5240 Digitally controlled variable gain amplifier (VGA)
To compile this driver as a module, choose M here: the
module will be called ad8366.
* This driver supports the following gain amplifiers:
* AD8366 Dual-Digital Variable Gain Amplifier (VGA)
* ADA4961 BiCMOS RF Digital Gain Amplifier (DGA)
+ * ADL5240 Digitally controlled variable gain amplifier (VGA)
*
* Copyright 2012-2019 Analog Devices Inc.
*/
enum ad8366_type {
ID_AD8366,
ID_ADA4961,
+ ID_ADL5240,
};
struct ad8366_info {
.gain_min = -6000,
.gain_max = 15000,
},
+ [ID_ADL5240] = {
+ .gain_min = -11500,
+ .gain_max = 20000,
+ },
};
static int ad8366_write(struct iio_dev *indio_dev,
case ID_ADA4961:
st->data[0] = ch_a & 0x1F;
break;
+ case ID_ADL5240:
+ st->data[0] = (ch_a & 0x3F);
+ break;
}
ret = spi_write(st->spi, st->data, indio_dev->num_channels);
case ID_ADA4961:
gain = 15000 - code * 1000;
break;
+ case ID_ADL5240:
+ gain = 20000 - 31500 + code * 500;
+ break;
}
/* Values in dB */
case ID_ADA4961:
code = (15000 - gain) / 1000;
break;
+ case ID_ADL5240:
+ code = ((gain - 500 - 20000) / 500) & 0x3F;
+ break;
}
mutex_lock(&st->lock);
indio_dev->num_channels = ARRAY_SIZE(ad8366_channels);
break;
case ID_ADA4961:
+ case ID_ADL5240:
st->reset_gpio = devm_gpiod_get(&spi->dev, "reset",
GPIOD_OUT_HIGH);
indio_dev->channels = ada4961_channels;
static const struct spi_device_id ad8366_id[] = {
{"ad8366", ID_AD8366},
{"ada4961", ID_ADA4961},
+ {"adl5240", ID_ADL5240},
{}
};
MODULE_DEVICE_TABLE(spi, ad8366_id);