Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281017
b: refs/heads/master
c: c1a7528
h: refs/heads/master
i:
  281015: 2953f03
v: v3
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent bd6ee9b commit 9c69894
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 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: 5ae8f440909dc7fddccf7f408adbacf308049691
refs/heads/master: c1a752883dda6287b075215e419a77359f33edff
13 changes: 7 additions & 6 deletions trunk/drivers/staging/iio/adc/ad7298_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,27 +69,28 @@ static int ad7298_scan_direct(struct ad7298_state *st, unsigned ch)
static int ad7298_scan_temp(struct ad7298_state *st, int *val)
{
int tmp, ret;
__be16 buf;

tmp = cpu_to_be16(AD7298_WRITE | AD7298_TSENSE |
buf = cpu_to_be16(AD7298_WRITE | AD7298_TSENSE |
AD7298_TAVG | st->ext_ref);

ret = spi_write(st->spi, (u8 *)&tmp, 2);
ret = spi_write(st->spi, (u8 *)&buf, 2);
if (ret)
return ret;

tmp = 0;
buf = cpu_to_be16(0);

ret = spi_write(st->spi, (u8 *)&tmp, 2);
ret = spi_write(st->spi, (u8 *)&buf, 2);
if (ret)
return ret;

usleep_range(101, 1000); /* sleep > 100us */

ret = spi_read(st->spi, (u8 *)&tmp, 2);
ret = spi_read(st->spi, (u8 *)&buf, 2);
if (ret)
return ret;

tmp = be16_to_cpu(tmp) & RES_MASK(AD7298_BITS);
tmp = be16_to_cpu(buf) & RES_MASK(AD7298_BITS);

/*
* One LSB of the ADC corresponds to 0.25 deg C.
Expand Down

0 comments on commit 9c69894

Please sign in to comment.