diff --git a/drivers/iio/adc/ad9361.h b/drivers/iio/adc/ad9361.h index ca075a6c862b83..77671b9a8d51ab 100644 --- a/drivers/iio/adc/ad9361.h +++ b/drivers/iio/adc/ad9361.h @@ -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); diff --git a/drivers/iio/adc/ad9361_conv.c b/drivers/iio/adc/ad9361_conv.c index a9f20613d25b46..eb442a313e2ebc 100644 --- a/drivers/iio/adc/ad9361_conv.c +++ b/drivers/iio/adc/ad9361_conv.c @@ -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; @@ -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++) { diff --git a/drivers/iio/adc/ad9361_private.h b/drivers/iio/adc/ad9361_private.h index 9c0b7cd4e9222b..dfffc4fa88a9a7 100644 --- a/drivers/iio/adc/ad9361_private.h +++ b/drivers/iio/adc/ad9361_private.h @@ -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 {