mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user