diff options
author | Aaron Durbin | 2014-05-20 06:01:38 -0600 |
---|---|---|
committer | Minkyu Kang | 2014-05-28 10:58:19 +0900 |
commit | 0b259dc2e849183dfea604fa137bb616e09b319a (patch) | |
tree | 2dd60aab6e8ea483fc3a0080bf0d09c6bc6b5f19 /drivers/power/power_i2c.c | |
parent | 2469bf35a8c4fde242300c8123406cdc3b3b464c (diff) |
power: Explicitly select pmic device's bus
The current pmic i2c code assumes the current i2c bus is
the same as the pmic device's bus. There is nothing ensuring
that to be true. Therefore, select the proper bus before performing
a transaction.
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'drivers/power/power_i2c.c')
-rw-r--r-- | drivers/power/power_i2c.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/power/power_i2c.c b/drivers/power/power_i2c.c index ac768708ead..594cd11725e 100644 --- a/drivers/power/power_i2c.c +++ b/drivers/power/power_i2c.c @@ -23,6 +23,8 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val) if (check_reg(p, reg)) return -1; + I2C_SET_BUS(p->bus); + switch (pmic_i2c_tx_num) { case 3: if (p->sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG) { @@ -66,6 +68,8 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val) if (check_reg(p, reg)) return -1; + I2C_SET_BUS(p->bus); + if (i2c_read(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num)) return -1; |