mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
charger: smb345: monitor AICL result in case of VBUS drop
VBUS drop level may not affect VBUS_DET to trigger IRQ, it results in AICL result much lower without being noticed, we check AICL result during battery polling and reconfig it if neccessary Bug: 10812199 Change-Id: I98dde8cdd5061d02851cb5f519c437b220906add Signed-off-by: Hank_Lee <Hank_Lee@asus.com>
This commit is contained in:
parent
43c063e913
commit
e7204e7b83
2 changed files with 6 additions and 18 deletions
|
@ -84,6 +84,7 @@ static int bq27541_get_property(struct power_supply *psy,
|
|||
enum power_supply_property psp, union power_supply_propval *val);
|
||||
extern unsigned get_usb_cable_status(void);
|
||||
extern int smb345_config_thermal_charging(int temp, int volt, int rule);
|
||||
extern void reconfig_AICL(void);
|
||||
|
||||
module_param(battery_current, uint, 0644);
|
||||
module_param(battery_remaining_capacity, uint, 0644);
|
||||
|
@ -380,6 +381,7 @@ static void battery_status_poll(struct work_struct *work)
|
|||
if(!bq27541_battery_driver_ready)
|
||||
BAT_NOTICE("battery driver not ready\n");
|
||||
|
||||
reconfig_AICL();
|
||||
power_supply_changed(&bq27541_supply[Charger_Type_Battery]);
|
||||
|
||||
if (!bq27541_device->temp_err) {
|
||||
|
|
|
@ -453,17 +453,7 @@ error:
|
|||
|
||||
static irqreturn_t smb345_inok_isr(int irq, void *dev_id)
|
||||
{
|
||||
struct smb345_charger *smb = dev_id;
|
||||
int status = gpio_get_value(GPIO_AC_OK);
|
||||
|
||||
SMB_NOTICE("VBUS_DET = %s\n", status ? "H" : "L");
|
||||
|
||||
if (ac_on && !status)
|
||||
queue_delayed_work(smb345_wq, &smb->cable_det_work, 0);
|
||||
else {
|
||||
if (delayed_work_pending(&charger->cable_det_work))
|
||||
cancel_delayed_work(&charger->cable_det_work);
|
||||
}
|
||||
SMB_NOTICE("VBUS_DET = %s\n", gpio_get_value(GPIO_AC_OK) ? "H" : "L");
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
@ -654,13 +644,10 @@ static void wireless_set_current_function(struct work_struct *dat)
|
|||
queue_delayed_work(smb345_wq, &charger->wireless_set_current_work, WPC_SET_CURT_INTERVAL);
|
||||
}
|
||||
|
||||
static void cable_det_work_function(struct work_struct *dat)
|
||||
void reconfig_AICL(void)
|
||||
{
|
||||
struct i2c_client *client = charger->client;
|
||||
|
||||
if (delayed_work_pending(&charger->cable_det_work))
|
||||
cancel_delayed_work(&charger->cable_det_work);
|
||||
|
||||
if (ac_on && !gpio_get_value(GPIO_AC_OK)) {
|
||||
int retval;
|
||||
retval = smb345_read(client, smb345_STS_REG_E);
|
||||
|
@ -668,7 +655,7 @@ static void cable_det_work_function(struct work_struct *dat)
|
|||
dev_err(&client->dev, "%s(): Failed in reading 0x%02x",
|
||||
__func__, smb345_STS_REG_E);
|
||||
else {
|
||||
SMB_NOTICE("Status Reg E=0x02%x\n", retval);
|
||||
SMB_NOTICE("Status Reg E=0x%02x\n", retval);
|
||||
|
||||
if ((retval & 0xF) <= 0x1) {
|
||||
SMB_NOTICE("reconfig input current limit\n");
|
||||
|
@ -677,6 +664,7 @@ static void cable_det_work_function(struct work_struct *dat)
|
|||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(reconfig_AICL);
|
||||
|
||||
static int smb345_inok_irq(struct smb345_charger *smb)
|
||||
{
|
||||
|
@ -1242,8 +1230,6 @@ static int __devinit smb345_probe(struct i2c_client *client,
|
|||
wireless_det_work_function);
|
||||
INIT_DELAYED_WORK_DEFERRABLE(&charger->wireless_set_current_work,
|
||||
wireless_set_current_function);
|
||||
INIT_DELAYED_WORK_DEFERRABLE(&charger->cable_det_work,
|
||||
cable_det_work_function);
|
||||
|
||||
wake_lock_init(&charger_wakelock, WAKE_LOCK_SUSPEND,
|
||||
"charger_configuration");
|
||||
|
|
Loading…
Reference in a new issue