提交 89ca79af 编写于 作者: P Peter Meerwald 提交者: Jonathan Cameron

iio:adc:ad799x: Add helper function to read/write config register

16-bit on ad7997/ad7998, 8-bit elsewhere
Signed-off-by: NPeter Meerwald <pmeerw@pmeerw.net>
Acked-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 ef0bf6f8
......@@ -136,6 +136,30 @@ struct ad799x_state {
unsigned int transfer_size;
};
static int ad799x_write_config(struct ad799x_state *st, u16 val)
{
switch (st->id) {
case ad7997:
case ad7998:
return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG,
val);
default:
return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG,
val);
}
}
static int ad799x_read_config(struct ad799x_state *st)
{
switch (st->id) {
case ad7997:
case ad7998:
return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG);
default:
return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG);
}
}
/**
* ad799x_trigger_handler() bh of trigger launched polling to ring buffer
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册