staging:iio:adc:ad7291: fix channel mapping
authorMichael Hennerich <michael.hennerich@analog.com>
Fri, 2 Sep 2011 16:25:36 +0000 (17:25 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Sep 2011 23:03:34 +0000 (16:03 -0700)
ideally in_voltageX_raw should map to AD7291 VINX.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/iio/adc/ad7291.c

index ebb1e281e3fa47a3d7dc6a8b9091511c2bf9c95c..014df62486186ccdcadafed96d115b746a7291f1 100644 (file)
@@ -435,7 +435,7 @@ static int ad7291_read_raw(struct iio_dev *indio_dev,
                        }
                        /* Enable this channel alone */
                        regval = chip->command & (~AD7291_VOLTAGE_MASK);
-                       regval |= 1 << (chan->channel + 8);
+                       regval |= 1 << (15 - chan->channel);
                        ret = ad7291_i2c_write(chip, AD7291_COMMAND, regval);
                        if (ret < 0) {
                                mutex_unlock(&chip->state_lock);