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 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>

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
8ee80094 b81c5c25

+38
+38
drivers/iio/adc/adi-axi-adc.c
··· 52 52 #define AXI_AD485X_PACKET_FORMAT_20BIT 0x0 53 53 #define AXI_AD485X_PACKET_FORMAT_24BIT 0x1 54 54 #define AXI_AD485X_PACKET_FORMAT_32BIT 0x2 55 + #define AXI_AD408X_CNTRL_3_FILTER_EN_MSK BIT(0) 55 56 56 57 #define ADI_AXI_ADC_REG_DRP_STATUS 0x0074 57 58 #define ADI_AXI_ADC_DRP_LOCKED BIT(17) ··· 403 402 } 404 403 } 405 404 405 + static int axi_adc_ad408x_filter_type_set(struct iio_backend *back, 406 + enum iio_backend_filter_type type) 407 + { 408 + struct adi_axi_adc_state *st = iio_backend_get_priv(back); 409 + 410 + if (type) 411 + return regmap_set_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3, 412 + AXI_AD408X_CNTRL_3_FILTER_EN_MSK); 413 + 414 + return regmap_clear_bits(st->regmap, ADI_AXI_ADC_REG_CNTRL_3, 415 + AXI_AD408X_CNTRL_3_FILTER_EN_MSK); 416 + } 417 + 406 418 static struct iio_buffer *axi_adc_request_buffer(struct iio_backend *back, 407 419 struct iio_dev *indio_dev) 408 420 { ··· 596 582 .ops = &adi_ad485x_ops, 597 583 }; 598 584 585 + static const struct iio_backend_ops adi_ad408x_ops = { 586 + .enable = axi_adc_enable, 587 + .disable = axi_adc_disable, 588 + .chan_enable = axi_adc_chan_enable, 589 + .chan_disable = axi_adc_chan_disable, 590 + .request_buffer = axi_adc_request_buffer, 591 + .free_buffer = axi_adc_free_buffer, 592 + .data_sample_trigger = axi_adc_data_sample_trigger, 593 + .filter_type_set = axi_adc_ad408x_filter_type_set, 594 + .debugfs_reg_access = iio_backend_debugfs_ptr(axi_adc_reg_access), 595 + .debugfs_print_chan_status = iio_backend_debugfs_ptr(axi_adc_debugfs_print_chan_status), 596 + }; 597 + 598 + static const struct iio_backend_info axi_ad408x = { 599 + .name = "axi-ad408x", 600 + .ops = &adi_ad408x_ops, 601 + }; 602 + 599 603 static int adi_axi_adc_probe(struct platform_device *pdev) 600 604 { 601 605 struct adi_axi_adc_state *st; ··· 729 697 .has_child_nodes = true, 730 698 }; 731 699 700 + static const struct axi_adc_info adi_axi_ad408x = { 701 + .version = ADI_AXI_PCORE_VER(10, 0, 'a'), 702 + .backend_info = &axi_ad408x, 703 + }; 704 + 732 705 /* Match table for of_platform binding */ 733 706 static const struct of_device_id adi_axi_adc_of_match[] = { 734 707 { .compatible = "adi,axi-adc-10.0.a", .data = &adc_generic }, 708 + { .compatible = "adi,axi-ad408x", .data = &adi_axi_ad408x }, 735 709 { .compatible = "adi,axi-ad485x", .data = &adi_axi_ad485x }, 736 710 { .compatible = "adi,axi-ad7606x", .data = &adc_ad7606 }, 737 711 { }