diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-07-06 11:44:11 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-07 22:20:37 +0000 |
commit | 0c40e309a77b9041a8415da4c4a18a2ebe5f3003 (patch) | |
tree | c1c69e06eb3b4dc82cc93a75579ff2dc41770ca3 /common | |
parent | 5500e4119154056314b401bbd6952b1c3f94eae2 (diff) | |
download | chrome-ec-0c40e309a77b9041a8415da4c4a18a2ebe5f3003.tar.gz |
common/usbc/usb_pd_timer.c: Format with clang-format
BUG=b:236386294
BRANCH=none
TEST=none
Tricium: disable
Change-Id: Ic49d027ee6bcf2ab1d52215af4146beeee284081
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729788
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usbc/usb_pd_timer.c | 126 |
1 files changed, 62 insertions, 64 deletions
diff --git a/common/usbc/usb_pd_timer.c b/common/usbc/usb_pd_timer.c index a1859ac9e9..3522bc04bc 100644 --- a/common/usbc/usb_pd_timer.c +++ b/common/usbc/usb_pd_timer.c @@ -14,36 +14,35 @@ #include "usb_pd_timer.h" #include "usb_tc_sm.h" -#define MAX_PD_PORTS CONFIG_USB_PD_PORT_MAX_COUNT -#define MAX_PD_TIMERS PD_TIMER_COUNT +#define MAX_PD_PORTS CONFIG_USB_PD_PORT_MAX_COUNT +#define MAX_PD_TIMERS PD_TIMER_COUNT #define PD_TIMERS_ALL_MASK (UINT64_MAX >> (64 - PD_TIMER_COUNT)) -#define MAX_EXPIRE (0x7FFFFFFF) -#define NO_TIMEOUT (-1) -#define EXPIRE_NOW (0) +#define MAX_EXPIRE (0x7FFFFFFF) +#define NO_TIMEOUT (-1) +#define EXPIRE_NOW (0) #define PD_SET_ACTIVE(p, bit) \ - atomic_set_bit(timer_active, (p) * PD_TIMER_COUNT + (bit)) + atomic_set_bit(timer_active, (p)*PD_TIMER_COUNT + (bit)) #define PD_CLR_ACTIVE(p, bit) \ - atomic_clear_bit(timer_active, (p) * PD_TIMER_COUNT + (bit)) + atomic_clear_bit(timer_active, (p)*PD_TIMER_COUNT + (bit)) #define PD_CHK_ACTIVE(p, bit) \ - atomic_test_bit(timer_active, (p) * PD_TIMER_COUNT + (bit)) + atomic_test_bit(timer_active, (p)*PD_TIMER_COUNT + (bit)) #define PD_SET_DISABLED(p, bit) \ - atomic_set_bit(timer_disabled, (p) * PD_TIMER_COUNT + (bit)) + atomic_set_bit(timer_disabled, (p)*PD_TIMER_COUNT + (bit)) #define PD_CLR_DISABLED(p, bit) \ - atomic_clear_bit(timer_disabled, (p) * PD_TIMER_COUNT + (bit)) + atomic_clear_bit(timer_disabled, (p)*PD_TIMER_COUNT + (bit)) #define PD_CHK_DISABLED(p, bit) \ - atomic_test_bit(timer_disabled, (p) * PD_TIMER_COUNT + (bit)) + atomic_test_bit(timer_disabled, (p)*PD_TIMER_COUNT + (bit)) -test_mockable_static -ATOMIC_DEFINE(timer_active, PD_TIMER_COUNT * MAX_PD_PORTS); -test_mockable_static -ATOMIC_DEFINE(timer_disabled, PD_TIMER_COUNT * MAX_PD_PORTS); +test_mockable_static ATOMIC_DEFINE(timer_active, PD_TIMER_COUNT *MAX_PD_PORTS); +test_mockable_static ATOMIC_DEFINE(timer_disabled, + PD_TIMER_COUNT *MAX_PD_PORTS); static uint64_t timer_expires[MAX_PD_PORTS][PD_TIMER_COUNT]; /* @@ -52,42 +51,42 @@ static uint64_t timer_expires[MAX_PD_PORTS][PD_TIMER_COUNT]; static int count[MAX_PD_PORTS]; static int max_count[MAX_PD_PORTS]; -__maybe_unused static __const_data const char * const pd_timer_names[] = { - [PE_TIMER_BIST_CONT_MODE] = "PE-BIST_CONT_MODE", +__maybe_unused static __const_data const char *const pd_timer_names[] = { + [PE_TIMER_BIST_CONT_MODE] = "PE-BIST_CONT_MODE", [PE_TIMER_CHUNKING_NOT_SUPPORTED] = "PE-CHUNKING_NOT_SUPPORTED", - [PE_TIMER_DISCOVER_IDENTITY] = "PE-DISCOVER_IDENTITY", - [PE_TIMER_NO_RESPONSE] = "PE-NO_RESPONSE", - [PE_TIMER_PR_SWAP_WAIT] = "PE-PR_SWAP_WAIT", - [PE_TIMER_PS_HARD_RESET] = "PE-PS_HARD_RESET", - [PE_TIMER_PS_SOURCE] = "PE-PS_SOURCE", - [PE_TIMER_PS_TRANSITION] = "PE-PS_TRANSITION", - [PE_TIMER_SENDER_RESPONSE] = "PE-SENDER_RESPONSE", - [PE_TIMER_SINK_REQUEST] = "PE-SINK_REQUEST", - [PE_TIMER_SOURCE_CAP] = "PE-SOURCE_CAP", - [PE_TIMER_SRC_TRANSITION] = "PE-SRC_TRANSITION", - [PE_TIMER_SWAP_SOURCE_START] = "PE-SWAP_SOURCE_START", - [PE_TIMER_TIMEOUT] = "PE-TIMEOUT", - [PE_TIMER_VCONN_ON] = "PE-VCONN_ON", - [PE_TIMER_VDM_RESPONSE] = "PE-VDM_RESPONSE", - [PE_TIMER_WAIT_AND_ADD_JITTER] = "PE-WAIT_AND_ADD_JITTER", - [PE_TIMER_VCONN_DISCHARGE] = "PE-VCONN_DISCHARGE", - [PE_TIMER_VCONN_REAPPLIED] = "PE-VCONN_REAPPLIED", - [PE_TIMER_DATA_RESET_FAIL] = "PE-DATA_RESET_FAIL", - - [PR_TIMER_CHUNK_SENDER_REQUEST] = "PR-CHUNK_SENDER_REQUEST", + [PE_TIMER_DISCOVER_IDENTITY] = "PE-DISCOVER_IDENTITY", + [PE_TIMER_NO_RESPONSE] = "PE-NO_RESPONSE", + [PE_TIMER_PR_SWAP_WAIT] = "PE-PR_SWAP_WAIT", + [PE_TIMER_PS_HARD_RESET] = "PE-PS_HARD_RESET", + [PE_TIMER_PS_SOURCE] = "PE-PS_SOURCE", + [PE_TIMER_PS_TRANSITION] = "PE-PS_TRANSITION", + [PE_TIMER_SENDER_RESPONSE] = "PE-SENDER_RESPONSE", + [PE_TIMER_SINK_REQUEST] = "PE-SINK_REQUEST", + [PE_TIMER_SOURCE_CAP] = "PE-SOURCE_CAP", + [PE_TIMER_SRC_TRANSITION] = "PE-SRC_TRANSITION", + [PE_TIMER_SWAP_SOURCE_START] = "PE-SWAP_SOURCE_START", + [PE_TIMER_TIMEOUT] = "PE-TIMEOUT", + [PE_TIMER_VCONN_ON] = "PE-VCONN_ON", + [PE_TIMER_VDM_RESPONSE] = "PE-VDM_RESPONSE", + [PE_TIMER_WAIT_AND_ADD_JITTER] = "PE-WAIT_AND_ADD_JITTER", + [PE_TIMER_VCONN_DISCHARGE] = "PE-VCONN_DISCHARGE", + [PE_TIMER_VCONN_REAPPLIED] = "PE-VCONN_REAPPLIED", + [PE_TIMER_DATA_RESET_FAIL] = "PE-DATA_RESET_FAIL", + + [PR_TIMER_CHUNK_SENDER_REQUEST] = "PR-CHUNK_SENDER_REQUEST", [PR_TIMER_CHUNK_SENDER_RESPONSE] = "PR-CHUNK_SENDER_RESPONSE", - [PR_TIMER_HARD_RESET_COMPLETE] = "PR-HARD_RESET_COMPLETE", - [PR_TIMER_SINK_TX] = "PR-SINK_TX", - [PR_TIMER_TCPC_TX_TIMEOUT] = "PR-TCPC_TX_TIMEOUT", - - [TC_TIMER_CC_DEBOUNCE] = "TC-CC_DEBOUNCE", - [TC_TIMER_LOW_POWER_EXIT_TIME] = "TC-LOW_POWER_EXIT_TIME", - [TC_TIMER_LOW_POWER_TIME] = "TC-LOW_POWER_TIME", - [TC_TIMER_NEXT_ROLE_SWAP] = "TC-NEXT_ROLE_SWAP", - [TC_TIMER_PD_DEBOUNCE] = "TC-PD_DEBOUNCE", - [TC_TIMER_TIMEOUT] = "TC-TIMEOUT", - [TC_TIMER_TRY_WAIT_DEBOUNCE] = "TC-TRY_WAIT_DEBOUNCE", - [TC_TIMER_VBUS_DEBOUNCE] = "TC-VBUS_DEBOUNCE", + [PR_TIMER_HARD_RESET_COMPLETE] = "PR-HARD_RESET_COMPLETE", + [PR_TIMER_SINK_TX] = "PR-SINK_TX", + [PR_TIMER_TCPC_TX_TIMEOUT] = "PR-TCPC_TX_TIMEOUT", + + [TC_TIMER_CC_DEBOUNCE] = "TC-CC_DEBOUNCE", + [TC_TIMER_LOW_POWER_EXIT_TIME] = "TC-LOW_POWER_EXIT_TIME", + [TC_TIMER_LOW_POWER_TIME] = "TC-LOW_POWER_TIME", + [TC_TIMER_NEXT_ROLE_SWAP] = "TC-NEXT_ROLE_SWAP", + [TC_TIMER_PD_DEBOUNCE] = "TC-PD_DEBOUNCE", + [TC_TIMER_TIMEOUT] = "TC-TIMEOUT", + [TC_TIMER_TRY_WAIT_DEBOUNCE] = "TC-TRY_WAIT_DEBOUNCE", + [TC_TIMER_VBUS_DEBOUNCE] = "TC-VBUS_DEBOUNCE", }; /***************************************************************************** @@ -172,16 +171,16 @@ void pd_timer_disable_range(int port, enum pd_timer_range range) switch (range) { case PE_TIMER_RANGE: - start = PE_TIMER_START; - end = PE_TIMER_END; + start = PE_TIMER_START; + end = PE_TIMER_END; break; case PR_TIMER_RANGE: - start = PR_TIMER_START; - end = PR_TIMER_END; + start = PR_TIMER_START; + end = PR_TIMER_END; break; case TC_TIMER_RANGE: - start = TC_TIMER_START; - end = TC_TIMER_END; + start = TC_TIMER_START; + end = TC_TIMER_END; break; default: return; @@ -253,8 +252,8 @@ test_mockable_static void pd_timer_dump(int port) int timer; uint64_t now = get_time().val; - ccprints("Timers(%d): cur=%d max=%d", - port, count[port], max_count[port]); + ccprints("Timers(%d): cur=%d max=%d", port, count[port], + max_count[port]); for (timer = 0; timer < PD_TIMER_COUNT; ++timer) { if (pd_timer_is_disabled(port, timer)) { @@ -265,14 +264,13 @@ test_mockable_static void pd_timer_dump(int port) if (now < timer_expires[port][timer]) delta = timer_expires[port][timer] - now; - ccprints("[%2d] Active: %s (%d%s)", - timer, pd_timer_names[timer], (uint32_t)delta, - tc_event_loop_is_paused(port) - ? "-PAUSED" - : ""); + ccprints("[%2d] Active: %s (%d%s)", timer, + pd_timer_names[timer], (uint32_t)delta, + tc_event_loop_is_paused(port) ? "-PAUSED" : + ""); } else { - ccprints("[%2d] Inactive: %s", - timer, pd_timer_names[timer]); + ccprints("[%2d] Inactive: %s", timer, + pd_timer_names[timer]); } } } |