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 data align process

Add support for starting the sync process used for data
capture alignment.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://patch.msgid.link/20250516082630.8236-7-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
d2ca659c 8ee80094

+23
+23
drivers/iio/adc/adi-axi-adc.c
··· 44 44 #define ADI_AXI_ADC_REG_CONFIG_CMOS_OR_LVDS_N BIT(7) 45 45 46 46 #define ADI_AXI_ADC_REG_CTRL 0x0044 47 + #define ADI_AXI_ADC_CTRL_SYNC_MSK BIT(3) 47 48 #define ADI_AXI_ADC_CTRL_DDR_EDGESEL_MASK BIT(1) 48 49 49 50 #define ADI_AXI_ADC_REG_CNTRL_3 0x004c ··· 54 53 #define AXI_AD485X_PACKET_FORMAT_24BIT 0x1 55 54 #define AXI_AD485X_PACKET_FORMAT_32BIT 0x2 56 55 #define AXI_AD408X_CNTRL_3_FILTER_EN_MSK BIT(0) 56 + 57 + #define ADI_AXI_ADC_REG_SYNC_STATUS 0x0068 58 + #define ADI_AXI_ADC_SYNC_STATUS_ADC_SYNC_MSK BIT(0) 57 59 58 60 #define ADI_AXI_ADC_REG_DRP_STATUS 0x0074 59 61 #define ADI_AXI_ADC_DRP_LOCKED BIT(17) ··· 420 416 AXI_AD408X_CNTRL_3_FILTER_EN_MSK); 421 417 } 422 418 419 + static int axi_adc_ad408x_interface_data_align(struct iio_backend *back, 420 + u32 timeout_us) 421 + { 422 + struct adi_axi_adc_state *st = iio_backend_get_priv(back); 423 + u32 val; 424 + int ret; 425 + 426 + ret = regmap_set_bits(st->regmap, ADI_AXI_ADC_REG_CTRL, 427 + ADI_AXI_ADC_CTRL_SYNC_MSK); 428 + if (ret) 429 + return ret; 430 + 431 + return regmap_read_poll_timeout(st->regmap, ADI_AXI_ADC_REG_SYNC_STATUS, 432 + val, 433 + FIELD_GET(ADI_AXI_ADC_SYNC_STATUS_ADC_SYNC_MSK, val), 434 + 1, timeout_us); 435 + } 436 + 423 437 static struct iio_buffer *axi_adc_request_buffer(struct iio_backend *back, 424 438 struct iio_dev *indio_dev) 425 439 { ··· 627 605 .free_buffer = axi_adc_free_buffer, 628 606 .data_sample_trigger = axi_adc_data_sample_trigger, 629 607 .filter_type_set = axi_adc_ad408x_filter_type_set, 608 + .interface_data_align = axi_adc_ad408x_interface_data_align, 630 609 .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access), 631 610 .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status), 632 611 };