diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/dingdong/usb_pd_policy.c | 7 | ||||
-rw-r--r-- | board/firefly/usb_pd_policy.c | 3 | ||||
-rw-r--r-- | board/fruitpie/usb_pd_policy.c | 17 | ||||
-rw-r--r-- | board/hoho/usb_pd_policy.c | 7 | ||||
-rw-r--r-- | board/host/usb_pd_policy.c | 17 | ||||
-rw-r--r-- | board/plankton/usb_pd_policy.c | 9 | ||||
-rw-r--r-- | board/ryu/usb_pd_policy.c | 16 | ||||
-rw-r--r-- | board/samus_pd/usb_pd_policy.c | 23 | ||||
-rw-r--r-- | board/twinkie/usb_pd_policy.c | 15 |
9 files changed, 62 insertions, 52 deletions
diff --git a/board/dingdong/usb_pd_policy.c b/board/dingdong/usb_pd_policy.c index 42b094fb1c..61a3bd8f33 100644 --- a/board/dingdong/usb_pd_policy.c +++ b/board/dingdong/usb_pd_policy.c @@ -16,6 +16,7 @@ #include "usb_pd.h" #include "version.h" +#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) /* Source PDOs */ @@ -54,7 +55,7 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo) /* request all the power ... */ ma = 10 * (src_caps[i] & 0x3FF); *rdo = RDO_FIXED(i + 1, ma, ma, 0); - ccprintf("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); + CPRINTF("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); return ma; } @@ -179,7 +180,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); int rsize = 1; - ccprintf("%T] VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); + CPRINTF("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); *rpayload = payload; switch (cmd) { @@ -191,7 +192,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, rsize = 0; } - ccprintf("%T] DONE\n"); + CPRINTS("DONE"); /* respond (positively) to the request */ payload[0] |= VDO_SRC_RESPONDER; diff --git a/board/firefly/usb_pd_policy.c b/board/firefly/usb_pd_policy.c index 5358eec678..dd36fce43c 100644 --- a/board/firefly/usb_pd_policy.c +++ b/board/firefly/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) /* Acceptable margin between requested VBUS and measured value */ @@ -60,7 +61,7 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo) /* request all the power ... */ ma = 10 * (src_caps[i] & 0x3FF); *rdo = RDO_FIXED(i + 1, ma, ma, 0); - ccprintf("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); + CPRINTF("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); return ma; } diff --git a/board/fruitpie/usb_pd_policy.c b/board/fruitpie/usb_pd_policy.c index bd8588bdb3..1cceb0b6b6 100644 --- a/board/fruitpie/usb_pd_policy.c +++ b/board/fruitpie/usb_pd_policy.c @@ -14,6 +14,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) const uint32_t pd_src_pdo[] = { @@ -65,13 +66,13 @@ 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", + 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", + CPRINTF("Request [%d] %dV %dmA\n", max_i, sel_mv/1000, ma); } return max_ma; @@ -109,7 +110,7 @@ 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", + 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); @@ -147,7 +148,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - ccprintf("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); + CPRINTF("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); /* make sure we have some payload */ if (cnt == 0) @@ -157,14 +158,14 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, case VDO_CMD_VERSION: /* guarantee last byte of payload is null character */ *(payload + cnt - 1) = 0; - ccprintf("version: %s\n", (char *)(payload+1)); + CPRINTF("version: %s\n", (char *)(payload+1)); break; case VDO_CMD_READ_INFO: case VDO_CMD_SEND_INFO: /* if last word is present, it contains lots of info */ if (cnt == 7) { dev_id = VDO_INFO_HW_DEV_ID(payload[6]); - ccprintf("Dev:0x%04x SW:%d RW:%d\n", dev_id, + CPRINTF("Dev:0x%04x SW:%d RW:%d\n", dev_id, VDO_INFO_SW_DBG_VER(payload[6]), VDO_INFO_IS_RW(payload[6])); } @@ -188,12 +189,12 @@ int pd_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) static void svdm_enter_dp_mode(int port, uint32_t mode_caps) { - ccprintf("Entering mode w/ vdo = %08x\n", mode_caps); + CPRINTF("Entering mode w/ vdo = %08x\n", mode_caps); } static void svdm_exit_dp_mode(int port) { - ccprintf("Exiting mode\n"); + CPRINTF("Exiting mode\n"); /* return to safe config */ } diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c index b647219085..dd94ed1413 100644 --- a/board/hoho/usb_pd_policy.c +++ b/board/hoho/usb_pd_policy.c @@ -16,6 +16,7 @@ #include "usb_pd.h" #include "version.h" +#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) /* Source PDOs */ @@ -54,7 +55,7 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo) /* request all the power ... */ ma = 10 * (src_caps[i] & 0x3FF); *rdo = RDO_FIXED(i + 1, ma, ma, 0); - ccprintf("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); + CPRINTF("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); return ma; } @@ -179,7 +180,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); int rsize = 1; - ccprintf("%T] VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); + CPRINTF("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); *rpayload = payload; switch (cmd) { @@ -191,7 +192,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, rsize = 0; } - ccprintf("%T] DONE\n"); + CPRINTS("DONE"); /* respond (positively) to the request */ payload[0] |= VDO_SRC_RESPONDER; 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; } diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c index a3136bfeed..8bfe5d41fd 100644 --- a/board/plankton/usb_pd_policy.c +++ b/board/plankton/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) /* Acceptable margin between requested VBUS and measured value */ @@ -79,7 +80,7 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo) /* request all the power ... */ ma = 10 * (src_caps[i] & 0x3FF); *rdo = RDO_FIXED(i + 1, ma, ma, 0); - ccprintf("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); + CPRINTF("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); return ma; } @@ -114,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); requested_voltage_idx = idx; diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c index dc28ebd3bd..4237158593 100644 --- a/board/ryu/usb_pd_policy.c +++ b/board/ryu/usb_pd_policy.c @@ -15,8 +15,8 @@ #include "util.h" #include "usb_pd.h" -#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) #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. */ const uint32_t pd_src_pdo[] = { @@ -67,14 +67,14 @@ 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; } @@ -111,9 +111,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; } diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c index ed8a2360de..4d5b4e4d12 100644 --- a/board/samus_pd/usb_pd_policy.c +++ b/board/samus_pd/usb_pd_policy.c @@ -14,6 +14,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(crossbug.com/p/28869): update source and sink tables to spec. */ @@ -68,14 +69,14 @@ 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; } @@ -104,7 +105,7 @@ 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", + 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); @@ -169,7 +170,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, { int cmd = PD_VDO_CMD(payload[0]); uint16_t dev_id = 0; - ccprintf("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); + CPRINTF("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); /* make sure we have some payload */ if (cnt == 0) @@ -179,7 +180,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, case VDO_CMD_VERSION: /* guarantee last byte of payload is null character */ *(payload + cnt - 1) = 0; - ccprintf("version: %s\n", (char *)(payload+1)); + CPRINTF("version: %s\n", (char *)(payload+1)); break; case VDO_CMD_READ_INFO: case VDO_CMD_SEND_INFO: @@ -189,9 +190,9 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, pd_send_host_event(); dev_id = VDO_INFO_HW_DEV_ID(payload[6]); - ccprintf("Dev:0x%04x SW:%d RW:%d\n", dev_id, - VDO_INFO_SW_DBG_VER(payload[6]), - VDO_INFO_IS_RW(payload[6])); + CPRINTF("Dev:0x%04x SW:%d RW:%d\n", dev_id, + VDO_INFO_SW_DBG_VER(payload[6]), + VDO_INFO_IS_RW(payload[6])); } /* copy hash */ if (cnt >= 6) @@ -199,7 +200,7 @@ static int pd_custom_vdm(int port, int cnt, uint32_t *payload, break; case VDO_CMD_CURRENT: - ccprintf("Current: %dmA\n", payload[1]); + CPRINTF("Current: %dmA\n", payload[1]); break; case VDO_CMD_FLIP: board_flip_usb_mux(port); diff --git a/board/twinkie/usb_pd_policy.c b/board/twinkie/usb_pd_policy.c index a67c4bc2d6..99d3611609 100644 --- a/board/twinkie/usb_pd_policy.c +++ b/board/twinkie/usb_pd_policy.c @@ -13,6 +13,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) const uint32_t pd_src_pdo[] = { @@ -62,13 +63,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[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; } @@ -101,9 +102,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; } |