mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 18:41:11 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
5d12e9b410
commit
3e2f1329ab
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "usb_pd_config.h"
|
||||
#include "version.h"
|
||||
|
||||
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
|
||||
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
|
||||
|
||||
#ifdef CONFIG_USB_PD_ALT_MODE
|
||||
@@ -61,7 +62,7 @@ static void dfp_consume_svids(int port, uint32_t *payload)
|
||||
|
||||
for (i = pe[port].svid_cnt; i < pe[port].svid_cnt + 12; i += 2) {
|
||||
if (i == SVID_DISCOVERY_MAX) {
|
||||
ccprintf("ERR: too many svids discovered\n");
|
||||
CPRINTF("ERR: too many svids discovered\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ static void dfp_consume_svids(int port, uint32_t *payload)
|
||||
}
|
||||
/* TODO(tbroch) need to re-issue discover svids if > 12 */
|
||||
if (i && ((i % 12) == 0))
|
||||
ccprintf("TODO: need to re-issue discover svids > 12\n");
|
||||
CPRINTF("TODO: need to re-issue discover svids > 12\n");
|
||||
}
|
||||
|
||||
static int dfp_discover_modes(int port, uint32_t *payload)
|
||||
@@ -202,10 +203,10 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
|
||||
int (*func)(int port, uint32_t *payload) = NULL;
|
||||
|
||||
int rsize = 1; /* VDM header at a minimum */
|
||||
ccprintf("%T] SVDM/%d [%d] %08x", cnt, cmd, payload[0]);
|
||||
CPRINTF("SVDM/%d [%d] %08x", cnt, cmd, payload[0]);
|
||||
for (i = 1; i < cnt; i++)
|
||||
ccprintf(" %08x", payload[i]);
|
||||
ccprintf("\n");
|
||||
CPRINTF(" %08x", payload[i]);
|
||||
CPRINTF("\n");
|
||||
|
||||
payload[0] &= ~VDO_CMDT_MASK;
|
||||
*rpayload = payload;
|
||||
@@ -280,7 +281,7 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
|
||||
break;
|
||||
case CMD_ENTER_MODE:
|
||||
/* Error */
|
||||
ccprintf("PE ERR: received BUSY for Enter mode\n");
|
||||
CPRINTF("PE ERR: received BUSY for Enter mode\n");
|
||||
rsize = 0;
|
||||
break;
|
||||
case CMD_EXIT_MODE:
|
||||
@@ -294,9 +295,9 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
|
||||
rsize = 0;
|
||||
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
|
||||
} else {
|
||||
ccprintf("PE ERR: unknown cmd type %d\n", cmd);
|
||||
CPRINTF("PE ERR: unknown cmd type %d\n", cmd);
|
||||
}
|
||||
ccprintf("%T] DONE\n");
|
||||
CPRINTS("DONE");
|
||||
return rsize;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user