summaryrefslogtreecommitdiff
path: root/board/samus_pd/usb_pd_policy.c
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-08-04 15:09:36 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-06 04:36:44 +0000
commit02d313201ffe48dd4157aa30ce36d3f4e08cb383 (patch)
tree3596176a462a74714e6de9494c5ede27e608a9c5 /board/samus_pd/usb_pd_policy.c
parente1557b0f42a64eb6c973d43a34158888905e33b9 (diff)
downloadchrome-ec-02d313201ffe48dd4157aa30ce36d3f4e08cb383.tar.gz
samus_pd: remove dead code around allowing PD negotiation
Remove code for preventing PD negotiation until the battery is at some minimum SOC. This was originally necessary because transitioning voltages would cause the source voltage to go briefly to 0V, which would kill power to the system unless the battery was at some minimum level of charge. But, that isn't true anymore. It is safe to transition up or down in voltage and the source voltage should never drop to 0V. BUG=chrome-os-partner:29499 BRANCH=none TEST=make -j buildall. No need to do any more testing because this code has been disabled for a while. Change-Id: I8a3dca117f01f0f9c7d04b5d489e4a8588a89be6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211021 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/samus_pd/usb_pd_policy.c')
-rw-r--r--board/samus_pd/usb_pd_policy.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index eeac9362cf..115a7812a8 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -33,8 +33,8 @@ const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
/* Cap on the max voltage requested as a sink (in millivolts) */
static unsigned max_mv = -1; /* no cap */
-/* Flag for battery status */
-static int battery_ok = 1;
+/* Battery state of charge percentage */
+static int batt_soc;
int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo)
{
@@ -43,10 +43,6 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo)
int max_uw = 0;
int max_i = -1;
- /* Don't negotiate power until battery ok signal is given */
- if (!battery_ok)
- return -EC_ERROR_UNKNOWN;
-
/* Get max power */
for (i = 0; i < cnt; i++) {
int uw;
@@ -142,25 +138,9 @@ static void pd_send_ec_int(void)
int pd_board_checks(void)
{
- static uint64_t last_time;
-
- /*
- * If battery is not yet ok, signal EC to send status. Avoid
- * sending requests too frequently.
- */
- if (!battery_ok && (get_time().val - last_time >= SECOND)) {
- last_time = get_time().val;
- pd_send_ec_int();
- }
-
return EC_SUCCESS;
}
-int pd_power_negotiation_allowed(void)
-{
- return battery_ok;
-}
-
static void dual_role_on(void)
{
pd_set_dual_role(PD_DRP_TOGGLE_ON);
@@ -232,17 +212,7 @@ static int ec_status_host_cmd(struct host_cmd_handler_args *args)
const struct ec_params_pd_status *p = args->params;
struct ec_response_pd_status *r = args->response;
- if (p->batt_soc >= CONFIG_USB_PD_MIN_BATT_CHARGE) {
- /*
- * When battery is above minimum charge, we know
- * that we have enough power remaining for us to
- * negotiate power over PD.
- */
- CPRINTS("Battery is ok, safe to negotiate power");
- battery_ok = 1;
- } else {
- battery_ok = 0;
- }
+ batt_soc = p->batt_soc;
r->status = 0;