summaryrefslogtreecommitdiff
path: root/common/usbc/usb_tc_ctvpd_sm.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-06-27 14:41:31 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-28 11:31:14 +0000
commit66d4774b24220b6d947280f3dd0ebfd6f548d899 (patch)
treee8af3508fc84604cd26881de728592959da1e79a /common/usbc/usb_tc_ctvpd_sm.c
parent7d2fe4f315a8ed153486a16db87d12033f890a6a (diff)
downloadchrome-ec-66d4774b24220b6d947280f3dd0ebfd6f548d899.tar.gz
common/usbc/usb_tc_ctvpd_sm.c: Format with clang-format
BUG=b:236386294 BRANCH=none TEST=none Change-Id: Iea137774934fa5c97d394e9e3d1a92e14f87a893 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729795 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'common/usbc/usb_tc_ctvpd_sm.c')
-rw-r--r--common/usbc/usb_tc_ctvpd_sm.c65
1 files changed, 30 insertions, 35 deletions
diff --git a/common/usbc/usb_tc_ctvpd_sm.c b/common/usbc/usb_tc_ctvpd_sm.c
index 46550978ed..cfe5a22c3a 100644
--- a/common/usbc/usb_tc_ctvpd_sm.c
+++ b/common/usbc/usb_tc_ctvpd_sm.c
@@ -16,18 +16,18 @@
/* USB Type-C CTVPD module */
#ifdef CONFIG_COMMON_RUNTIME
-#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)
#else /* CONFIG_COMMON_RUNTIME */
#define CPRINTF(format, args...)
#define CPRINTS(format, args...)
#endif
/* Type-C Layer Flags */
-#define TC_FLAGS_VCONN_ON BIT(0)
+#define TC_FLAGS_VCONN_ON BIT(0)
-#define SUPPORT_TIMER_RESET_INIT 0
-#define SUPPORT_TIMER_RESET_REQUEST 1
+#define SUPPORT_TIMER_RESET_INIT 0
+#define SUPPORT_TIMER_RESET_REQUEST 1
#define SUPPORT_TIMER_RESET_COMPLETE 2
/**
@@ -105,9 +105,8 @@ enum usb_tc_state {
/* Forward declare the full list of states. This is indexed by usb_tc_state */
static const struct usb_state tc_states[];
-
/* List of human readable state names for console debugging */
-__maybe_unused const char * const tc_state_names[] = {
+__maybe_unused const char *const tc_state_names[] = {
#ifdef CONFIG_COMMON_RUNTIME
[TC_DISABLED] = "Disabled",
[TC_UNATTACHED_SNK] = "Unattached.SNK",
@@ -257,9 +256,9 @@ test_mockable_static void print_current_state(const int port)
int pd_is_connected(int port)
{
return (get_state_tc(port) == TC_ATTACHED_SNK) ||
- (get_state_tc(port) == TC_ATTACHED_SRC) ||
- (get_state_tc(port) == TC_CT_ATTACHED_UNSUPPORTED) ||
- (get_state_tc(port) == TC_CT_ATTACHED_VPD);
+ (get_state_tc(port) == TC_ATTACHED_SRC) ||
+ (get_state_tc(port) == TC_CT_ATTACHED_UNSUPPORTED) ||
+ (get_state_tc(port) == TC_CT_ATTACHED_VPD);
}
bool pd_is_disconnected(int port)
@@ -398,7 +397,7 @@ static void tc_unattached_snk_run(const int port)
* 2) VBUS is detected
*/
if (vpd_is_ct_vbus_present() &&
- tc[port].cc_state == PD_CC_DFP_ATTACHED) {
+ tc[port].cc_state == PD_CC_DFP_ATTACHED) {
set_state_tc(port, TC_UNATTACHED_SRC);
return;
}
@@ -436,11 +435,11 @@ static void tc_attach_wait_snk_run(const int port)
if (tc[port].host_cc_state != host_new_cc_state) {
tc[port].host_cc_state = host_new_cc_state;
if (host_new_cc_state == PD_CC_DFP_ATTACHED)
- tc[port].host_cc_debounce = get_time().val +
- PD_T_CC_DEBOUNCE;
+ tc[port].host_cc_debounce =
+ get_time().val + PD_T_CC_DEBOUNCE;
else
- tc[port].host_cc_debounce = get_time().val +
- PD_T_PD_DEBOUNCE;
+ tc[port].host_cc_debounce =
+ get_time().val + PD_T_PD_DEBOUNCE;
return;
}
@@ -458,7 +457,7 @@ static void tc_attach_wait_snk_run(const int port)
* CC2 pins is SNK.Open for at least tPDDebounce.
*/
if (tc[port].host_cc_state == PD_CC_DFP_ATTACHED &&
- (vpd_is_vconn_present() || vpd_is_host_vbus_present()))
+ (vpd_is_vconn_present() || vpd_is_host_vbus_present()))
set_state_tc(port, TC_ATTACHED_SNK);
else if (tc[port].host_cc_state == PD_CC_NONE)
set_state_tc(port, TC_UNATTACHED_SNK);
@@ -551,7 +550,7 @@ static void tc_attached_snk_run(const int port)
/* Check the Support Timer */
if (get_time().val > tc[port].support_timer &&
- !tc[port].billboard_presented) {
+ !tc[port].billboard_presented) {
/*
* Present USB Billboard Device Class interface
* indicating that Charge-Through is not supported
@@ -654,7 +653,7 @@ static void tc_unattached_src_run(const int port)
* if Charge-Through VBUS is removed.
*/
if (!vpd_is_ct_vbus_present() ||
- get_time().val > tc[port].next_role_swap) {
+ get_time().val > tc[port].next_role_swap) {
set_state_tc(port, TC_UNATTACHED_SNK);
return;
}
@@ -719,7 +718,7 @@ static void tc_attach_wait_src_run(const int port)
* state is on the Host-side port’s CC pin for at least tCCDebounce.
*/
if (tc[port].host_cc_state == PD_CC_UFP_ATTACHED &&
- !vpd_is_host_vbus_present()) {
+ !vpd_is_host_vbus_present()) {
set_state_tc(port, TC_TRY_SNK);
return;
}
@@ -847,7 +846,7 @@ static void tc_try_snk_run(const int port)
* for tTryCCDebounce.
*/
if (tc[port].host_cc_state == PD_CC_DFP_ATTACHED &&
- (vpd_is_host_vbus_present() || vpd_is_vconn_present()))
+ (vpd_is_host_vbus_present() || vpd_is_vconn_present()))
set_state_tc(port, TC_ATTACHED_SNK);
else if (tc[port].host_cc_state == PD_CC_NONE)
set_state_tc(port, TC_TRY_WAIT_SRC);
@@ -887,7 +886,7 @@ static void tc_try_wait_src_run(const int port)
if (tc[port].host_cc_state != host_new_cc_state) {
tc[port].host_cc_state = host_new_cc_state;
tc[port].host_cc_debounce =
- get_time().val + PD_T_TRY_CC_DEBOUNCE;
+ get_time().val + PD_T_TRY_CC_DEBOUNCE;
return;
}
@@ -899,7 +898,7 @@ static void tc_try_wait_src_run(const int port)
* at least tTryCCDebounce.
*/
if (tc[port].host_cc_state == PD_CC_UFP_ATTACHED &&
- !vpd_is_host_vbus_present()) {
+ !vpd_is_host_vbus_present()) {
set_state_tc(port, TC_ATTACHED_SRC);
return;
}
@@ -988,7 +987,7 @@ static void tc_ct_try_snk_run(const int port)
* Charge-Through port.
*/
if (tc[port].cc_state == PD_CC_DFP_ATTACHED &&
- vpd_is_ct_vbus_present()) {
+ vpd_is_ct_vbus_present()) {
set_state_tc(port, TC_CT_ATTACHED_VPD);
return;
}
@@ -1001,8 +1000,7 @@ static void tc_ct_try_snk_run(const int port)
* for tDRPTryWait.
*/
if (tc[port].cc_state == PD_CC_NONE) {
- set_state_tc(port,
- TC_CT_ATTACHED_UNSUPPORTED);
+ set_state_tc(port, TC_CT_ATTACHED_UNSUPPORTED);
return;
}
}
@@ -1181,8 +1179,7 @@ static void tc_ct_unattached_unsupported_run(const int port)
* on both the CC1 and CC2 pins.
*/
if (cc_is_at_least_one_rd(cc1, cc2) || cc_is_audio_acc(cc1, cc2)) {
- set_state_tc(port,
- TC_CT_ATTACH_WAIT_UNSUPPORTED);
+ set_state_tc(port, TC_CT_ATTACH_WAIT_UNSUPPORTED);
return;
}
@@ -1343,7 +1340,7 @@ static void tc_ct_attached_vpd_entry(const int port)
* pins is connected through the cable
*/
vpd_ct_get_cc(&cc1, &cc2);
- tc[port].ct_cc = cc_is_rp(cc2) ? CT_CC2 : CT_CC1;
+ tc[port].ct_cc = cc_is_rp(cc2) ? CT_CC2 : CT_CC1;
/*
* 1. Remove or reduce any additional capacitance on the
@@ -1468,10 +1465,8 @@ static void tc_ct_attach_wait_vpd_run(const int port)
/* Debounce the cc state */
if (new_cc_state != tc[port].cc_state) {
tc[port].cc_state = new_cc_state;
- tc[port].cc_debounce = get_time().val +
- PD_T_CC_DEBOUNCE;
- tc[port].pd_debounce = get_time().val +
- PD_T_PD_DEBOUNCE;
+ tc[port].cc_debounce = get_time().val + PD_T_CC_DEBOUNCE;
+ tc[port].pd_debounce = get_time().val + PD_T_PD_DEBOUNCE;
return;
}
@@ -1482,7 +1477,7 @@ static void tc_ct_attach_wait_vpd_run(const int port)
* port’s CC1 and CC2 pins are SNK.Open for at least
* tPDDebounce.
*/
- if (tc[port].cc_state == PD_CC_NONE) {
+ if (tc[port].cc_state == PD_CC_NONE) {
set_state_tc(port, TC_CT_UNATTACHED_VPD);
return;
}
@@ -1496,8 +1491,8 @@ static void tc_ct_attach_wait_vpd_run(const int port)
* least tCCDebounce and VBUS on the Charge-Through port is
* detected.
*/
- if (tc[port].cc_state == PD_CC_DFP_ATTACHED &&
- vpd_is_ct_vbus_present()) {
+ if (tc[port].cc_state == PD_CC_DFP_ATTACHED &&
+ vpd_is_ct_vbus_present()) {
set_state_tc(port, TC_CT_ATTACHED_VPD);
return;
}