Skip to content

Commit 13a58d5

Browse files
committed
iio: adc: adrv9002: fix tx2 scale for rx2tx2
Similar to commit 7ebe866 ("iio: adc: adrv9002: fixup tx2 power level") we need to apply the same fixup even in rx2tx2. The reasoning for not doing it at the time was that if the channels are tuned together and have the same SSI delays, it should not be needed. Well... While at it (and as advised by HW folks), we're now doing the fixup for all TX channels. Signed-off-by: Nuno Sa <nuno.sa@analog.com>
1 parent ae9000c commit 13a58d5

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

drivers/iio/adc/navassa/adrv9002.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3864,22 +3864,35 @@ static void adrv9002_fill_profile_read(struct adrv9002_rf_phy *phy)
38643864
* Obviuosly, this is an awful workaround and we need to understand the root cause of
38653865
* the issue and properly fix things. Hopefully this won't one those things where
38663866
* "we fix it later" means never!
3867+
*
3868+
* Update: Now we do the fixup for all TX channels and for rx2tx2 mode.
38673869
*/
3868-
int adrv9002_tx2_fixup(const struct adrv9002_rf_phy *phy)
3870+
int adrv9002_tx_fixup(const struct adrv9002_rf_phy *phy, unsigned int chan)
38693871
{
3870-
const struct adrv9002_chan *tx = &phy->tx_channels[ADRV9002_CHANN_2].channel;
3872+
const struct adrv9002_chan *tx = &phy->tx_channels[chan].channel;
38713873
struct adi_adrv9001_TxSsiTestModeCfg ssi_cfg = {
38723874
.testData = ADI_ADRV9001_SSI_TESTMODE_DATA_FIXED_PATTERN,
38733875
};
38743876
struct adi_adrv9001_TxSsiTestModeStatus dummy;
38753877

3876-
if (phy->chip->n_tx < ADRV9002_CHANN_MAX || phy->rx2tx2)
3877-
return 0;
3878-
38793878
return api_call(phy, adi_adrv9001_Ssi_Tx_TestMode_Status_Inspect, tx->number, phy->ssi_type,
38803879
ADI_ADRV9001_SSI_FORMAT_16_BIT_I_Q_DATA, &ssi_cfg, &dummy);
38813880
}
38823881

3882+
int adrv9002_tx_fixup_all(const struct adrv9002_rf_phy *phy)
3883+
{
3884+
int ret;
3885+
u32 c;
3886+
3887+
for (c = 0; c < phy->chip->n_tx; c++) {
3888+
ret = adrv9002_tx_fixup(phy, c);
3889+
if (ret)
3890+
return ret;
3891+
}
3892+
3893+
return 0;
3894+
}
3895+
38833896
int adrv9002_init(struct adrv9002_rf_phy *phy, struct adi_adrv9001_Init *profile)
38843897
{
38853898
int ret, c;
@@ -3930,7 +3943,7 @@ int adrv9002_init(struct adrv9002_rf_phy *phy, struct adi_adrv9001_Init *profile
39303943

39313944
adrv9002_fill_profile_read(phy);
39323945

3933-
return adrv9002_tx2_fixup(phy);
3946+
return adrv9002_tx_fixup_all(phy);
39343947
error:
39353948
/*
39363949
* Leave the device in a reset state in case of error. There's not much we can do if

drivers/iio/adc/navassa/adrv9002.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ int adrv9002_intf_test_cfg(const struct adrv9002_rf_phy *phy, const int chann, c
312312
int adrv9002_check_tx_test_pattern(const struct adrv9002_rf_phy *phy, const int chann);
313313
int adrv9002_intf_change_delay(const struct adrv9002_rf_phy *phy, const int channel, u8 clk_delay,
314314
u8 data_delay, const bool tx);
315-
int adrv9002_tx2_fixup(const struct adrv9002_rf_phy *phy);
315+
int adrv9002_tx_fixup(const struct adrv9002_rf_phy *phy, unsigned int chan);
316+
int adrv9002_tx_fixup_all(const struct adrv9002_rf_phy *phy);
316317
adi_adrv9001_SsiTestModeData_e adrv9002_get_test_pattern(const struct adrv9002_rf_phy *phy,
317318
unsigned int chan, bool rx, bool stop);
318319
/* phy lock must be held before entering the API */

drivers/iio/adc/navassa/adrv9002_conv.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,12 @@ int adrv9002_axi_intf_tune(const struct adrv9002_rf_phy *phy, const bool tx, con
516516
return ret;
517517

518518
if (tx) {
519-
if (chann) {
520-
ret = adrv9002_tx2_fixup(phy);
521-
if (ret)
522-
return ret;
523-
}
519+
if (phy->rx2tx2)
520+
ret = adrv9002_tx_fixup_all(phy);
521+
else
522+
ret = adrv9002_tx_fixup(phy, chann);
523+
if (ret)
524+
return ret;
524525
/*
525526
* we need to restart the tx test for every iteration since it's
526527
* the only way to reset the counters.

0 commit comments

Comments
 (0)