diff options
author | Todd Broch <tbroch@chromium.org> | 2014-10-17 19:25:14 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-21 22:44:36 +0000 |
commit | 3e2f1329abfa729fe6786ff64d9545e6ce94f042 (patch) | |
tree | 6ee022791771be4cbdddb49c058c4ca7acd3cc7b /board/host | |
parent | 5d12e9b41058adda60f86a994c098046be6d86cf (diff) | |
download | chrome-ec-3e2f1329abfa729fe6786ff64d9545e6ce94f042.tar.gz |
pd: Correct use of console printing in USB PD policy files.
All non-interactive console prints should use their tasks channel
parameter to make it easy for developers to inhibit console output.
This CL corrects printf's in the various usb_pd_policy files that
belong to the USB PD task to use cprintf(CC_USBPD, ...) instead of the
macro reserved for interactive console commands ccprintf.
BRANCH=none
BUG=none
TEST=manual, set 'chan 1' and see none of the previous chatter
relating to USB PD. set 'chan 0x08000000' and see it return.
Output from DFP side for SVDM discovery now looks:
SVDM/4 [1] ff008041 340018d1 00000000 11000008
[1119.966911 DONE]
SVDM/2 [2] ff008042 ff010000
[1119.970135 DONE]
SVDM/2 [3] ff018043 00100081
[1119.973437 DONE]
SVDM/1 [4] ff018184
Change-Id: I47e5f4ec2d4a6a25f171177ead5ebc99409f80b6
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/224191
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/host')
-rw-r--r-- | board/host/usb_pd_policy.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/board/host/usb_pd_policy.c b/board/host/usb_pd_policy.c index 3155a288a0..6237f05d5d 100644 --- a/board/host/usb_pd_policy.c +++ b/board/host/usb_pd_policy.c @@ -8,6 +8,9 @@ #include "usb_pd.h" #include "util.h" +#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) + const uint32_t pd_src_pdo[] = { PDO_FIXED(5000, 500, PDO_FIXED_EXTERNAL), PDO_FIXED(5000, 900, 0), @@ -53,13 +56,13 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo) if ((src_caps[max_i] & PDO_TYPE_MASK) == PDO_TYPE_BATTERY) { int uw = 250000 * (src_caps[max_i] & 0x3FF); *rdo = RDO_BATT(max_i + 1, uw/2, uw, 0); - ccprintf("Request [%d] %dV %d/%d mW\n", - max_i, sel_mv/1000, uw/1000, uw/1000); + CPRINTF("Request [%d] %dV %d/%d mW\n", + max_i, sel_mv/1000, uw/1000, uw/1000); } else { int ma = 10 * (src_caps[max_i] & 0x3FF); *rdo = RDO_FIXED(max_i + 1, ma / 2, ma, 0); - ccprintf("Request [%d] %dV %d/%d mA\n", - max_i, sel_mv/1000, max_i, ma/2, ma); + CPRINTF("Request [%d] %dV %d/%d mA\n", + max_i, sel_mv/1000, max_i, ma/2, ma); } return EC_SUCCESS; } @@ -88,9 +91,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; } |