summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2020-01-15 07:41:55 -0700
committerCommit Bot <commit-bot@chromium.org>2020-01-16 00:57:30 +0000
commitc5c198a95c5975a0f0555c1a005abbd0ad5e4902 (patch)
tree75b6ba27ed0b27e51840612b4b320250bb311aee /baseboard
parent0dbd7e342cdc20d6fc7324da9440f837e87d8cf8 (diff)
downloadchrome-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 'baseboard')
-rw-r--r--baseboard/grunt/usb_pd_policy.c8
-rw-r--r--baseboard/kukui/usb_pd_policy.c18
-rw-r--r--baseboard/zork/usb_pd_policy.c8
3 files changed, 9 insertions, 25 deletions
diff --git a/baseboard/grunt/usb_pd_policy.c b/baseboard/grunt/usb_pd_policy.c
index cb587a1b84..9ec482c750 100644
--- a/baseboard/grunt/usb_pd_policy.c
+++ b/baseboard/grunt/usb_pd_policy.c
@@ -125,12 +125,6 @@ __override int svdm_dp_config(int port, uint32_t *payload)
return 2;
};
-/*
- * timestamp of the next possible toggle to ensure the 2-ms spacing
- * between IRQ_HPD.
- */
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
-
#define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD)
__override void svdm_dp_post_config(int port)
{
@@ -148,7 +142,7 @@ __override 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;
mux->hpd_update(port, 1, 0);
}
diff --git a/baseboard/kukui/usb_pd_policy.c b/baseboard/kukui/usb_pd_policy.c
index 2f5a18d863..8ae257d16e 100644
--- a/baseboard/kukui/usb_pd_policy.c
+++ b/baseboard/kukui/usb_pd_policy.c
@@ -158,12 +158,6 @@ __override int svdm_dp_config(int port, uint32_t *payload)
return 2;
};
-/*
- * timestamp of the next possible toggle to ensure the 2-ms spacing
- * between IRQ_HPD.
- */
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
-
__override void svdm_dp_post_config(int port)
{
const struct usb_mux * const mux = &usb_muxes[port];
@@ -178,7 +172,7 @@ __override void svdm_dp_post_config(int port)
#endif
/* 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;
mux->hpd_update(port, 1, 0);
}
@@ -203,8 +197,8 @@ __override 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(GPIO_USB_C0_HPD_OD, 0);
@@ -216,7 +210,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
#endif
/* 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) {
CPRINTF("ERR:HPD:IRQ&LOW\n");
return 0; /* nak */
@@ -226,7 +221,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
board_set_dp_mux_control(lvl, board_get_polarity(port));
#endif
/* 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;
}
/* ack */
diff --git a/baseboard/zork/usb_pd_policy.c b/baseboard/zork/usb_pd_policy.c
index fde96819c7..aba5a40033 100644
--- a/baseboard/zork/usb_pd_policy.c
+++ b/baseboard/zork/usb_pd_policy.c
@@ -133,12 +133,6 @@ __override int svdm_dp_config(int port, uint32_t *payload)
return 2;
};
-/*
- * timestamp of the next possible toggle to ensure the 2-ms spacing
- * between IRQ_HPD.
- */
-static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT];
-
__override void svdm_dp_post_config(int port)
{
const struct usb_mux * const mux = &usb_muxes[port];
@@ -155,7 +149,7 @@ __override 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;
if (mux->hpd_update)
mux->hpd_update(port, 1, 0);