Skip to contentSkip to conversation

mfd: tps6586x: avoid burst writes

PATCH In review [email protected] 2 participants 4 messages Feb 15, 2011 – Feb 18, 2011 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: tps6586x: avoid burst writes

tps6586 does not support burst writes. i2c writes have to be 1 byte at a time.

---
 drivers/mfd/tps6586x.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/tps6586x.c +5 -5
index c937742..0aa9186 100644
@@ -150,12 +150,12 @@ static inline int __tps6586x_write(struct i2c_client *client,
 static inline int __tps6586x_writes(struct i2c_client *client, int reg,
 				  int len, uint8_t *val)
 {
-	int ret;
+	int ret, i;
 
-	ret = i2c_smbus_write_i2c_block_data(client, reg, len, val);
-	if (ret < 0) {
-		dev_err(&client->dev, "failed writings to 0x%02x\n", reg);
-		return ret;
+	for (i = 0; i < len; i++) {
+		ret = __tps6586x_write(client, reg + i, *(val + i));
+		if (ret < 0)
+			return ret;
 	}
 
 	return 0;
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1297764222-29803-1-git-send-email-vwadekar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#2 lore raw
Quoted 2 lines · On Tue, Feb 15, 2011 at 03:33:42PM +0530…

tps6586 does not support burst writes. i2c writes have to be 1 byte at a time.

Don't know if there's ever block writes big enough to care but presumably some of the devices in this series do support this so perhaps the fallback to byte at a time should be conditional to avoid hurting those that can use block writes?
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 5 lines

Don't know if there's ever block writes big enough to care but presumably some of the devices in this series do support this so perhaps the fallback to byte at a time should be conditional to avoid hurting those that can use block writes?

Mark, confirmed with TI and they say that the entire tps6586x family has this behavior so this patch seems ok. The entire family has this limitation and so we have to write one byte at a time.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 3 lines · Varun Wadekar

Mark, confirmed with TI and they say that the entire tps6586x family has this behavior so this patch seems ok. The entire family has this limitation and so we have to write one byte at a time.

OK, that's good to have confirmed - in that case this should go into 2.6.38 as a bugfix since clearly any device which tries to do a bulk operation is broken at the minute.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html