Commit b64f51c4 authored by Rupesh Kumar's avatar Rupesh Kumar Committed by Lee Jones

pm2301-charger: Wake device on register access

When USB  Dedicated or Standard host chargers are plugged into
the device, chargealg attempts to disable the PM2301 AC charger,
However, disabling PM2301 was failing because of it being in
runtime suepend mode & LPN pin being low.
Signed-off-by: default avatarRupesh Kumar <rupesh.kumar@stericsson.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Reviewed-by: default avatarMarcus COOPER <marcus.xm.cooper@stericsson.com>
Reviewed-by: default avatarPhilippe LANGLAIS <philippe.langlais@stericsson.com>
parent 7a2cf9ba
...@@ -128,13 +128,9 @@ static void clear_lpn_pin(struct pm2xxx_charger *pm2) ...@@ -128,13 +128,9 @@ static void clear_lpn_pin(struct pm2xxx_charger *pm2)
static int pm2xxx_reg_read(struct pm2xxx_charger *pm2, int reg, u8 *val) static int pm2xxx_reg_read(struct pm2xxx_charger *pm2, int reg, u8 *val)
{ {
int ret; int ret;
/*
* When AC adaptor is unplugged, the host /* wake up the device */
* must put LPN high to be able to pm_runtime_get_sync(pm2->dev);
* communicate by I2C with PM2301
* and receive I2C "acknowledge" from PM2301.
*/
mutex_lock(&pm2->lock);
ret = i2c_smbus_read_i2c_block_data(pm2->config.pm2xxx_i2c, reg, ret = i2c_smbus_read_i2c_block_data(pm2->config.pm2xxx_i2c, reg,
1, val); 1, val);
...@@ -142,7 +138,6 @@ static int pm2xxx_reg_read(struct pm2xxx_charger *pm2, int reg, u8 *val) ...@@ -142,7 +138,6 @@ static int pm2xxx_reg_read(struct pm2xxx_charger *pm2, int reg, u8 *val)
dev_err(pm2->dev, "Error reading register at 0x%x\n", reg); dev_err(pm2->dev, "Error reading register at 0x%x\n", reg);
else else
ret = 0; ret = 0;
mutex_unlock(&pm2->lock);
return ret; return ret;
} }
...@@ -150,13 +145,9 @@ static int pm2xxx_reg_read(struct pm2xxx_charger *pm2, int reg, u8 *val) ...@@ -150,13 +145,9 @@ static int pm2xxx_reg_read(struct pm2xxx_charger *pm2, int reg, u8 *val)
static int pm2xxx_reg_write(struct pm2xxx_charger *pm2, int reg, u8 val) static int pm2xxx_reg_write(struct pm2xxx_charger *pm2, int reg, u8 val)
{ {
int ret; int ret;
/*
* When AC adaptor is unplugged, the host /* wake up the device */
* must put LPN high to be able to pm_runtime_get_sync(pm2->dev);
* communicate by I2C with PM2301
* and receive I2C "acknowledge" from PM2301.
*/
mutex_lock(&pm2->lock);
ret = i2c_smbus_write_i2c_block_data(pm2->config.pm2xxx_i2c, reg, ret = i2c_smbus_write_i2c_block_data(pm2->config.pm2xxx_i2c, reg,
1, &val); 1, &val);
...@@ -164,7 +155,6 @@ static int pm2xxx_reg_write(struct pm2xxx_charger *pm2, int reg, u8 val) ...@@ -164,7 +155,6 @@ static int pm2xxx_reg_write(struct pm2xxx_charger *pm2, int reg, u8 val)
dev_err(pm2->dev, "Error writing register at 0x%x\n", reg); dev_err(pm2->dev, "Error writing register at 0x%x\n", reg);
else else
ret = 0; ret = 0;
mutex_unlock(&pm2->lock);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment