]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
iio: dac: mcp4725: add missing powerdown bits in store eeprom
authorJean-Francois Dagenais <jeff.dagenais@gmail.com>
Wed, 6 Mar 2019 20:56:06 +0000 (15:56 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit7157689cf3506b570ce719f6c21dbf901ff9dd0e
treecdb47daa7eace67ea19bb3ae8ce16968a3df195e
parent7918bf9e6160f8a202ed5646859869696c19373c
iio: dac: mcp4725: add missing powerdown bits in store eeprom

BugLink: https://bugs.launchpad.net/bugs/1838349
commit 06003531502d06bc89d32528f6ec96bf978790f9 upstream.

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>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/iio/dac/mcp4725.c