aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/da9052-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/da9052-i2c.c')
-rw-r--r--drivers/mfd/da9052-i2c.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 6a9fec40d018..c319c4ef5d49 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -86,7 +86,11 @@ static int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
86 return 0; 86 return 0;
87} 87}
88 88
89static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) 89/*
90 * According to errata item 24, multiwrite mode should be avoided
91 * in order to prevent register data corruption after power-down.
92 */
93static int da9052_i2c_disable_multiwrite(struct da9052 *da9052)
90{ 94{
91 int reg_val, ret; 95 int reg_val, ret;
92 96
@@ -94,8 +98,8 @@ static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
94 if (ret < 0) 98 if (ret < 0)
95 return ret; 99 return ret;
96 100
97 if (reg_val & DA9052_CONTROL_B_WRITEMODE) { 101 if (!(reg_val & DA9052_CONTROL_B_WRITEMODE)) {
98 reg_val &= ~DA9052_CONTROL_B_WRITEMODE; 102 reg_val |= DA9052_CONTROL_B_WRITEMODE;
99 ret = regmap_write(da9052->regmap, DA9052_CONTROL_B_REG, 103 ret = regmap_write(da9052->regmap, DA9052_CONTROL_B_REG,
100 reg_val); 104 reg_val);
101 if (ret < 0) 105 if (ret < 0)
@@ -154,7 +158,7 @@ static int da9052_i2c_probe(struct i2c_client *client,
154 return ret; 158 return ret;
155 } 159 }
156 160
157 ret = da9052_i2c_enable_multiwrite(da9052); 161 ret = da9052_i2c_disable_multiwrite(da9052);
158 if (ret < 0) 162 if (ret < 0)
159 return ret; 163 return ret;
160 164