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 axi_adc_oversampling_ratio_set

Add support for setting decimation rate.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Pop Ioan Daniel <pop.ioan-daniel@analog.com>
Link: https://patch.msgid.link/20250605150948.3091827-4-pop.ioan-daniel@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Pop Ioan Daniel and committed by
Jonathan Cameron
dced5bda 97e6882e

+17
+17
drivers/iio/adc/adi-axi-adc.c
··· 86 86 #define ADI_AXI_ADC_REG_CHAN_CTRL_3(c) (0x0418 + (c) * 0x40) 87 87 #define ADI_AXI_ADC_CHAN_PN_SEL_MASK GENMASK(19, 16) 88 88 89 + #define ADI_AXI_ADC_REG_CHAN_USR_CTRL_2(c) (0x0424 + (c) * 0x40) 90 + #define ADI_AXI_ADC_CHAN_USR_CTRL_2_DEC_RATE_N_MASK GENMASK(15, 0) 91 + 89 92 /* IO Delays */ 90 93 #define ADI_AXI_ADC_REG_DELAY(l) (0x0800 + (l) * 0x4) 91 94 #define AXI_ADC_DELAY_CTRL_MASK GENMASK(4, 0) ··· 249 246 default: 250 247 return -EINVAL; 251 248 } 249 + } 250 + 251 + static int axi_adc_oversampling_ratio_set(struct iio_backend *back, 252 + unsigned int chan, 253 + unsigned int rate) 254 + { 255 + struct adi_axi_adc_state *st = iio_backend_get_priv(back); 256 + 257 + return regmap_update_bits(st->regmap, 258 + ADI_AXI_ADC_REG_CHAN_USR_CTRL_2(chan), 259 + ADI_AXI_ADC_CHAN_USR_CTRL_2_DEC_RATE_N_MASK, 260 + FIELD_PREP(ADI_AXI_ADC_CHAN_USR_CTRL_2_DEC_RATE_N_MASK, 261 + rate)); 252 262 } 253 263 254 264 static int axi_adc_read_chan_status(struct adi_axi_adc_state *st, unsigned int chan, ··· 616 600 .test_pattern_set = axi_adc_test_pattern_set, 617 601 .chan_status = axi_adc_chan_status, 618 602 .interface_type_get = axi_adc_interface_type_get, 603 + .oversampling_ratio_set = axi_adc_oversampling_ratio_set, 619 604 .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access), 620 605 .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status), 621 606 };