Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317206
b: refs/heads/master
c: 4468cb5
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Jun 5, 2012
1 parent fce76f4 commit b29c8cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 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: 2490594e89c7286585daeaf05a06b6cd7b5c8876
refs/heads/master: 4468cb552536731fd85f22a367602e9242a55376
14 changes: 6 additions & 8 deletions trunk/drivers/staging/iio/dac/ad5791.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,23 @@ static ssize_t ad5791_write_dac_powerdown(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
size_t len)
{
long readin;
bool pwr_down;
int ret;
struct ad5791_state *st = iio_priv(indio_dev);

ret = strict_strtol(buf, 10, &readin);
ret = strtobool(buf, &pwr_down);
if (ret)
return ret;

if (readin == 0) {
st->pwr_down = false;
if (!pwr_down) {
st->ctrl &= ~(AD5791_CTRL_OPGND | AD5791_CTRL_DACTRI);
} else if (readin == 1) {
st->pwr_down = true;
} else {
if (st->pwr_down_mode == AD5791_DAC_PWRDN_6K)
st->ctrl |= AD5791_CTRL_OPGND;
else if (st->pwr_down_mode == AD5791_DAC_PWRDN_3STATE)
st->ctrl |= AD5791_CTRL_DACTRI;
} else
ret = -EINVAL;
}
st->pwr_down = pwr_down;

ret = ad5791_spi_write(st->spi, AD5791_ADDR_CTRL, st->ctrl);

Expand Down

0 comments on commit b29c8cb

Please sign in to comment.