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: adi-axi-adc: add interface type

Add support for getting the interface (CMOS or LVDS) used by the AXI ADC
IP.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://patch.msgid.link/20250214131955.31973-5-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
fc9156c0 22894e0b

+23
+23
drivers/iio/adc/adi-axi-adc.c
··· 40 40 #define ADI_AXI_REG_RSTN_MMCM_RSTN BIT(1) 41 41 #define ADI_AXI_REG_RSTN_RSTN BIT(0) 42 42 43 + #define ADI_AXI_ADC_REG_CONFIG 0x000c 44 + #define ADI_AXI_ADC_REG_CONFIG_CMOS_OR_LVDS_N BIT(7) 45 + 43 46 #define ADI_AXI_ADC_REG_CTRL 0x0044 44 47 #define ADI_AXI_ADC_CTRL_DDR_EDGESEL_MASK BIT(1) 45 48 ··· 313 310 ADI_AXI_REG_CHAN_CTRL_ENABLE); 314 311 } 315 312 313 + static int axi_adc_interface_type_get(struct iio_backend *back, 314 + enum iio_backend_interface_type *type) 315 + { 316 + struct adi_axi_adc_state *st = iio_backend_get_priv(back); 317 + unsigned int val; 318 + int ret; 319 + 320 + ret = regmap_read(st->regmap, ADI_AXI_ADC_REG_CONFIG, &val); 321 + if (ret) 322 + return ret; 323 + 324 + if (val & ADI_AXI_ADC_REG_CONFIG_CMOS_OR_LVDS_N) 325 + *type = IIO_BACKEND_INTERFACE_SERIAL_CMOS; 326 + else 327 + *type = IIO_BACKEND_INTERFACE_SERIAL_LVDS; 328 + 329 + return 0; 330 + } 331 + 316 332 static struct iio_buffer *axi_adc_request_buffer(struct iio_backend *back, 317 333 struct iio_dev *indio_dev) 318 334 { ··· 478 456 .iodelay_set = axi_adc_iodelays_set, 479 457 .test_pattern_set = axi_adc_test_pattern_set, 480 458 .chan_status = axi_adc_chan_status, 459 + .interface_type_get = axi_adc_interface_type_get, 481 460 .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access), 482 461 .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status), 483 462 };