Skip to content

Commit 8235841

Browse files
pmeerwjic23
authored andcommitted
iio:adc:ad799x: Set conversion channels and rename ad7997_8_update_scan_mode()
rename since function is used by all chips with ALERT pin, not just ad7997/8 Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 0f7ddcc commit 8235841

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎drivers/iio/adc/ad799x.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p)
208208
return IRQ_HANDLED;
209209
}
210210

211-
static int ad7997_8_update_scan_mode(struct iio_dev *indio_dev,
211+
static int ad799x_update_scan_mode(struct iio_dev *indio_dev,
212212
const unsigned long *scan_mask)
213213
{
214214
struct ad799x_state *st = iio_priv(indio_dev);
@@ -221,10 +221,14 @@ static int ad7997_8_update_scan_mode(struct iio_dev *indio_dev,
221221
st->transfer_size = bitmap_weight(scan_mask, indio_dev->masklength) * 2;
222222

223223
switch (st->id) {
224+
case ad7992:
225+
case ad7993:
226+
case ad7994:
224227
case ad7997:
225228
case ad7998:
226-
return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG,
227-
st->config | (*scan_mask << AD799X_CHANNEL_SHIFT));
229+
st->config &= ~(GENMASK(7, 0) << AD799X_CHANNEL_SHIFT);
230+
st->config |= (*scan_mask << AD799X_CHANNEL_SHIFT);
231+
return ad799x_write_config(st, st->config);
228232
default:
229233
return 0;
230234
}
@@ -483,7 +487,7 @@ static const struct iio_info ad7991_info = {
483487
static const struct iio_info ad7993_4_7_8_noirq_info = {
484488
.read_raw = &ad799x_read_raw,
485489
.driver_module = THIS_MODULE,
486-
.update_scan_mode = ad7997_8_update_scan_mode,
490+
.update_scan_mode = ad799x_update_scan_mode,
487491
};
488492

489493
static const struct iio_info ad7993_4_7_8_irq_info = {
@@ -493,7 +497,7 @@ static const struct iio_info ad7993_4_7_8_irq_info = {
493497
.read_event_value = &ad799x_read_event_value,
494498
.write_event_value = &ad799x_write_event_value,
495499
.driver_module = THIS_MODULE,
496-
.update_scan_mode = ad7997_8_update_scan_mode,
500+
.update_scan_mode = ad799x_update_scan_mode,
497501
};
498502

499503
static const struct iio_event_spec ad799x_events[] = {

0 commit comments

Comments
 (0)