From: 张晴 Date: Thu, 28 Feb 2013 10:19:28 +0000 (+0800) Subject: tps65910&rk610:Solve communication conflict when rk610 and tps65910 on the same i2c X-Git-Tag: firefly_0821_release~7497 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6465a37ed910cd2dc635d2d90e4da07941e9bfa8;p=firefly-linux-kernel-4.4.55.git tps65910&rk610:Solve communication conflict when rk610 and tps65910 on the same i2c --- diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index dd67d3110df2..ced0c602c732 100755 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -157,14 +157,30 @@ 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 + int i; //Solve communication conflict when rk610 and 65910 on the same i2c + + mutex_lock(&tps65910->io_mutex); + for(i=0; iio_mutex); + return ret; + }else{ + buf[i] = ret & 0x000000FF; + } + } + mutex_unlock(&tps65910->io_mutex); +#endif + return 0; - return ret; } EXPORT_SYMBOL_GPL(tps65910_bulk_read); @@ -172,14 +188,28 @@ 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 + int i; // //Solve communication conflict when rk610 and 65910 on the same i2c + + mutex_lock(&tps65910->io_mutex); + for(i=0; iio_mutex); + return ret; + } + } + mutex_unlock(&tps65910->io_mutex); +#endif + return 0; - return ret; } EXPORT_SYMBOL_GPL(tps65910_bulk_write);