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: adc: ad7173: add support for ad4113

This commit adds support for the AD4113 ADC.
The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital
converter (ADC) that integrates an analog front end (AFE) for four
fully differential or eight single-ended inputs.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
Link: https://patch.msgid.link/20240812-ad4113-v3-3-046e785dd253@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Dumitru Ceclan and committed by
Jonathan Cameron
819b69ab 8a9687b3

+35 -1
+35 -1
drivers/iio/adc/ad7173.c
··· 3 3 * AD717x and AD411x family SPI ADC driver 4 4 * 5 5 * Supported devices: 6 - * AD4111/AD4112/AD4114/AD4115/AD4116 6 + * AD4111/AD4112/AD4113/AD4114/AD4115/AD4116 7 7 * AD7172-2/AD7172-4/AD7173-8/AD7175-2 8 8 * AD7175-8/AD7176-2/AD7177-2 9 9 * ··· 84 84 #define AD4111_ID AD7173_ID 85 85 #define AD4112_ID AD7173_ID 86 86 #define AD4114_ID AD7173_ID 87 + #define AD4113_ID 0x31d0 87 88 #define AD4116_ID 0x34d0 88 89 #define AD4115_ID 0x38d0 89 90 #define AD7175_8_ID 0x3cd0 ··· 171 170 bool has_temp; 172 171 /* ((AVDD1 − AVSS)/5) */ 173 172 bool has_pow_supply_monitoring; 173 + bool data_reg_only_16bit; 174 174 bool has_input_buf; 175 175 bool has_int_ref; 176 176 bool has_ref2; ··· 290 288 .has_temp = true, 291 289 .has_input_buf = true, 292 290 .has_current_inputs = true, 291 + .has_int_ref = true, 292 + .clock = 2 * HZ_PER_MHZ, 293 + .sinc5_data_rates = ad7173_sinc5_data_rates, 294 + .num_sinc5_data_rates = ARRAY_SIZE(ad7173_sinc5_data_rates), 295 + }; 296 + 297 + static const struct ad7173_device_info ad4113_device_info = { 298 + .name = "ad4113", 299 + .id = AD4113_ID, 300 + .num_voltage_in_div = 8, 301 + .num_channels = 16, 302 + .num_configs = 8, 303 + .num_voltage_in = 8, 304 + .num_gpios = 2, 305 + .data_reg_only_16bit = true, 306 + .higher_gpio_bits = true, 307 + .has_vincom_input = true, 308 + .has_input_buf = true, 293 309 .has_int_ref = true, 294 310 .clock = 2 * HZ_PER_MHZ, 295 311 .sinc5_data_rates = ad7173_sinc5_data_rates, ··· 1005 985 .update_scan_mode = ad7173_update_scan_mode, 1006 986 }; 1007 987 988 + static const struct iio_scan_type ad4113_scan_type = { 989 + .sign = 'u', 990 + .realbits = 16, 991 + .storagebits = 16, 992 + .endianness = IIO_BE, 993 + }; 994 + 1008 995 static const struct iio_chan_spec ad7173_channel_template = { 1009 996 .type = IIO_VOLTAGE, 1010 997 .indexed = 1, ··· 1253 1226 chan_st_priv->cfg.input_buf = st->info->has_input_buf; 1254 1227 chan_st_priv->cfg.ref_sel = AD7173_SETUP_REF_SEL_INT_REF; 1255 1228 st->adc_mode |= AD7173_ADC_MODE_REF_EN; 1229 + if (st->info->data_reg_only_16bit) 1230 + chan_arr[chan_index].scan_type = ad4113_scan_type; 1256 1231 1257 1232 chan_index++; 1258 1233 } ··· 1334 1305 chan->channel2 = ain[1]; 1335 1306 chan_st_priv->ain = AD7173_CH_ADDRESS(ain[0], ain[1]); 1336 1307 } 1308 + 1309 + if (st->info->data_reg_only_16bit) 1310 + chan_arr[chan_index].scan_type = ad4113_scan_type; 1337 1311 1338 1312 chan_index++; 1339 1313 } ··· 1466 1434 static const struct of_device_id ad7173_of_match[] = { 1467 1435 { .compatible = "adi,ad4111", .data = &ad4111_device_info }, 1468 1436 { .compatible = "adi,ad4112", .data = &ad4112_device_info }, 1437 + { .compatible = "adi,ad4113", .data = &ad4113_device_info }, 1469 1438 { .compatible = "adi,ad4114", .data = &ad4114_device_info }, 1470 1439 { .compatible = "adi,ad4115", .data = &ad4115_device_info }, 1471 1440 { .compatible = "adi,ad4116", .data = &ad4116_device_info }, ··· 1484 1451 static const struct spi_device_id ad7173_id_table[] = { 1485 1452 { "ad4111", (kernel_ulong_t)&ad4111_device_info }, 1486 1453 { "ad4112", (kernel_ulong_t)&ad4112_device_info }, 1454 + { "ad4113", (kernel_ulong_t)&ad4113_device_info }, 1487 1455 { "ad4114", (kernel_ulong_t)&ad4114_device_info }, 1488 1456 { "ad4115", (kernel_ulong_t)&ad4115_device_info }, 1489 1457 { "ad4116", (kernel_ulong_t)&ad4116_device_info },