From: Jonathan Cameron <jic23@kernel.org>
To: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Cc: linux-iio@vger.kernel.org, Peter Meerwald <pmeerw@pmeerw.net>
Subject: Re: [PATCH] iio: dac: mcp4725: add missing powerdown bits in store eeprom
Date: Sat, 9 Mar 2019 18:27:54 +0000 [thread overview]
Message-ID: <20190309182754.5222143b@archlinux> (raw)
In-Reply-To: <20190306205606.30419-1-jeff.dagenais@gmail.com>
+Cc Peter.
On Wed, 6 Mar 2019 15:56:06 -0500
Jean-Francois Dagenais <jeff.dagenais@gmail.com> wrote:
> When issuing the write DAC register and write eeprom command, the two
> powerdown bits (PD0 and PD1) are assumed by the chip to be present in
> the bytes sent. Leaving them at 0 implies "powerdown disabled" which is
> a different state that the current one. By adding the current state of
> the powerdown in the i2c write, the chip will correctly power-on exactly
> like as it is at the moment of store_eeprom call.
>
> This is documented in MCP4725's datasheet, FIGURE 6-2: "Write Commands
> for DAC Input Register and EEPROM" and MCP4726's datasheet, FIGURE 6-3:
> "Write All Memory Command".
>
> Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
sounds fine to me, but I'd like to give Peter a chance to comment.
Give me a poke if it turns out Peter is busy and doesn't get back
to us in a week or two.
Thanks,
Jonathan
> ---
> drivers/iio/dac/mcp4725.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
> index 6ab1f23e5a79..97bb350d1e77 100644
> --- a/drivers/iio/dac/mcp4725.c
> +++ b/drivers/iio/dac/mcp4725.c
> @@ -98,6 +98,7 @@ static ssize_t mcp4725_store_eeprom(struct device *dev,
>
> inoutbuf[0] = 0x60; /* write EEPROM */
> inoutbuf[0] |= data->ref_mode << 3;
> + inoutbuf[0] |= data->powerdown ? ((data->powerdown_mode+1) << 1) : 0;
> inoutbuf[1] = data->dac_value >> 4;
> inoutbuf[2] = (data->dac_value & 0xf) << 4;
>
next prev parent reply other threads:[~2019-03-09 18:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 20:56 [PATCH] iio: dac: mcp4725: add missing powerdown bits in store eeprom Jean-Francois Dagenais
2019-03-09 18:27 ` Jonathan Cameron [this message]
2019-03-10 11:31 ` Peter Meerwald-Stadler
2019-03-16 15:16 ` 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=20190309182754.5222143b@archlinux \
--to=jic23@kernel.org \
--cc=jeff.dagenais@gmail.com \
--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