summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-01-17 11:31:43 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-17 23:19:47 +0000
commit7fc407a93437929ec925c3041051a41bd2e83df6 (patch)
tree744b55b8a371b9bfba5df958b24cbf4865a35f55 /board
parent13827088583ebe46c89fd0bb4d7889ccb5f9b948 (diff)
downloadchrome-ec-7fc407a93437929ec925c3041051a41bd2e83df6.tar.gz
pd: samus: do not request voltage within boost bypass deadband
Do not request a voltage that is within the deadband where we aren't sure if the boost or the boost bypass is on. BUG=chrome-os-partner:34938 BRANCH=samus TEST=test on samus with zinger. change the deadband to [10V, 20V] and see that we only negotiate to 5V. change the deadband to [13V, 20V] and see that we negotiate to 12V. change the deadband to [10V, 13V] and see that we negotiate to 20V. Change-Id: Id761aef35eeadfa2ab7d2ca31a48d4324625ab32 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/241528 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/dingdong/usb_pd_policy.c6
-rw-r--r--board/firefly/usb_pd_policy.c6
-rw-r--r--board/fruitpie/usb_pd_policy.c6
-rw-r--r--board/hoho/usb_pd_policy.c6
-rw-r--r--board/host/usb_pd_policy.c6
-rw-r--r--board/plankton/usb_pd_policy.c6
-rw-r--r--board/ryu/usb_pd_policy.c6
-rw-r--r--board/ryu_p1/usb_pd_policy.c6
-rw-r--r--board/samus_pd/usb_pd_policy.c14
-rw-r--r--board/twinkie/usb_pd_policy.c6
10 files changed, 68 insertions, 0 deletions
diff --git a/board/dingdong/usb_pd_policy.c b/board/dingdong/usb_pd_policy.c
index 520732cd26..7122bfab3d 100644
--- a/board/dingdong/usb_pd_policy.c
+++ b/board/dingdong/usb_pd_policy.c
@@ -45,6 +45,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
return;
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
return EC_SUCCESS;
diff --git a/board/firefly/usb_pd_policy.c b/board/firefly/usb_pd_policy.c
index 5917e1a7ef..44ccfe418b 100644
--- a/board/firefly/usb_pd_policy.c
+++ b/board/firefly/usb_pd_policy.c
@@ -44,6 +44,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
return;
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
/* Never acting as a source */
diff --git a/board/fruitpie/usb_pd_policy.c b/board/fruitpie/usb_pd_policy.c
index ed7e1386fb..96668ff015 100644
--- a/board/fruitpie/usb_pd_policy.c
+++ b/board/fruitpie/usb_pd_policy.c
@@ -44,6 +44,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
CPRINTS("Failed to set input current limit for PD");
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
int max_ma = rdo & 0x3FF;
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c
index efd1bbc243..0c0dd41908 100644
--- a/board/hoho/usb_pd_policy.c
+++ b/board/hoho/usb_pd_policy.c
@@ -45,6 +45,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
return;
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
return EC_SUCCESS;
diff --git a/board/host/usb_pd_policy.c b/board/host/usb_pd_policy.c
index d77731a8ff..9d108bf2cc 100644
--- a/board/host/usb_pd_policy.c
+++ b/board/host/usb_pd_policy.c
@@ -25,6 +25,12 @@ const uint32_t pd_snk_pdo[] = {
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
int max_ma = rdo & 0x3FF;
diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c
index 4e56ba8b36..628e244500 100644
--- a/board/plankton/usb_pd_policy.c
+++ b/board/plankton/usb_pd_policy.c
@@ -63,6 +63,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
return;
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
int max_ma = rdo & 0x3FF;
diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c
index d6bd8c5598..7556c86ba6 100644
--- a/board/ryu/usb_pd_policy.c
+++ b/board/ryu/usb_pd_policy.c
@@ -50,6 +50,12 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge_manager_update(CHARGE_SUPPLIER_TYPEC, port, &charge);
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
int max_ma = rdo & 0x3FF;
diff --git a/board/ryu_p1/usb_pd_policy.c b/board/ryu_p1/usb_pd_policy.c
index 99e06e39c1..e48bd348e1 100644
--- a/board/ryu_p1/usb_pd_policy.c
+++ b/board/ryu_p1/usb_pd_policy.c
@@ -42,6 +42,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
CPRINTS("Failed to set input current limit for PD");
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
int max_ma = rdo & 0x3FF;
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 2142a0b9bb..91d19bf7f8 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -26,6 +26,13 @@
#define MAX_POWER_MW 60000
#define MAX_CURRENT_MA 3000
+/*
+ * Do not request any voltage within this deadband region, where
+ * we're not sure whether or not the boost or the bypass will be on.
+ */
+#define INPUT_VOLTAGE_DEADBAND_MIN 9700
+#define INPUT_VOLTAGE_DEADBAND_MAX 11999
+
#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)
const uint32_t pd_src_pdo[] = {
@@ -40,6 +47,13 @@ const uint32_t pd_snk_pdo[] = {
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Allow any voltage not in the boost bypass deadband */
+ return (mv < INPUT_VOLTAGE_DEADBAND_MIN) ||
+ (mv > INPUT_VOLTAGE_DEADBAND_MAX);
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
int max_ma = rdo & 0x3FF;
diff --git a/board/twinkie/usb_pd_policy.c b/board/twinkie/usb_pd_policy.c
index e52f2f0057..b1e4c064da 100644
--- a/board/twinkie/usb_pd_policy.c
+++ b/board/twinkie/usb_pd_policy.c
@@ -44,6 +44,12 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
gpio_set_level(GPIO_LED_B_L, !blue);
}
+int pd_is_valid_input_voltage(int mv)
+{
+ /* Any voltage less than the max is allowed */
+ return 1;
+}
+
int pd_check_requested_voltage(uint32_t rdo)
{
int max_ma = rdo & 0x3FF;