Commit 64eb8a15 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

staging: iio: adc: ad7192: disable burnout currents on misconfig

The burnout currents can be enabled only if buffer is enabled
and CHOP is disabled.

So, if neither of these conditions are met, then
we should disable the burnout currents in the driver as well,
and warn the user.

This change doesn't fix anything.
The burnout currents simply won't work if CHOP is enabled
or buffer is disabled.
The intent is to provide the user with some feedback
instead of silently not working inside the chip.
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2a7fa90a
...@@ -290,8 +290,12 @@ static int ad7192_setup(struct ad7192_state *st, ...@@ -290,8 +290,12 @@ static int ad7192_setup(struct ad7192_state *st,
if (pdata->unipolar_en) if (pdata->unipolar_en)
st->conf |= AD7192_CONF_UNIPOLAR; st->conf |= AD7192_CONF_UNIPOLAR;
if (pdata->burnout_curr_en) if (pdata->burnout_curr_en && pdata->buf_en && !pdata->chop_en) {
st->conf |= AD7192_CONF_BURN; st->conf |= AD7192_CONF_BURN;
} else if (pdata->burnout_curr_en) {
dev_warn(&st->sd.spi->dev,
"Can't enable burnout currents: see CHOP or buffer\n");
}
ret = ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode); ret = ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment