mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 20:20:55 +07:00
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.
Fixes: 0f7ddcc1bf
("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>
This commit is contained in:
parent
9e8e228f2b
commit
2eacc608b3
@ -143,9 +143,15 @@ static int ad799x_write_config(struct ad799x_state *st, u16 val)
|
|||||||
case ad7998:
|
case ad7998:
|
||||||
return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG,
|
return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG,
|
||||||
val);
|
val);
|
||||||
default:
|
case ad7992:
|
||||||
|
case ad7993:
|
||||||
|
case ad7994:
|
||||||
return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG,
|
return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG,
|
||||||
val);
|
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 ad7997:
|
||||||
case ad7998:
|
case ad7998:
|
||||||
return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG);
|
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);
|
return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG);
|
||||||
|
default:
|
||||||
|
/* No readback support */
|
||||||
|
return st->config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user