Browse files

Fix power supply notification logic.

Now update the battery supply when a battery warning IRQ arrives and the
USB/AC supplies on a 'charge source changed' IRQ.
  • Loading branch information...
1 parent 86865e8 commit 791fea36f5d311dfe75e9f5c947ff09324137d6d @maniac103 maniac103 committed Oct 12, 2011
Showing with 17 additions and 7 deletions.
  1. +17 −7 drivers/misc/a6/a6.c
View
24 drivers/misc/a6/a6.c
@@ -3697,7 +3697,8 @@ void a6_irq_work_handler(struct work_struct *work)
container_of(work, struct a6_device_state, a6_irq_work);
struct a6_register_desc *reg_desc_status3, *reg_desc_status2;
uint8_t vals[id_size], reg_val_status3 = 0, reg_val_status2 = 0;
- bool update_dock = false;
+ bool charge_source_changed = false;
+ bool battery_changed = false;
int32_t ret = 0;
char *envp[] = {
[0] = "A6_ACTION=EMERGENCY_RESET_NOTIFY",
@@ -3858,7 +3859,7 @@ void a6_irq_work_handler(struct work_struct *work)
//sysfs_notify_dirent(state->notify_nodes[DIRENT_CHG_SRC_NOTIFY]);
/* Send uevent */
kobject_uevent_env(&state->i2c_dev->dev.kobj, KOBJ_CHANGE, &envp[4]);
- update_dock = true;
+ charge_source_changed = true;
}
/* log threshold change? */
@@ -3880,6 +3881,7 @@ void a6_irq_work_handler(struct work_struct *work)
/* Send uevent */
kobject_uevent_env(&state->i2c_dev->dev.kobj, KOBJ_CHANGE, &envp[10]);
+ battery_changed = true;
}
/* battery voltage low critical? */
@@ -3889,6 +3891,7 @@ void a6_irq_work_handler(struct work_struct *work)
/* Send uevent */
kobject_uevent_env(&state->i2c_dev->dev.kobj, KOBJ_CHANGE, &envp[12]);
+ battery_changed = true;
}
/* battery temp high critical? */
@@ -3916,6 +3919,7 @@ void a6_irq_work_handler(struct work_struct *work)
/* Send uevent */
kobject_uevent_env(&state->i2c_dev->dev.kobj, KOBJ_CHANGE, &envp[8]);
+ battery_changed = true;
}
/* battery low percent warn1? */
@@ -3925,6 +3929,7 @@ void a6_irq_work_handler(struct work_struct *work)
/* Send uevent */
kobject_uevent_env(&state->i2c_dev->dev.kobj, KOBJ_CHANGE, &envp[6]);
+ battery_changed = true;
}
}
@@ -3935,9 +3940,18 @@ void a6_irq_work_handler(struct work_struct *work)
if (!state->busy_count)
clear_bit(DEVICE_BUSY_BIT, state->flags);
- if (update_dock) {
+ if (charge_source_changed) {
a6_dock_update_state(state);
}
+ if (state->plat_data->power_supply_connected == 1 && batt_state != NULL) {
+ if (battery_changed) {
+ power_supply_changed(&a6_fish_power_supplies[0]);
+ }
+ if (charge_source_changed) {
+ power_supply_changed(&a6_fish_power_supplies[1]);
+ power_supply_changed(&a6_fish_power_supplies[2]);
+ }
+ }
A6_DPRINTK(A6_DEBUG_VERBOSE, KERN_ERR, "%s: Visited\n", __func__);
}
@@ -4800,10 +4814,6 @@ static int a6_i2c_resume (struct i2c_client *dev)
clear_bit(IS_SUSPENDED, state->flags);
if (test_and_clear_bit(INT_PENDING, state->flags)) {
queue_work(state->ka6d_workqueue, &state->a6_irq_work);
-
- if (state->plat_data->power_supply_connected == 1 &&
- batt_state != NULL)
- power_supply_changed(&a6_fish_power_supplies[0]);
}
a6_fish_battery_resume (state);

0 comments on commit 791fea3

Please sign in to comment.