Skip to content

Commit

Permalink
iio: adc: cf_axi_adc: Add support for axi additional channel
Browse files Browse the repository at this point in the history
In some projects (e.g. ADI-FMCLIDAR1), a dedicated IIO buffer channel
should be used for displaying additional data (for ADI-FMCLIDAR1,
the information about the enabled sequencer channels).

Signed-off-by: Dragos Bogdan <[email protected]>
  • Loading branch information
dbogdan authored and commodo committed Sep 5, 2019
1 parent 8ace87d commit 98df3f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/iio/adc/cf_axi_adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ struct axiadc_state {
bool dp_disable;
unsigned long long adc_clk;
unsigned have_slave_channels;
bool additional_channel;

struct iio_hw_consumer *frontend;

Expand Down
10 changes: 10 additions & 0 deletions drivers/iio/adc/cf_axi_adc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,13 @@ static int axiadc_channel_setup(struct iio_dev *indio_dev,
for (i = 0, cnt = 0; i < adc_chan_num; i++)
st->channels[cnt++] = adc_channels[i];

if (st->additional_channel && cnt < AXIADC_MAX_CHANNEL) {
st->channels[cnt] = adc_channels[0];
st->channels[cnt].channel = cnt;
st->channels[cnt].scan_index = cnt;
cnt++;
}

for (i = 0; i < st->max_usr_channel; i++) {
usr_ctrl = axiadc_read(st, ADI_REG_CHAN_USR_CNTRL_1(cnt));
st->channels[cnt].type = IIO_VOLTAGE;
Expand Down Expand Up @@ -819,6 +826,9 @@ static int axiadc_probe(struct platform_device *pdev)
}
}

st->additional_channel = of_property_read_bool(pdev->dev.of_node,
"adi,axi-additional-channel-available");

/* Reset all HDL Cores */
axiadc_write(st, ADI_REG_RSTN, 0);
mdelay(10);
Expand Down

0 comments on commit 98df3f0

Please sign in to comment.