Skip to content

Commit

Permalink
iio: adc: ad9361: Avoid checking LO synthesizer lock in power down mode
Browse files Browse the repository at this point in the history
This fixes external LO mode in TDD with SPI Control or whenever
LO POWER DOWN is forced.

ad9361 spi0.1: Calibration TIMEOUT (0x247, 0x2)

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich committed Nov 15, 2018
1 parent 2b0ee59 commit 9d38c46
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions drivers/iio/adc/ad9361.c
Original file line number Diff line number Diff line change
Expand Up @@ -3938,13 +3938,22 @@ static int ad9361_ensm_set_state(struct ad9361_rf_phy *phy, u8 ensm_state,

if (!phy->pdata->fdd && !pinctrl && !phy->pdata->tdd_use_dual_synth &&
(ensm_state == ENSM_STATE_TX || ensm_state == ENSM_STATE_RX)) {
u32 reg, check;

if (ensm_state == ENSM_STATE_TX) {
reg = REG_TX_CP_OVERRANGE_VCO_LOCK;
check = !(st->cached_synth_pd[0] &
TX_SYNTH_VCO_POWER_DOWN);
} else {
reg = REG_RX_CP_OVERRANGE_VCO_LOCK;
check = !(st->cached_synth_pd[1] &
RX_SYNTH_VCO_POWER_DOWN);
}

ad9361_spi_writef(phy->spi, REG_ENSM_CONFIG_2,
TXNRX_SPI_CTRL, ensm_state == ENSM_STATE_TX);

ad9361_check_cal_done(phy, (ensm_state == ENSM_STATE_TX) ?
REG_TX_CP_OVERRANGE_VCO_LOCK :
REG_RX_CP_OVERRANGE_VCO_LOCK,
VCO_LOCK, 1);
if (check)
ad9361_check_cal_done(phy, reg, VCO_LOCK, 1);
}

rc = ad9361_spi_write(spi, REG_ENSM_CONFIG_1, val);
Expand Down

0 comments on commit 9d38c46

Please sign in to comment.