summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-07-03 11:21:28 +0200
committerJonathan Cameron <jic23@kernel.org>2012-07-08 10:39:59 +0100
commitd297b9bdad044a732223b44c19e8223d93fd3aa0 (patch)
tree0faf395686355e8fb19131e76bd3037d92ba4292
parent6d459aa011cb087ed1f5c17836b032fcc670e306 (diff)
staging iio adt7410: make 16bit mode default
In 13bit mode the lower three bits of the adc value contain flags. The driver does not use these flags at all, so make 16bit mode the default. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/staging/iio/adc/adt7410.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c
index 917b6921e24d..1a4197013e9b 100644
--- a/drivers/staging/iio/adc/adt7410.c
+++ b/drivers/staging/iio/adc/adt7410.c
@@ -761,13 +761,15 @@ static int __devinit adt7410_probe(struct i2c_client *client,
goto error_unreg_ct_irq;
}
- if (client->irq && adt7410_platform_data[0]) {
+ ret = adt7410_i2c_read_byte(chip, ADT7410_CONFIG, &chip->config);
+ if (ret) {
+ ret = -EIO;
+ goto error_unreg_int_irq;
+ }
- ret = adt7410_i2c_read_byte(chip, ADT7410_CONFIG, &chip->config);
- if (ret) {
- ret = -EIO;
- goto error_unreg_int_irq;
- }
+ chip->config |= ADT7410_RESOLUTION;
+
+ if (client->irq && adt7410_platform_data[0]) {
/* set irq polarity low level */
chip->config &= ~ADT7410_CT_POLARITY;
@@ -776,12 +778,12 @@ static int __devinit adt7410_probe(struct i2c_client *client,
chip->config |= ADT7410_INT_POLARITY;
else
chip->config &= ~ADT7410_INT_POLARITY;
+ }
- ret = adt7410_i2c_write_byte(chip, ADT7410_CONFIG, chip->config);
- if (ret) {
- ret = -EIO;
- goto error_unreg_int_irq;
- }
+ ret = adt7410_i2c_write_byte(chip, ADT7410_CONFIG, chip->config);
+ if (ret) {
+ ret = -EIO;
+ goto error_unreg_int_irq;
}
ret = iio_device_register(indio_dev);
if (ret)