diff options
author | Denis Brockus <dbrockus@chromium.org> | 2020-01-15 07:41:55 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-16 00:57:30 +0000 |
commit | c5c198a95c5975a0f0555c1a005abbd0ad5e4902 (patch) | |
tree | 75b6ba27ed0b27e51840612b4b320250bb311aee /common | |
parent | 0dbd7e342cdc20d6fc7324da9440f837e87d8cf8 (diff) | |
download | chrome-ec-c5c198a95c5975a0f0555c1a005abbd0ad5e4902.tar.gz |
usbc: hpd_deadline cleanup
some of the usages of this static variable were used in
overridable functions and they also had their own static
variable for this same purpose. Since it is not required
to override all of the functions, this left two variables
out of sync with one another. So made them the same variable.
BUG=b:147535104
BRANCH=none
TEST=make buildall -j
Change-Id: Ic560d3a2a2e129450e918e0cb6dfff75fd1222a2
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2002953
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_common.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/common/usb_common.c b/common/usb_common.c index 8118ca4690..0bc3b62e41 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -896,10 +896,11 @@ __overridable int svdm_dp_config(int port, uint32_t *payload) /* * timestamp of the next possible toggle to ensure the 2-ms spacing - * between IRQ_HPD. + * between IRQ_HPD. Since this is used in overridable functions, this + * has to be global. */ -STATIC_IF(CONFIG_USB_PD_DP_HPD_GPIO) - uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; +uint64_t svdm_hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; + #ifndef PORT_TO_HPD #define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD) #endif /* PORT_TO_HPD */ @@ -914,7 +915,7 @@ __overridable void svdm_dp_post_config(int port) gpio_set_level(PORT_TO_HPD(port), 1); /* set the minimum time delay (2ms) for the next HPD IRQ */ - hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL; + svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL; #endif /* CONFIG_USB_PD_DP_HPD_GPIO */ usb_mux_hpd_update(port, 1, 0); @@ -956,8 +957,8 @@ __overridable int svdm_dp_attention(int port, uint32_t *payload) if (irq & cur_lvl) { uint64_t now = get_time().val; /* wait for the minimum spacing between IRQ_HPD if needed */ - if (now < hpd_deadline[port]) - usleep(hpd_deadline[port] - now); + if (now < svdm_hpd_deadline[port]) + usleep(svdm_hpd_deadline[port] - now); /* generate IRQ_HPD pulse */ gpio_set_level(hpd, 0); @@ -965,7 +966,8 @@ __overridable int svdm_dp_attention(int port, uint32_t *payload) gpio_set_level(hpd, 1); /* set the minimum time delay (2ms) for the next HPD IRQ */ - hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL; + svdm_hpd_deadline[port] = get_time().val + + HPD_USTREAM_DEBOUNCE_LVL; } else if (irq & !lvl) { /* * IRQ can only be generated when the level is high, because @@ -976,7 +978,8 @@ __overridable int svdm_dp_attention(int port, uint32_t *payload) } else { gpio_set_level(hpd, lvl); /* set the minimum time delay (2ms) for the next HPD IRQ */ - hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL; + svdm_hpd_deadline[port] = get_time().val + + HPD_USTREAM_DEBOUNCE_LVL; } #endif /* CONFIG_USB_PD_DP_HPD_GPIO */ |