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: dac: adi-axi-dac: add data source get

Add data source getter.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Link: https://patch.msgid.link/20250409-wip-bl-ad3552r-fixes-v5-4-fb429c3a6515@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Angelo Dureghello and committed by
Jonathan Cameron
ca74d0eb 20863215

+30
+30
drivers/iio/dac/adi-axi-dac.c
··· 536 536 } 537 537 } 538 538 539 + static int axi_dac_data_source_get(struct iio_backend *back, unsigned int chan, 540 + enum iio_backend_data_source *data) 541 + { 542 + struct axi_dac_state *st = iio_backend_get_priv(back); 543 + int ret; 544 + u32 val; 545 + 546 + if (chan > AXI_DAC_CHAN_CNTRL_MAX) 547 + return -EINVAL; 548 + 549 + ret = regmap_read(st->regmap, AXI_DAC_CHAN_CNTRL_7_REG(chan), &val); 550 + if (ret) 551 + return ret; 552 + 553 + switch (val) { 554 + case AXI_DAC_DATA_INTERNAL_TONE: 555 + *data = IIO_BACKEND_INTERNAL_CONTINUOUS_WAVE; 556 + return 0; 557 + case AXI_DAC_DATA_DMA: 558 + *data = IIO_BACKEND_EXTERNAL; 559 + return 0; 560 + case AXI_DAC_DATA_INTERNAL_RAMP_16BIT: 561 + *data = IIO_BACKEND_INTERNAL_RAMP_16BIT; 562 + return 0; 563 + default: 564 + return -EIO; 565 + } 566 + } 567 + 539 568 static int axi_dac_set_sample_rate(struct iio_backend *back, unsigned int chan, 540 569 u64 sample_rate) 541 570 { ··· 847 818 .request_buffer = axi_dac_request_buffer, 848 819 .free_buffer = axi_dac_free_buffer, 849 820 .data_source_set = axi_dac_data_source_set, 821 + .data_source_get = axi_dac_data_source_get, 850 822 .ddr_enable = axi_dac_ddr_enable, 851 823 .ddr_disable = axi_dac_ddr_disable, 852 824 .data_stream_enable = axi_dac_data_stream_enable,