summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-10-22 09:54:32 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-22 21:50:35 +0000
commite3d01f8870d8bff15a40bae1173cff81c275a99c (patch)
treeb913e30362cf8554946ef3c198dbe473e9a17571
parentde3ef9fa6e384dd5ab80185c9067009c17411164 (diff)
downloadchrome-ec-e3d01f8870d8bff15a40bae1173cff81c275a99c.tar.gz
ryu_p2: Fix broken build due to overlapped commits
Looks like the commit queue latency caused a breakage. Commit 7eaa290 breaks commit 00551f7. This fixes it. BRANCH=None BUG=chrome-os-partner:32660 TEST=make buildall -j Change-Id: I37ac58ae26a17bc75fae8e6da28bead9a195ba89 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225001 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
-rw-r--r--board/ryu_p2/usb_pd_policy.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/board/ryu_p2/usb_pd_policy.c b/board/ryu_p2/usb_pd_policy.c
index 10ceb1c30a..73688b218d 100644
--- a/board/ryu_p2/usb_pd_policy.c
+++ b/board/ryu_p2/usb_pd_policy.c
@@ -15,6 +15,7 @@
#include "util.h"
#include "usb_pd.h"
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
/* TODO(crosbug.com/p/28869): update source and sink tables to spec. */
@@ -34,7 +35,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 */
-int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo)
+int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo,
+ uint32_t *curr_limit, uint32_t *supply_voltage)
{
int i;
int sel_mv;
@@ -66,19 +68,22 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo)
int uw = 250000 * (src_caps[max_i] & 0x3FF);
max_ma = uw / sel_mv;
*rdo = RDO_BATT(max_i + 1, uw/2, uw, 0);
- ccprintf("Request [%d] %dV %dmW\n",
- max_i, sel_mv/1000, uw/1000);
+ CPRINTF("Request [%d] %dV %dmW\n",
+ max_i, sel_mv/1000, uw/1000);
} else {
int ma = 10 * (src_caps[max_i] & 0x3FF);
max_ma = ma;
*rdo = RDO_FIXED(max_i + 1, ma / 2, ma, 0);
- ccprintf("Request [%d] %dV %dmA\n",
- max_i, sel_mv/1000, ma);
+ CPRINTF("Request [%d] %dV %dmA\n",
+ max_i, sel_mv/1000, ma);
}
- return max_ma;
+ *curr_limit = max_ma;
+ *supply_voltage = sel_mv;
+ return EC_SUCCESS;
}
-void pd_set_input_current_limit(int port, uint32_t max_ma)
+void pd_set_input_current_limit(int port, uint32_t max_ma,
+ uint32_t supply_voltage)
{
int rv = charge_set_input_current_limit(MAX(max_ma,
CONFIG_CHARGER_INPUT_CURRENT));
@@ -110,9 +115,9 @@ int pd_request_voltage(uint32_t rdo)
if (max_ma > pdo_ma)
return EC_ERROR_INVAL; /* too much max current */
- ccprintf("Switch to %d V %d mA (for %d/%d mA)\n",
- ((pdo >> 10) & 0x3ff) * 50, (pdo & 0x3ff) * 10,
- ((rdo >> 10) & 0x3ff) * 10, (rdo & 0x3ff) * 10);
+ CPRINTF("Switch to %d V %d mA (for %d/%d mA)\n",
+ ((pdo >> 10) & 0x3ff) * 50, (pdo & 0x3ff) * 10,
+ ((rdo >> 10) & 0x3ff) * 10, (rdo & 0x3ff) * 10);
return EC_SUCCESS;
}
@@ -135,4 +140,3 @@ int pd_board_checks(void)
{
return EC_SUCCESS;
}
-