Skip to content

Commit

Permalink
iio: adc: ad9361: Add the axi-half-dac-rate-enable option
Browse files Browse the repository at this point in the history
Cherry-pick from :
commit 708ef4d ("iio: adc: ad9361: Add the axi-half-dac-rate-enable
option")

Signed-off-by: Sergiu Cuciurean <[email protected]>
  • Loading branch information
dbogdan authored and commodo committed Nov 28, 2019
1 parent 3979b2c commit 819e1df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/iio/adc/ad9361.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ int ad9361_dig_tune(struct ad9361_rf_phy *phy, unsigned long max_freq,
int ad9361_tx_mute(struct ad9361_rf_phy *phy, u32 state);
int ad9361_write_bist_reg(struct ad9361_rf_phy *phy, u32 val);
bool ad9361_uses_rx2tx2(struct ad9361_rf_phy *phy);
bool ad9361_axi_half_dac_rate(struct ad9361_rf_phy *phy);
int ad9361_get_dig_tune_data(struct ad9361_rf_phy *phy,
struct ad9361_dig_tune_data *data);
int ad9361_read_clock_data_delays(struct ad9361_rf_phy *phy);
Expand Down
11 changes: 9 additions & 2 deletions drivers/iio/adc/ad9361_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ static int ad9361_post_setup(struct iio_dev *indio_dev)
struct axiadc_converter *conv = iio_device_get_drvdata(indio_dev);
struct ad9361_rf_phy *phy = conv->phy;
bool rx2tx2 = ad9361_uses_rx2tx2(phy);
bool half_rate = ad9361_axi_half_dac_rate(phy);
unsigned tmp, num_chan, flags;
unsigned int skipmode;
int i, ret;
Expand All @@ -695,13 +696,19 @@ static int ad9361_post_setup(struct iio_dev *indio_dev)

if (!rx2tx2) {
axiadc_write(st, 0x4048, tmp | BIT(5)); /* R1_MODE */
axiadc_write(st, 0x404c,
if (!half_rate)
axiadc_write(st, 0x404c,
ad9361_uses_lvds_mode(phy) ? 1 : 0); /* RATE */
else
axiadc_write(st, 0x404c, 0);
} else {
tmp &= ~BIT(5);
axiadc_write(st, 0x4048, tmp);
axiadc_write(st, 0x404c,
if (!half_rate)
axiadc_write(st, 0x404c,
ad9361_uses_lvds_mode(phy) ? 3 : 1); /* RATE */
else
axiadc_write(st, 0x404c, 1);
}

for (i = 0; i < num_chan; i++) {
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/adc/ad9361_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ struct ad9361_phy_platform_data {
struct gpio_desc *cal_sw1_gpio;
struct gpio_desc *cal_sw2_gpio;

bool axi_half_dac_rate_en;
};

struct rf_rx_gain {
Expand Down

0 comments on commit 819e1df

Please sign in to comment.