public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: ad5504: Fix setting power-down state
Date: Sun, 13 Dec 2020 16:55:30 +0000	[thread overview]
Message-ID: <20201213165530.18dce485@archlinux> (raw)
In-Reply-To: <20201209104649.5794-1-lars@metafoo.de>

On Wed,  9 Dec 2020 11:46:49 +0100
Lars-Peter Clausen <lars@metafoo.de> wrote:

> The power-down mask of the ad5504 is actually a power-up mask. Meaning if
> a bit is set the corresponding channel is powered up and if it is not set
> the channel is powered down.
> 
> The driver currently has this the wrong way around, resulting in the
> channel being powered up when requested to be powered down and vice versa.
> 
> Fixes: 3bbbf150ffde ("staging:iio:dac:ad5504: Use strtobool for boolean values")
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
> Stumbled upon this while looking at something else. It is untested, but I
> think it should be right. Alex can you double check?

I read the datasheet as saying this fix is right but will wait for
a confirmation from Alex.

Thanks,

Jonathan

> ---
>  drivers/iio/dac/ad5504.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
> index 28921b62e642..e9297c25d4ef 100644
> --- a/drivers/iio/dac/ad5504.c
> +++ b/drivers/iio/dac/ad5504.c
> @@ -187,9 +187,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
>  		return ret;
>  
>  	if (pwr_down)
> -		st->pwr_down_mask |= (1 << chan->channel);
> -	else
>  		st->pwr_down_mask &= ~(1 << chan->channel);
> +	else
> +		st->pwr_down_mask |= (1 << chan->channel);
>  
>  	ret = ad5504_spi_write(st, AD5504_ADDR_CTRL,
>  				AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) |


  reply	other threads:[~2020-12-13 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 10:46 [PATCH] iio: ad5504: Fix setting power-down state Lars-Peter Clausen
2020-12-13 16:55 ` Jonathan Cameron [this message]
2020-12-14  7:23   ` Alexandru Ardelean
2020-12-29 18:28     ` Jonathan Cameron

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=20201213165530.18dce485@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox