mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
iio: adc: adi-axi-adc: add filter type config
Add support for enabling/disabling filter based on the filter type provided. This feature is specific to the axi ad408x IP core, therefore add new compatible string and corresponding iio_backend_ops. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://patch.msgid.link/20250516082630.8236-6-antoniu.miclaus@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
b81c5c2582
commit
8ee8009420
|
|
@ -52,6 +52,7 @@
|
|||
#define AXI_AD485X_PACKET_FORMAT_20BIT 0x0
|
||||
#define AXI_AD485X_PACKET_FORMAT_24BIT 0x1
|
||||
#define AXI_AD485X_PACKET_FORMAT_32BIT 0x2
|
||||
#define AXI_AD408X_CNTRL_3_FILTER_EN_MSK BIT(0)
|
||||
|
||||
#define ADI_AXI_ADC_REG_DRP_STATUS 0x0074
|
||||
#define ADI_AXI_ADC_DRP_LOCKED BIT(17)
|
||||
|
|
@ -402,6 +403,19 @@ static int axi_adc_ad485x_oversampling_ratio_set(struct iio_backend *back,
|
|||
}
|
||||
}
|
||||
|
||||
static int axi_adc_ad408x_filter_type_set(struct iio_backend *back,
|
||||
enum iio_backend_filter_type type)
|
||||
{
|
||||
struct adi_axi_adc_state *st = iio_backend_get_priv(back);
|
||||
|
||||
if (type)
|
||||
return regmap_set_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3,
|
||||
AXI_AD408X_CNTRL_3_FILTER_EN_MSK);
|
||||
|
||||
return regmap_clear_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3,
|
||||
AXI_AD408X_CNTRL_3_FILTER_EN_MSK);
|
||||
}
|
||||
|
||||
static struct iio_buffer *axi_adc_request_buffer(struct iio_backend *back,
|
||||
struct iio_dev *indio_dev)
|
||||
{
|
||||
|
|
@ -582,6 +596,24 @@ static const struct iio_backend_info axi_ad485x = {
|
|||
.ops = &adi_ad485x_ops,
|
||||
};
|
||||
|
||||
static const struct iio_backend_ops adi_ad408x_ops = {
|
||||
.enable = axi_adc_enable,
|
||||
.disable = axi_adc_disable,
|
||||
.chan_enable = axi_adc_chan_enable,
|
||||
.chan_disable = axi_adc_chan_disable,
|
||||
.request_buffer = axi_adc_request_buffer,
|
||||
.free_buffer = axi_adc_free_buffer,
|
||||
.data_sample_trigger = axi_adc_data_sample_trigger,
|
||||
.filter_type_set = axi_adc_ad408x_filter_type_set,
|
||||
.debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access),
|
||||
.debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status),
|
||||
};
|
||||
|
||||
static const struct iio_backend_info axi_ad408x = {
|
||||
.name = "axi-ad408x",
|
||||
.ops = &adi_ad408x_ops,
|
||||
};
|
||||
|
||||
static int adi_axi_adc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct adi_axi_adc_state *st;
|
||||
|
|
@ -697,9 +729,15 @@ static const struct axi_adc_info adc_ad7606 = {
|
|||
.has_child_nodes = true,
|
||||
};
|
||||
|
||||
static const struct axi_adc_info adi_axi_ad408x = {
|
||||
.version = ADI_AXI_PCORE_VER(10, 0, 'a'),
|
||||
.backend_info = &axi_ad408x,
|
||||
};
|
||||
|
||||
/* Match table for of_platform binding */
|
||||
static const struct of_device_id adi_axi_adc_of_match[] = {
|
||||
{ .compatible = "adi,axi-adc-10.0.a", .data = &adc_generic },
|
||||
{ .compatible = "adi,axi-ad408x", .data = &adi_axi_ad408x },
|
||||
{ .compatible = "adi,axi-ad485x", .data = &adi_axi_ad485x },
|
||||
{ .compatible = "adi,axi-ad7606x", .data = &adc_ad7606 },
|
||||
{ }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user