Skip to contentSkip to conversation

patch "iio: dac: mcp4725: add missing powerdown bits in store eeprom" added to staging-linus

PATCH [email protected] 1 participant 1 message Apr 2, 2019

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio: dac: mcp4725: add missing powerdown bits in store eeprom

to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 06003531502d06bc89d32528f6ec96bf978790f9 Mon Sep 17 00:00:00 2001
From: Jean-Francois Dagenais <[email protected]>
Date: Wed, 6 Mar 2019 15:56:06 -0500
Subject: iio: dac: mcp4725: add missing powerdown bits in store eeprom

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".

---
 drivers/iio/dac/mcp4725.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iio/dac/mcp4725.c +1 -0
index 6d71fd905e29..c701a45469f6 100644
@@ -92,6 +92,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;
 
Signature · 1 line
2.21.0