summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2016-08-10 15:09:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-24 17:40:38 -0700
commitc5bd6d98b9c0799b2c7409d95af980fcdc1e44ea (patch)
tree11ee40a4235280cdfd6358f4d09e6e8cd564e49b
parent0dd5175c85775fdae7733cea2743c51fa6431380 (diff)
downloadchrome-ec-c5bd6d98b9c0799b2c7409d95af980fcdc1e44ea.tar.gz
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>
-rw-r--r--board/amenia/usb_pd_policy.c5
-rw-r--r--board/chell/usb_pd_policy.c5
-rw-r--r--board/glados/usb_pd_policy.c5
-rw-r--r--board/kevin/usb_pd_policy.c5
-rw-r--r--board/reef/usb_pd_policy.c5
-rw-r--r--board/ryu/usb_pd_policy.c6
-rw-r--r--board/samus_pd/usb_pd_policy.c6
-rw-r--r--board/strago/usb_pd_policy.c3
-rw-r--r--board/wheatley/usb_pd_policy.c3
-rw-r--r--common/charge_manager.c4
-rw-r--r--driver/charger/bd99955.c6
-rw-r--r--driver/usb_switch_pi3usb9281.c3
12 files changed, 4 insertions, 52 deletions
diff --git a/board/amenia/usb_pd_policy.c b/board/amenia/usb_pd_policy.c
index df2d69770c..1348099836 100644
--- a/board/amenia/usb_pd_policy.c
+++ b/board/amenia/usb_pd_policy.c
@@ -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)
diff --git a/board/chell/usb_pd_policy.c b/board/chell/usb_pd_policy.c
index cf57b09345..efe2b953c5 100644
--- a/board/chell/usb_pd_policy.c
+++ b/board/chell/usb_pd_policy.c
@@ -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)
diff --git a/board/glados/usb_pd_policy.c b/board/glados/usb_pd_policy.c
index d50450d557..77aa25a8e3 100644
--- a/board/glados/usb_pd_policy.c
+++ b/board/glados/usb_pd_policy.c
@@ -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)
diff --git a/board/kevin/usb_pd_policy.c b/board/kevin/usb_pd_policy.c
index c5849a8c44..934f0406bc 100644
--- a/board/kevin/usb_pd_policy.c
+++ b/board/kevin/usb_pd_policy.c
@@ -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)
diff --git a/board/reef/usb_pd_policy.c b/board/reef/usb_pd_policy.c
index 92a84c9b64..d078a5a2b6 100644
--- a/board/reef/usb_pd_policy.c
+++ b/board/reef/usb_pd_policy.c
@@ -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)
diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c
index e4b45bece0..86e1f96fad 100644
--- a/board/ryu/usb_pd_policy.c
+++ b/board/ryu/usb_pd_policy.c
@@ -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)
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 7b51e3e38e..875234a9fb 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -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)
diff --git a/board/strago/usb_pd_policy.c b/board/strago/usb_pd_policy.c
index 162c8a0d5e..214d52295e 100644
--- a/board/strago/usb_pd_policy.c
+++ b/board/strago/usb_pd_policy.c
@@ -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)
diff --git a/board/wheatley/usb_pd_policy.c b/board/wheatley/usb_pd_policy.c
index 5f0f8c5761..923cdcbbec 100644
--- a/board/wheatley/usb_pd_policy.c
+++ b/board/wheatley/usb_pd_policy.c
@@ -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)
diff --git a/common/charge_manager.c b/common/charge_manager.c
index a263277db6..13f85e38d0 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -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);
}
diff --git a/driver/charger/bd99955.c b/driver/charger/bd99955.c
index c12b7949a5..d73669dbe9 100644
--- a/driver/charger/bd99955.c
+++ b/driver/charger/bd99955.c
@@ -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)
diff --git a/driver/usb_switch_pi3usb9281.c b/driver/usb_switch_pi3usb9281.c
index 340df9df11..e97a04f8db 100644
--- a/driver/usb_switch_pi3usb9281.c
+++ b/driver/usb_switch_pi3usb9281.c
@@ -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)