Skip to content

Commit

Permalink
iio: frequency: cf_axi_dds: remove old code for cf_axi_dds_start_sync
Browse files Browse the repository at this point in the history
For PCOREs older than version 8, there is a force parameter.
This is no longer needed (and version is now at 10).
This removes the old code and the parameter.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
  • Loading branch information
commodo committed Jul 10, 2019
1 parent b2588c0 commit 9c286d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
26 changes: 11 additions & 15 deletions drivers/iio/frequency/cf_axi_dds.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,10 @@ static int cf_axi_dds_sync_frame(struct iio_dev *indio_dev)
return 0;
}

void cf_axi_dds_start_sync(struct cf_axi_dds_state *st, bool force_on)
void cf_axi_dds_start_sync(struct cf_axi_dds_state *st)
{
if (ADI_AXI_PCORE_VER_MAJOR(st->version) < 8) {
dds_write(st, ADI_REG_CNTRL_1, (st->enable || force_on) ? ADI_ENABLE : 0);
} else {
dds_write(st, ADI_REG_CNTRL_1, ADI_SYNC);
dds_master_write(st, ADI_REG_CNTRL_1, ADI_SYNC);
}
dds_write(st, ADI_REG_CNTRL_1, ADI_SYNC);
dds_master_write(st, ADI_REG_CNTRL_1, ADI_SYNC);
}
EXPORT_SYMBOL_GPL(cf_axi_dds_start_sync);

Expand All @@ -349,7 +345,7 @@ static int cf_axi_dds_rate_change(struct notifier_block *nb,
reg |= ADI_DDS_INCR(val64) | 1;
dds_write(st, ADI_REG_CHAN_CNTRL_2_IIOCHAN(i), reg);
}
cf_axi_dds_start_sync(st, 0);
cf_axi_dds_start_sync(st);
cf_axi_dds_sync_frame(indio_dev);
}

Expand All @@ -370,7 +366,7 @@ static void cf_axi_dds_set_sed_pattern(struct iio_dev *indio_dev, unsigned chan,
ctrl = dds_read(st, ADI_REG_CNTRL_2);
dds_write(st, ADI_REG_CNTRL_2, ctrl | ADI_DATA_FORMAT);

cf_axi_dds_start_sync(st, 1);
cf_axi_dds_start_sync(st);
}

static int cf_axi_dds_default_setup(struct cf_axi_dds_state *st, u32 chan,
Expand Down Expand Up @@ -636,7 +632,7 @@ static int cf_axi_dds_write_raw(struct iio_dev *indio_dev,
}

st->enable = !!val;
cf_axi_dds_start_sync(st, 0);
cf_axi_dds_start_sync(st);
cf_axi_dds_datasel(st, -1, st->enable ? DATA_SEL_DDS : DATA_SEL_ZERO);

break;
Expand Down Expand Up @@ -684,7 +680,7 @@ static int cf_axi_dds_write_raw(struct iio_dev *indio_dev,
}
}
dds_write(st, ADI_REG_CHAN_CNTRL_1_IIOCHAN(chan->channel), ADI_DDS_SCALE(i));
cf_axi_dds_start_sync(st, 0);
cf_axi_dds_start_sync(st);
break;
case IIO_CHAN_INFO_FREQUENCY:
if (!chan->output) {
Expand All @@ -707,7 +703,7 @@ static int cf_axi_dds_write_raw(struct iio_dev *indio_dev,
do_div(val64, 0xFFFF);
st->cached_freq[chan->channel] = val64;

cf_axi_dds_start_sync(st, 0);
cf_axi_dds_start_sync(st);
break;
case IIO_CHAN_INFO_PHASE:
if (val < 0 || val > 360000) {
Expand All @@ -724,7 +720,7 @@ static int cf_axi_dds_write_raw(struct iio_dev *indio_dev,
do_div(val64, 360000);
reg |= ADI_DDS_INIT(val64);
dds_write(st, ADI_REG_CHAN_CNTRL_2_IIOCHAN(chan->channel), reg);
cf_axi_dds_start_sync(st, 0);
cf_axi_dds_start_sync(st);
break;
case IIO_CHAN_INFO_SAMP_FREQ:
if (chan->type == IIO_VOLTAGE && st->interpolation_factor) {
Expand All @@ -749,7 +745,7 @@ static int cf_axi_dds_write_raw(struct iio_dev *indio_dev,
dds_write(st, ADI_REG_CNTRL_2, reg);
cf_axi_dds_datasel(st, -1, i);
st->dac_clk = conv->get_data_clk(conv);
cf_axi_dds_start_sync(st, 0);
cf_axi_dds_start_sync(st);
ret = cf_axi_dds_sync_frame(indio_dev);
break;
case IIO_CHAN_INFO_CALIBPHASE:
Expand Down Expand Up @@ -1731,7 +1727,7 @@ static int cf_axi_dds_probe(struct platform_device *pdev)
}

st->enable = true;
cf_axi_dds_start_sync(st, 0);
cf_axi_dds_start_sync(st);
cf_axi_dds_sync_frame(indio_dev);

if (!st->dp_disable && !dds_read(st, ADI_AXI_REG_ID)) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/frequency/cf_axi_dds.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int cf_axi_dds_configure_buffer(struct iio_dev *indio_dev);
void cf_axi_dds_unconfigure_buffer(struct iio_dev *indio_dev);
int cf_axi_dds_datasel(struct cf_axi_dds_state *st,
int channel, enum dds_data_select sel);
void cf_axi_dds_start_sync(struct cf_axi_dds_state *st, bool force_on);
void cf_axi_dds_start_sync(struct cf_axi_dds_state *st);
int cf_axi_dds_pl_ddr_fifo_ctrl(struct cf_axi_dds_state *st, bool enable);

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/frequency/cf_axi_dds_buffer_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int dds_buffer_state_set(struct iio_dev *indio_dev, bool state)

dds_write(st, ADI_REG_VDMA_STATUS, ADI_VDMA_OVF | ADI_VDMA_UNF);

cf_axi_dds_start_sync(st, 1);
cf_axi_dds_start_sync(st);

return 0;
}
Expand Down

0 comments on commit 9c286d9

Please sign in to comment.