Skip to content

Commit

Permalink
Merge pull request #28 from analogdevicesinc/fix-low-rate-enable
Browse files Browse the repository at this point in the history
ad9361_baseband_auto_rate: Fix low rate filter enable
  • Loading branch information
mhennerich committed Oct 1, 2018
2 parents 3eec70e + b2e88ca commit c70ed5f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ad9361_baseband_auto_rate.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ int ad9361_set_bb_rate(struct iio_device *dev, unsigned long rate)
return ret;

if (rate <= (25000000 / 12)) {
int dacrate, txrate, max;
char readbuf[100];

ret = iio_device_attr_read(dev, "tx_path_rates", readbuf, sizeof(readbuf));
if (ret < 0)
return ret;
ret = sscanf(readbuf, "BBPLL:%*d DAC:%d T2:%*d T1:%*d TF:%*d TXSAMP:%d", &dacrate, &txrate);
if (ret != 2)
return -EFAULT;

if (txrate == 0)
return -EINVAL;

max = (dacrate / txrate) * 16;
if (max < taps)
iio_channel_attr_write_longlong(chan, "sampling_frequency", 3000000);

ret = ad9361_set_trx_fir_enable(dev, true);
if (ret < 0)
return ret;
Expand Down

0 comments on commit c70ed5f

Please sign in to comment.