From bbae0860c1b8ef0203abc55e9cd040bd3f7af9ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Thu, 28 Feb 2013 18:42:37 +0800 Subject: [PATCH] tps65910&rk610:Solve communication conflict when rk610 and tps65910 on the same i2c --- drivers/mfd/tps65910.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index ced0c602c732..5c279a0a02c3 100755 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -157,13 +157,8 @@ int tps65910_bulk_read(struct tps65910 *tps65910, u8 reg, int count, u8 *buf) { int ret; -#if 0 - mutex_lock(&tps65910->io_mutex); - - ret = tps65910->read(tps65910, reg, count, buf); - - mutex_unlock(&tps65910->io_mutex); -#else + +#if defined(CONFIG_MFD_RK610) int i; //Solve communication conflict when rk610 and 65910 on the same i2c mutex_lock(&tps65910->io_mutex); @@ -177,6 +172,12 @@ int tps65910_bulk_read(struct tps65910 *tps65910, u8 reg, buf[i] = ret & 0x000000FF; } } + mutex_unlock(&tps65910->io_mutex); +#else + mutex_lock(&tps65910->io_mutex); + + ret = tps65910->read(tps65910, reg, count, buf); + mutex_unlock(&tps65910->io_mutex); #endif return 0; @@ -188,13 +189,8 @@ int tps65910_bulk_write(struct tps65910 *tps65910, u8 reg, int count, u8 *buf) { int ret; -#if 0 - mutex_lock(&tps65910->io_mutex); - ret = tps65910->write(tps65910, reg, count, buf); - - mutex_unlock(&tps65910->io_mutex); -#else +#if defined(CONFIG_MFD_RK610) int i; // //Solve communication conflict when rk610 and 65910 on the same i2c mutex_lock(&tps65910->io_mutex); @@ -206,6 +202,12 @@ int tps65910_bulk_write(struct tps65910 *tps65910, u8 reg, return ret; } } + mutex_unlock(&tps65910->io_mutex); +#else + mutex_lock(&tps65910->io_mutex); + + ret = tps65910->write(tps65910, reg, count, buf); + mutex_unlock(&tps65910->io_mutex); #endif return 0; -- 2.34.1