Skip to content

Commit

Permalink
iio: frequency: cf_axi_dds: Sync DDSs after jesd204 link establishment
Browse files Browse the repository at this point in the history
In situations where device clocks are changed during jesd204-fsm
state transitions. It might be required to re-sync the DDSs.


Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich authored and dbogdan committed Feb 2, 2022
1 parent 9a09ba3 commit c7fcca8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions drivers/iio/frequency/cf_axi_dds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1782,11 +1782,31 @@ static int cf_axi_dds_jesd204_link_supported(struct jesd204_dev *jdev,
return JESD204_STATE_CHANGE_DONE;
}

static int cf_axi_dds_jesd204_post_running_stage(struct jesd204_dev *jdev,
enum jesd204_state_op_reason reason)
{
struct device *dev = jesd204_dev_to_device(jdev);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct cf_axi_dds_state *st = iio_priv(indio_dev);

if (reason == JESD204_STATE_OP_REASON_INIT) {
cf_axi_dds_start_sync(st, 0);
return JESD204_STATE_CHANGE_DONE;
}

return JESD204_STATE_CHANGE_DONE;

}

static const struct jesd204_dev_data jesd204_cf_axi_dds_init = {
.state_ops = {
[JESD204_OP_LINK_SUPPORTED] = {
.per_link = cf_axi_dds_jesd204_link_supported,
},
[JESD204_OP_OPT_POST_RUNNING_STAGE] = {
.per_device = cf_axi_dds_jesd204_post_running_stage,
.mode = JESD204_STATE_OP_MODE_PER_DEVICE,
},
},
};

Expand Down

0 comments on commit c7fcca8

Please sign in to comment.