Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354191
b: refs/heads/master
c: bdb20bd
h: refs/heads/master
i:
  354189: eb2a570
  354187: 4dc0e16
  354183: b702981
  354175: 939cfc5
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Jan 26, 2013
1 parent ace2126 commit e19b331
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06220b89f2284f910f925676d757fd3331138dc6
refs/heads/master: bdb20bdb8c1ea55c9a2f744cc5b2c7f66148a41b
41 changes: 20 additions & 21 deletions trunk/drivers/staging/iio/imu/adis16400_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,33 +242,32 @@ static ssize_t adis16400_read_frequency(struct device *dev,

static const unsigned adis16400_3db_divisors[] = {
[0] = 2, /* Special case */
[1] = 5,
[2] = 10,
[3] = 50,
[4] = 200,
[1] = 6,
[2] = 12,
[3] = 25,
[4] = 50,
[5] = 100,
[6] = 200,
[7] = 200, /* Not a valid setting */
};

static int adis16400_set_filter(struct iio_dev *indio_dev, int sps, int val)
{
int i, ret;
u16 val16;
for (i = ARRAY_SIZE(adis16400_3db_divisors) - 1; i >= 0; i--)
if (sps/adis16400_3db_divisors[i] > val)

for (i = ARRAY_SIZE(adis16400_3db_divisors) - 1; i >= 1; i--) {
if (sps / adis16400_3db_divisors[i] >= val)
break;
if (i == -1)
ret = -EINVAL;
else {
ret = adis16400_spi_read_reg_16(indio_dev,
ADIS16400_SENS_AVG,
}

ret = adis16400_spi_read_reg_16(indio_dev, ADIS16400_SENS_AVG,
&val16);
if (ret < 0)
goto error_ret;
if (ret < 0)
return ret;

ret = adis16400_spi_write_reg_16(indio_dev,
ADIS16400_SENS_AVG,
(val16 & ~0x03) | i);
}
error_ret:
ret = adis16400_spi_write_reg_16(indio_dev, ADIS16400_SENS_AVG,
(val16 & ~0x07) | i);
return ret;
}

Expand Down Expand Up @@ -653,9 +652,9 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
mutex_unlock(&indio_dev->mlock);
return ret;
}
val16 = st->variant->get_freq(indio_dev);
if (ret > 0)
*val = ret/adis16400_3db_divisors[val16 & 0x03];
ret = st->variant->get_freq(indio_dev);
if (ret >= 0)
*val = ret / adis16400_3db_divisors[val16 & 0x07];
*val2 = 0;
mutex_unlock(&indio_dev->mlock);
if (ret < 0)
Expand Down

0 comments on commit e19b331

Please sign in to comment.