All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <michael.hennerich@analog.com>
Subject: Re: [PATCH v4] staging: iio: adc: ad7192: disable burnout currents on misconfig
Date: Sat, 20 Jan 2018 15:26:55 +0000	[thread overview]
Message-ID: <20180120152655.57ccd31f@archlinux> (raw)
In-Reply-To: <20180118145740.5113-1-alexandru.ardelean@analog.com>

On Thu, 18 Jan 2018 16:57:40 +0200
<alexandru.ardelean@analog.com> wrote:

> From: Alexandru Ardelean <alexandru.ardelean@analog.com>
> 
> 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>
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

Jonathan

> ---
> 
> Changes v3 -> v4:
>  * need to check if `pdata->burnout_curr_en` is positive on the
>    else path, otherwise a false warning may be thrown
> 
>  drivers/staging/iio/adc/ad7192.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
> index d11c6de9c777..9287b50b7870 100644
> --- a/drivers/staging/iio/adc/ad7192.c
> +++ b/drivers/staging/iio/adc/ad7192.c
> @@ -291,8 +291,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)


      reply	other threads:[~2018-01-20 15:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 11:14 [PATCH] staging: iio: adc: ad7192: disable burnout currents on misconfig alexandru.ardelean
2018-01-14 12:33 ` Jonathan Cameron
2018-01-18 14:38 ` [PATCH v3] " alexandru.ardelean
2018-01-18 14:57 ` [PATCH v4] " alexandru.ardelean
2018-01-20 15:26   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180120152655.57ccd31f@archlinux \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=alexandru.ardelean@analog.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.