This Linux kernel change "iio: dac: mcp4725: add missing powerdown bits in store eeprom" is included in the Linux 5.0.10 release. This change is authored by Jean-Francois Dagenais <jeff.dagenais [at] gmail.com> on Wed Mar 6 15:56:06 2019 -0500. The commit for this change in Linux stable tree is 5c526f2 (patch) which is from upstream commit 0600353. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 0600353.
iio: dac: mcp4725: add missing powerdown bits in store eeprom 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 <firstname.lastname@example.org> Acked-by: Peter Meerwald-Stadler <email@example.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
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 6d71fd9..c701a45 100644 --- a/drivers/iio/dac/mcp4725.c +++ b/drivers/iio/dac/mcp4725.c @@ -92,6 +92,7 @@ static ssize_t mcp4725_store_eeprom(struct device *dev, inoutbuf = 0x60; /* write EEPROM */ inoutbuf |= data->ref_mode << 3; + inoutbuf |= data->powerdown ? ((data->powerdown_mode + 1) << 1) : 0; inoutbuf = data->dac_value >> 4; inoutbuf = (data->dac_value & 0xf) << 4;