diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-06-27 13:18:27 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-01 20:15:29 +0000 |
commit | 4e5ba213530dcb009b6b1d841baafbb84d0e7fc5 (patch) | |
tree | 765d04403443c7b1b750cca91447f8fb6013a021 /baseboard | |
parent | ff60ea9d5493da9864bc77e06bc117346ecef4c4 (diff) | |
download | chrome-ec-4e5ba213530dcb009b6b1d841baafbb84d0e7fc5.tar.gz |
baseboard/volteer/usb_pd_policy.c: Format with clang-format
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: If24723d71c8cfe93be8f3dd2732c4da41469d9d8
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3727953
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/volteer/usb_pd_policy.c | 84 |
1 files changed, 36 insertions, 48 deletions
diff --git a/baseboard/volteer/usb_pd_policy.c b/baseboard/volteer/usb_pd_policy.c index 5b9000b3f7..ffd16b0088 100644 --- a/baseboard/volteer/usb_pd_policy.c +++ b/baseboard/volteer/usb_pd_policy.c @@ -14,8 +14,8 @@ #include "usb_pd.h" #include "system.h" -#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) -#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) int pd_check_vconn_swap(int port) { @@ -79,49 +79,38 @@ int board_vbus_source_enabled(int port) #define OPOS_TBT 1 -static const union tbt_mode_resp_device vdo_tbt_modes[1] = { - { - .tbt_alt_mode = 0x0001, - .tbt_adapter = TBT_ADAPTER_TBT3, - .intel_spec_b0 = 0, - .vendor_spec_b0 = 0, - .vendor_spec_b1 = 0, - } -}; - -static const uint32_t vdo_idh = VDO_IDH( - 1, /* Data caps as USB host */ - 0, /* Not a USB device */ - IDH_PTYPE_PERIPH, - 1, /* Supports alt modes */ - USB_VID_GOOGLE); - -static const uint32_t vdo_idh_rev30 = VDO_IDH_REV30( - 1, /* Data caps as USB host */ - 0, /* Not a USB device */ - IDH_PTYPE_PERIPH, - 1, /* Supports alt modes */ - IDH_PTYPE_DFP_HOST, - USB_TYPEC_RECEPTACLE, - USB_VID_GOOGLE); - -static const uint32_t vdo_product = VDO_PRODUCT( - CONFIG_USB_PID, CONFIG_USB_BCD_DEV); +static const union tbt_mode_resp_device vdo_tbt_modes[1] = { { + .tbt_alt_mode = 0x0001, + .tbt_adapter = TBT_ADAPTER_TBT3, + .intel_spec_b0 = 0, + .vendor_spec_b0 = 0, + .vendor_spec_b1 = 0, +} }; + +static const uint32_t vdo_idh = VDO_IDH(1, /* Data caps as USB host */ + 0, /* Not a USB device */ + IDH_PTYPE_PERIPH, 1, /* Supports alt + modes */ + USB_VID_GOOGLE); + +static const uint32_t vdo_idh_rev30 = + VDO_IDH_REV30(1, /* Data caps as USB host */ + 0, /* Not a USB device */ + IDH_PTYPE_PERIPH, 1, /* Supports alt modes */ + IDH_PTYPE_DFP_HOST, USB_TYPEC_RECEPTACLE, USB_VID_GOOGLE); + +static const uint32_t vdo_product = + VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV); /* TODO(b/168890624): add USB4 to capability once USB4 response implemented */ static const uint32_t vdo_ufp1 = VDO_UFP1( - (VDO_UFP1_CAPABILITY_USB20 - | VDO_UFP1_CAPABILITY_USB32), - USB_TYPEC_RECEPTACLE, - VDO_UFP1_ALT_MODE_TBT3, - USB_R30_SS_U40_GEN3); - -static const uint32_t vdo_dfp = VDO_DFP( - (VDO_DFP_HOST_CAPABILITY_USB20 - | VDO_DFP_HOST_CAPABILITY_USB32 - | VDO_DFP_HOST_CAPABILITY_USB4), - USB_TYPEC_RECEPTACLE, - 1 /* Port 1 */); + (VDO_UFP1_CAPABILITY_USB20 | VDO_UFP1_CAPABILITY_USB32), + USB_TYPEC_RECEPTACLE, VDO_UFP1_ALT_MODE_TBT3, USB_R30_SS_U40_GEN3); + +static const uint32_t vdo_dfp = + VDO_DFP((VDO_DFP_HOST_CAPABILITY_USB20 | VDO_DFP_HOST_CAPABILITY_USB32 | + VDO_DFP_HOST_CAPABILITY_USB4), + USB_TYPEC_RECEPTACLE, 1 /* Port 1 */); static int svdm_tbt_compat_response_identity(int port, uint32_t *payload) { @@ -163,8 +152,8 @@ static int svdm_tbt_compat_response_modes(int port, uint32_t *payload) /* Track whether we've been enabled to ACK TBT EnterModes requests */ static bool tbt_ufp_ack_allowed[CONFIG_USB_PD_PORT_MAX_COUNT]; -__override enum ec_status board_set_tbt_ufp_reply(int port, - enum typec_tbt_ufp_reply reply) +__override enum ec_status +board_set_tbt_ufp_reply(int port, enum typec_tbt_ufp_reply reply) { /* Note: Host command has already bounds-checked port */ if (reply == TYPEC_TBT_UFP_REPLY_ACK) @@ -177,8 +166,7 @@ __override enum ec_status board_set_tbt_ufp_reply(int port, return EC_RES_SUCCESS; } -static int svdm_tbt_compat_response_enter_mode( - int port, uint32_t *payload) +static int svdm_tbt_compat_response_enter_mode(int port, uint32_t *payload) { mux_state_t mux_state = 0; @@ -191,7 +179,7 @@ static int svdm_tbt_compat_response_enter_mode( return 0; /* NAK */ if ((PD_VDO_VID(payload[0]) != USB_VID_INTEL) || - (PD_VDO_OPOS(payload[0]) != OPOS_TBT)) + (PD_VDO_OPOS(payload[0]) != OPOS_TBT)) return 0; /* NAK */ mux_state = usb_mux_get(port); @@ -201,7 +189,7 @@ static int svdm_tbt_compat_response_enter_mode( * Mode that requires the reconfiguring of any pins. */ if ((mux_state & USB_PD_MUX_USB_ENABLED) || - (mux_state & USB_PD_MUX_SAFE_MODE)) { + (mux_state & USB_PD_MUX_SAFE_MODE)) { pd_ufp_set_enter_mode(port, payload); set_tbt_compat_mode_ready(port); |