summaryrefslogtreecommitdiff
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
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>
-rw-r--r--board/firefly/usb_pd_policy.c4
-rw-r--r--board/fruitpie/usb_pd_policy.c5
-rw-r--r--board/plankton/usb_pd_policy.c4
-rw-r--r--board/ryu/usb_pd_policy.c4
-rw-r--r--board/samus_pd/usb_pd_policy.c36
-rw-r--r--board/zinger/usb_pd_policy.c5
-rw-r--r--common/host_command_pd.c4
-rw-r--r--common/usb_pd_protocol.c3
-rw-r--r--include/config.h4
-rw-r--r--include/usb_pd.h7
10 files changed, 4 insertions, 72 deletions
diff --git a/board/firefly/usb_pd_policy.c b/board/firefly/usb_pd_policy.c
index ade67246e4..7ddf6f65ed 100644
--- a/board/firefly/usb_pd_policy.c
+++ b/board/firefly/usb_pd_policy.c
@@ -126,7 +126,3 @@ int pd_board_checks(void)
return EC_SUCCESS;
}
-int pd_power_negotiation_allowed(void)
-{
- return 1;
-}
diff --git a/board/fruitpie/usb_pd_policy.c b/board/fruitpie/usb_pd_policy.c
index 9ae9720db2..e8886aabe8 100644
--- a/board/fruitpie/usb_pd_policy.c
+++ b/board/fruitpie/usb_pd_policy.c
@@ -123,11 +123,6 @@ int pd_board_checks(void)
return EC_SUCCESS;
}
-int pd_power_negotiation_allowed(void)
-{
- return 1;
-}
-
/* ----------------- Vendor Defined Messages ------------------ */
int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
{
diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c
index 5f238a7f99..c0d58e236b 100644
--- a/board/plankton/usb_pd_policy.c
+++ b/board/plankton/usb_pd_policy.c
@@ -137,7 +137,3 @@ int pd_board_checks(void)
return EC_SUCCESS;
}
-int pd_power_negotiation_allowed(void)
-{
- return 1;
-}
diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c
index 323a909585..fe8247de8d 100644
--- a/board/ryu/usb_pd_policy.c
+++ b/board/ryu/usb_pd_policy.c
@@ -124,7 +124,3 @@ int pd_board_checks(void)
return EC_SUCCESS;
}
-int pd_power_negotiation_allowed(void)
-{
- return 1;
-}
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;
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index f12ca9d7af..ff83c72dc0 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -279,11 +279,6 @@ int pd_board_checks(void)
}
-int pd_power_negotiation_allowed(void)
-{
- return 1;
-}
-
void pd_adc_interrupt(void)
{
/* cut the power output */
diff --git a/common/host_command_pd.c b/common/host_command_pd.c
index ed9f97a21e..2f27e00d3d 100644
--- a/common/host_command_pd.c
+++ b/common/host_command_pd.c
@@ -28,10 +28,6 @@ static void pd_exchange_status(void)
struct ec_response_pd_status pd_status;
int rv = 0, tries = 0;
- /*
- * TODO(crosbug.com/p/29499): Change sending state of charge to
- * remaining capacity for finer grained control.
- */
/* Send battery state of charge */
if (charge_get_flags() & CHARGE_FLAG_BATT_RESPONSIVE)
ec_status.batt_soc = charge_get_percent();
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 545eb36f8f..2c23c81024 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1066,8 +1066,7 @@ void pd_task(void)
timeout = 10*MSEC;
/* Source connection monitoring */
- if (pd_snk_is_vbus_provided(port) &&
- pd_power_negotiation_allowed()) {
+ if (pd_snk_is_vbus_provided(port)) {
cc1_volt = pd_adc_read(port, 0);
cc2_volt = pd_adc_read(port, 1);
if ((cc1_volt >= PD_SNK_VA) ||
diff --git a/include/config.h b/include/config.h
index 4161b8a6b5..6a36c4c5a3 100644
--- a/include/config.h
+++ b/include/config.h
@@ -908,10 +908,6 @@
/* USB PD MCU slave address for host commands */
#define CONFIG_USB_PD_I2C_SLAVE_ADDR 0x3c
-/* TODO(crosbug.com/p/29499): Determine threshold for power negotiation */
-/* USB PD minimum battery charge to negotiate for more power */
-#define CONFIG_USB_PD_MIN_BATT_CHARGE 1
-
/* Compile chip support for the USB device controller */
#undef CONFIG_USB
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 2ad76aa3d0..4703c8dcb0 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -208,13 +208,6 @@ void pd_request_source_voltage(int port, int mv);
*/
int pd_board_checks(void);
-/**
- * Query if power negotiation is allowed.
- *
- * @return true if negotation is allowed, false otherwise.
- */
-int pd_power_negotiation_allowed(void);
-
/*
* Handle Vendor Defined Message with our vendor ID.
*