Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219842
b: refs/heads/master
c: 6267ea6
h: refs/heads/master
v: v3
  • Loading branch information
Manuel Stahl authored and Greg Kroah-Hartman committed Sep 14, 2010
1 parent 129fad8 commit c666686
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 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: b68d58a84b42d6213e46948b8f4cb95b8ed0efec
refs/heads/master: 6267ea655f141bfd0955910b728571fb2a4ed1df
14 changes: 13 additions & 1 deletion trunk/drivers/staging/iio/accel/sca3000_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ static int sca3000_rip_hw_rb(struct iio_ring_buffer *r,
struct iio_dev *indio_dev = hw_ring->private;
struct sca3000_state *st = indio_dev->dev_data;
u8 *rx;
int ret, num_available, num_read = 0;
s16 *samples;
int ret, i, num_available, num_read = 0;
int bytes_per_sample = 1;

if (st->bpse == 11)
Expand Down Expand Up @@ -87,6 +88,17 @@ static int sca3000_rip_hw_rb(struct iio_ring_buffer *r,
ret = sca3000_read_data(st,
SCA3000_REG_ADDR_RING_OUT,
data, num_read);

/* Convert byte order and shift to default resolution */
if (st->bpse == 11) {
samples = (s16*)(*data+1);
for (i = 0; i < (num_read/2); i++) {
samples[i] = be16_to_cpup(
(__be16 *)&(samples[i]));
samples[i] >>= 3;
}
}

error_ret:
mutex_unlock(&st->lock);

Expand Down

0 comments on commit c666686

Please sign in to comment.