iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
Subsystems (2)
PATCH 1/1 iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
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.
--- drivers/iio/adc/ad799x.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/iio/adc/ad799x.c +13 -2
@@ -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; } }
Signature · 1 line
1.8.0
Tested it on the Miami board, and this patch indeed fixes the issue. You can add my tested-by if you like:
Quoted 37 lines · Lars-Peter Clausen
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 <[email protected]>--- drivers/iio/adc/ad799x.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/iio/adc/ad799x.c +7
-2@@ -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 :
drivers/iio/adc/ad799x.c static int ad799x_read_config(struct ad799x_state *st) · line 173
Quoted 10 lines
drivers/iio/adc/ad799x.c +6
-0+case ad7992: +case ad7993: +case ad7994:return i2c_smbus_read_byte_data (st->client,AD7998_CONF_REG ); +default : +/* No readback support */ +return st->config; } }
Met vriendelijke groet / kind regards,
Mike Looijmans
System Expert
TOPIC Embedded Systems Eindhovenseweg 32-C, NL-5683 KH Best Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax: (+31) (0) 499 33 69 70
E-mail: [email protected]
Website: www.topic.nl
Please consider the environment before printing this e-mail
Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/
Quoted 3 lines · Mike Looijmans
Tested it on the Miami board, and this patch indeed fixes the issue. You can add my tested-by if you like:
Tested-by Mike Looijmans <[email protected]>
Applied to the fixes-togreg branch of iio.git
Thanks,
Jonathan
Quoted 76 lines · Lars-Peter Clausen
Quoted 37 lines
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 <[email protected]>--- drivers/iio/adc/ad799x.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/iio/adc/ad799x.c +7
-2@@ -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 :drivers/iio/adc/ad799x.c static int ad799x_read_config(struct ad799x_state *st) · line 173
Quoted 10 lines
drivers/iio/adc/ad799x.c +6
-0+case ad7992: +case ad7993: +case ad7994:return i2c_smbus_read_byte_data (st->client,AD7998_CONF_REG ); +default : +/* No readback support */ +return st->config; } }Met vriendelijke groet / kind regards,
Mike Looijmans
System ExpertTOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax: (+31) (0) 499 33 69 70
E-mail: [email protected]
Website: www.topic.nlPlease consider the environment before printing this e-mail
Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html