Commit 13b2e3a5c422daa63f1e913cf25462cb9c40dcd0
Committed by
Greg Kroah-Hartman
1 parent
8d622085d6
iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
commit 2eacc608b3bf3519fc353c558454873f4589146d upstream. The ad7991/ad7995/ad7999 does not have a configuration register like the other devices that can be written and read. The configuration is written as part of the conversion sequence. Fixes: 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe and reset alert status on probe") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Tested-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 13 additions and 2 deletions Side-by-side Diff
drivers/iio/adc/ad799x.c
... | ... | @@ -143,9 +143,15 @@ |
143 | 143 | case ad7998: |
144 | 144 | return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG, |
145 | 145 | val); |
146 | - default: | |
146 | + case ad7992: | |
147 | + case ad7993: | |
148 | + case ad7994: | |
147 | 149 | return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG, |
148 | 150 | val); |
151 | + default: | |
152 | + /* Will be written when doing a conversion */ | |
153 | + st->config = val; | |
154 | + return 0; | |
149 | 155 | } |
150 | 156 | } |
151 | 157 | |
152 | 158 | |
... | ... | @@ -155,8 +161,13 @@ |
155 | 161 | case ad7997: |
156 | 162 | case ad7998: |
157 | 163 | return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG); |
158 | - default: | |
164 | + case ad7992: | |
165 | + case ad7993: | |
166 | + case ad7994: | |
159 | 167 | return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG); |
168 | + default: | |
169 | + /* No readback support */ | |
170 | + return st->config; | |
160 | 171 | } |
161 | 172 | } |
162 | 173 |