charger: Send host event after charge info is updated.

When the charger is detached, the host event would sometimes be
sent before the charge info was updated, resulting in the host
thinking that the charger was still connected.

BUG=chrome-os-partner:55584
BRANCH=none
TEST=Connected charger to kevin 15 times and verified that the
icon was removed in 2-seconds or less.
Change-Id: I1a4e4e0f7cc23010210570fc261da8308d8e8070
Reviewed-on: https://chromium-review.googlesource.com/367809
Commit-Ready: Wonjoon Lee <woojoo.lee@samsung.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Sam Hurst
2016-08-10 15:09:21 -07:00
committed by chrome-bot
parent 0dd5175c85
commit c5bd6d98b9
12 changed files with 4 additions and 52 deletions

View File

@@ -87,8 +87,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -101,9 +99,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_board_checks(void)

View File

@@ -82,8 +82,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -96,9 +94,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_snk_is_vbus_provided(int port)

View File

@@ -81,8 +81,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -94,9 +92,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_snk_is_vbus_provided(int port)

View File

@@ -84,8 +84,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -98,9 +96,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_board_checks(void)

View File

@@ -87,8 +87,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -101,9 +99,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
#endif
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_board_checks(void)

View File

@@ -45,9 +45,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -57,9 +54,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_is_valid_input_voltage(int mv)

View File

@@ -87,9 +87,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -99,9 +96,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_snk_is_vbus_provided(int port)

View File

@@ -73,7 +73,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* notify host of power info change */
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -85,8 +84,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
#endif
/* notify host of power info change */
}
int pd_snk_is_vbus_provided(int port)

View File

@@ -78,7 +78,6 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* notify host of power info change */
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -90,8 +89,6 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
#endif
/* notify host of power info change */
}
int pd_snk_is_vbus_provided(int port)

View File

@@ -546,6 +546,10 @@ static void charge_manager_refresh(void)
board_set_charge_limit(new_port, new_supplier,
new_charge_current);
#endif /* HAS_TASK_CHG_RAMP */
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
CPRINTS("CL: p%d s%d i%d v%d", new_port, new_supplier,
new_charge_current, new_charge_voltage);
}

View File

@@ -284,9 +284,6 @@ static int bd99955_bc12_detect(int port)
charge.voltage = USB_CHARGER_VOLTAGE_MV;
charge.current = bd99955_get_bc12_ilim(bc12_type);
charge_manager_update_charge(bc12_type, port, &charge);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
return bc12_type;
@@ -304,9 +301,6 @@ static void bd99955_bc12_detach(int port, int type)
/* Disable charging trigger by BC1.2 detection */
bd99955_bc12_enable_charging(port, 0);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
static int bd99955_enable_vbus_detect_interrupts(int port, int enable)

View File

@@ -342,9 +342,6 @@ static void bc12_detect(int port)
port,
&charge);
}
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void usb_charger_task(void)