diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-09 02:59:04 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-09 02:59:04 +0100 |
commit | 8ecb55b849b74dff026681b41266970072b207dd (patch) | |
tree | 0304ed3e252374adf0f5b3ec5eb0de0700a9e130 /drivers/iio/adc | |
parent | Linux 3.19-rc2 (diff) | |
parent | iio: iio: Fix iio_channel_read return if channel havn't info (diff) | |
download | linux-8ecb55b849b74dff026681b41266970072b207dd.tar.xz linux-8ecb55b849b74dff026681b41266970072b207dd.zip |
Merge tag 'iio-fixes-for-3.19a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
First round of IIO fixes for the 3.19 cycle.
* ad799x fix ad7991/ad7995/ad7999 setup as they do not have a configuration
register to write to. It is written during the convesion sequence. As
such we don't want to write to it at other times.
* Fix iio_channel_read utility function to return to ensure it is apparent
if the relevant element is not there. This avoids using a wrong value
if some channels have the element and others do not.
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/ad799x.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index e37412da15f5..b99de00e57b8 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c @@ -143,9 +143,15 @@ static int ad799x_write_config(struct ad799x_state *st, u16 val) case ad7998: return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG, val); - default: + case ad7992: + case ad7993: + case ad7994: return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG, val); + default: + /* Will be written when doing a conversion */ + st->config = val; + return 0; } } @@ -155,8 +161,13 @@ static int ad799x_read_config(struct ad799x_state *st) case ad7997: case ad7998: return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG); - default: + case ad7992: + case ad7993: + case ad7994: return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG); + default: + /* No readback support */ + return st->config; } } |