Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354202
b: refs/heads/master
c: 7ba8a04
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Jan 26, 2013
1 parent e483df8 commit 5c4ca00
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 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: b24150e31ab27ffcd2aa9b33dca42c2070526054
refs/heads/master: 7ba8a04dcdfb5ebcb4985a92dfc4dc4f59510464
16 changes: 12 additions & 4 deletions trunk/drivers/iio/imu/adis16400_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,26 @@ static int adis16400_get_freq(struct adis16400_state *st)
static int adis16400_set_freq(struct adis16400_state *st, unsigned int freq)
{
unsigned int t;
uint8_t val = 0;

t = 1638404 / freq;
if (t > 0)
if (t >= 128) {
val |= ADIS16400_SMPL_PRD_TIME_BASE;
t = 52851 / freq;
if (t >= 128)
t = 127;
} else if (t != 0) {
t--;
t &= ADIS16400_SMPL_PRD_DIV_MASK;
}

val |= t;

if ((t & ADIS16400_SMPL_PRD_DIV_MASK) >= 0x0A)
if (t >= 0x0A || (val & ADIS16400_SMPL_PRD_TIME_BASE))
st->adis.spi->max_speed_hz = ADIS16400_SPI_SLOW;
else
st->adis.spi->max_speed_hz = ADIS16400_SPI_FAST;

return adis_write_reg_8(&st->adis, ADIS16400_SMPL_PRD, t);
return adis_write_reg_8(&st->adis, ADIS16400_SMPL_PRD, val);
}

static ssize_t adis16400_read_frequency(struct device *dev,
Expand Down

0 comments on commit 5c4ca00

Please sign in to comment.