Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268198
b: refs/heads/master
c: 06420c2
h: refs/heads/master
v: v3
  • Loading branch information
Michael Hennerich authored and Greg Kroah-Hartman committed Sep 6, 2011
1 parent f04e585 commit 75f0a90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 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: b576590dcd4ef4774b155540e392491afb1d1da0
refs/heads/master: 06420c2d61f3ec838f15933b8c03ae2e658d0d56
24 changes: 12 additions & 12 deletions trunk/drivers/staging/iio/adc/ad7291.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct ad7291_chip_info {
struct regulator *reg;
u16 int_vref_mv;
u16 command;
u8 c_mask; /* Active voltage channels for events */
u16 c_mask; /* Active voltage channels for events */
struct mutex state_lock;
};

Expand Down Expand Up @@ -381,7 +381,7 @@ static int ad7291_read_event_config(struct iio_dev *indio_dev,
switch (IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(event_code)) {
case IIO_VOLTAGE:
if (chip->c_mask &
(1 << IIO_EVENT_CODE_EXTRACT_NUM(event_code)))
(1 << (15 - IIO_EVENT_CODE_EXTRACT_NUM(event_code))))
return 1;
else
return 0;
Expand Down Expand Up @@ -412,19 +412,19 @@ static int ad7291_write_event_config(struct iio_dev *indio_dev,

switch (IIO_EVENT_CODE_EXTRACT_TYPE(event_code)) {
case IIO_VOLTAGE:
if ((!state) && (chip->c_mask &
(1 << IIO_EVENT_CODE_EXTRACT_NUM(event_code))))
chip->c_mask &=
~(1 << IIO_EVENT_CODE_EXTRACT_NUM(event_code));
else if (state && (!(chip->c_mask &
(1 << IIO_EVENT_CODE_EXTRACT_NUM(event_code)))))
chip->c_mask |=
(1 << IIO_EVENT_CODE_EXTRACT_NUM(event_code));
if ((!state) && (chip->c_mask & (1 << (15 -
IIO_EVENT_CODE_EXTRACT_NUM(event_code)))))
chip->c_mask &= ~(1 << (15 - IIO_EVENT_CODE_EXTRACT_NUM
(event_code)));
else if (state && (!(chip->c_mask & (1 << (15 -
IIO_EVENT_CODE_EXTRACT_NUM(event_code))))))
chip->c_mask |= (1 << (15 - IIO_EVENT_CODE_EXTRACT_NUM
(event_code)));
else
break;

regval &= ~AD7291_AUTOCYCLE;
regval |= ((u16)chip->c_mask << 8);
regval |= chip->c_mask;
if (chip->c_mask) /* Enable autocycle? */
regval |= AD7291_AUTOCYCLE;

Expand Down Expand Up @@ -461,7 +461,7 @@ static int ad7291_read_raw(struct iio_dev *indio_dev,
case IIO_VOLTAGE:
mutex_lock(&chip->state_lock);
/* If in autocycle mode drop through */
if (chip->command & 0x1) {
if (chip->command & AD7291_AUTOCYCLE) {
mutex_unlock(&chip->state_lock);
return -EBUSY;
}
Expand Down

0 comments on commit 75f0a90

Please sign in to comment.