summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/adc/ad7192.c
diff options
context:
space:
mode:
authorAlexandru Ardelean2018-01-18 15:57:40 +0100
committerJonathan Cameron2018-01-30 19:33:21 +0100
commit64eb8a15a439b56243697237bab6e2c48281138c (patch)
tree0dcce9dec8123950e11c0e1c823e950e9e8f727c /drivers/staging/iio/adc/ad7192.c
parentiio: ep93xx: remove redundant return value check of platform_get_resource() (diff)
downloadkernel-qcow2-linux-64eb8a15a439b56243697237bab6e2c48281138c.tar.gz
kernel-qcow2-linux-64eb8a15a439b56243697237bab6e2c48281138c.tar.xz
kernel-qcow2-linux-64eb8a15a439b56243697237bab6e2c48281138c.zip
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: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging/iio/adc/ad7192.c')
-rw-r--r--drivers/staging/iio/adc/ad7192.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index f01595593ce2..079a8410d664 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -290,8 +290,12 @@ static int ad7192_setup(struct ad7192_state *st,
if (pdata->unipolar_en)
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;
+ } 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);
if (ret)