summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-08-14 22:58:16 -0600
committerCommit Bot <commit-bot@chromium.org>2021-09-16 17:14:04 +0000
commitabc6c7ad71d85532db725198cecab0aa282e7b50 (patch)
tree49b217857e2079e69a4a7f472eddb95a83adff19 /baseboard
parent414feb169e244b2037e6a92a45500cc73faeea08 (diff)
downloadchrome-ec-abc6c7ad71d85532db725198cecab0aa282e7b50.tar.gz
USB MUX: Update mux HPD update interface to use mux_state_t
Since the drivers are now taking a mux_state_t set of flags to update, go ahead and unify the usb_mux API this way as well. It makes the parameters more apparent than the 1/0 inputs, and aligns the stack to use the same parameters. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie943dbdf03818d8497c0e328adf2b9794585d96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095438 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/asurada/usb_pd_policy.c8
-rw-r--r--baseboard/cherry/usb_pd_policy.c8
-rw-r--r--baseboard/goroh/usb_pd_policy.c8
-rw-r--r--baseboard/grunt/baseboard.c3
-rw-r--r--baseboard/grunt/usb_pd_policy.c3
-rw-r--r--baseboard/herobrine/usb_pd_policy.c8
-rw-r--r--baseboard/kalista/baseboard.c3
-rw-r--r--baseboard/kukui/usb_pd_policy.c11
-rw-r--r--baseboard/octopus/baseboard.c3
-rw-r--r--baseboard/trogdor/usb_pd_policy.c8
10 files changed, 46 insertions, 17 deletions
diff --git a/baseboard/asurada/usb_pd_policy.c b/baseboard/asurada/usb_pd_policy.c
index 019e4871a2..f9ba7e5a4d 100644
--- a/baseboard/asurada/usb_pd_policy.c
+++ b/baseboard/asurada/usb_pd_policy.c
@@ -64,6 +64,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
#ifdef CONFIG_USB_PD_DP_HPD_GPIO
int cur_lvl = svdm_get_hpd_gpio(port);
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
+ mux_state_t mux_state;
dp_status[port] = payload[1];
@@ -125,7 +126,9 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
- usb_mux_hpd_update(port, lvl, irq);
+ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(port, mux_state);
#ifdef USB_PD_PORT_TCPC_MST
if (port == USB_PD_PORT_TCPC_MST)
@@ -141,7 +144,8 @@ __override void svdm_exit_dp_mode(int port)
#ifdef CONFIG_USB_PD_DP_HPD_GPIO
svdm_set_hpd_gpio(port, 0);
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
#ifdef USB_PD_PORT_TCPC_MST
if (port == USB_PD_PORT_TCPC_MST)
diff --git a/baseboard/cherry/usb_pd_policy.c b/baseboard/cherry/usb_pd_policy.c
index 5ef026b95a..a520228ef6 100644
--- a/baseboard/cherry/usb_pd_policy.c
+++ b/baseboard/cherry/usb_pd_policy.c
@@ -73,6 +73,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
#ifdef CONFIG_USB_PD_DP_HPD_GPIO
int cur_lvl = svdm_get_hpd_gpio(port);
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
+ mux_state_t mux_state;
dp_status[port] = payload[1];
@@ -142,7 +143,9 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
- usb_mux_hpd_update(port, lvl, irq);
+ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(port, mux_state);
#ifdef USB_PD_PORT_TCPC_MST
if (port == USB_PD_PORT_TCPC_MST)
@@ -158,7 +161,8 @@ __override void svdm_exit_dp_mode(int port)
#ifdef CONFIG_USB_PD_DP_HPD_GPIO
svdm_set_hpd_gpio(port, 0);
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
aux_display_disconnected(port);
diff --git a/baseboard/goroh/usb_pd_policy.c b/baseboard/goroh/usb_pd_policy.c
index 2643d198ad..72213d311c 100644
--- a/baseboard/goroh/usb_pd_policy.c
+++ b/baseboard/goroh/usb_pd_policy.c
@@ -61,6 +61,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
#ifdef CONFIG_USB_PD_DP_HPD_GPIO
int cur_lvl = svdm_get_hpd_gpio(port);
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
+ mux_state_t mux_state;
dp_status[port] = payload[1];
@@ -122,7 +123,9 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
- usb_mux_hpd_update(port, lvl, irq);
+ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(port, mux_state);
#ifdef USB_PD_PORT_TCPC_MST
if (port == USB_PD_PORT_TCPC_MST)
@@ -138,7 +141,8 @@ __override void svdm_exit_dp_mode(int port)
#ifdef CONFIG_USB_PD_DP_HPD_GPIO
svdm_set_hpd_gpio(port, 0);
#endif /* CONFIG_USB_PD_DP_HPD_GPIO */
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
#ifdef USB_PD_PORT_TCPC_MST
if (port == USB_PD_PORT_TCPC_MST)
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c
index 7fc756ec47..cf49fc0566 100644
--- a/baseboard/grunt/baseboard.c
+++ b/baseboard/grunt/baseboard.c
@@ -155,7 +155,8 @@ void board_tcpc_init(void)
* HPD pulse to enable video path
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/baseboard/grunt/usb_pd_policy.c b/baseboard/grunt/usb_pd_policy.c
index 6d78680bf5..7c4fff953c 100644
--- a/baseboard/grunt/usb_pd_policy.c
+++ b/baseboard/grunt/usb_pd_policy.c
@@ -142,7 +142,8 @@ __override void svdm_dp_post_config(int port)
/* set the minimum time delay (2ms) for the next HPD IRQ */
svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
- usb_mux_hpd_update(port, 1, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
diff --git a/baseboard/herobrine/usb_pd_policy.c b/baseboard/herobrine/usb_pd_policy.c
index c17ca0c565..7ca2688aef 100644
--- a/baseboard/herobrine/usb_pd_policy.c
+++ b/baseboard/herobrine/usb_pd_policy.c
@@ -147,6 +147,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
int cur_lvl = gpio_get_level(hpd);
+ mux_state_t mux_state;
dp_status[port] = payload[1];
@@ -213,7 +214,9 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
pd_notify_dp_alt_mode_entry(port);
/* Configure TCPC for the HPD event, for proper muxing */
- usb_mux_hpd_update(port, lvl, irq);
+ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(port, mux_state);
/* Signal AP for the HPD event, through GPIO to AP */
if (irq & cur_lvl) {
@@ -251,7 +254,8 @@ __override void svdm_exit_dp_mode(int port)
gpio_set_level(GPIO_DP_MUX_SEL, 0);
/* Signal AP for the HPD low event */
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
gpio_set_level(GPIO_DP_HOT_PLUG_DET, 0);
}
}
diff --git a/baseboard/kalista/baseboard.c b/baseboard/kalista/baseboard.c
index a443f1919a..f6a6b23110 100644
--- a/baseboard/kalista/baseboard.c
+++ b/baseboard/kalista/baseboard.c
@@ -203,7 +203,8 @@ void board_tcpc_init(void)
* HPD pulse to enable video path
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
diff --git a/baseboard/kukui/usb_pd_policy.c b/baseboard/kukui/usb_pd_policy.c
index 92c09525c9..28ef005ee8 100644
--- a/baseboard/kukui/usb_pd_policy.c
+++ b/baseboard/kukui/usb_pd_policy.c
@@ -227,7 +227,8 @@ __override void svdm_dp_post_config(int port)
/* set the minimum time delay (2ms) for the next HPD IRQ */
svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
- usb_mux_hpd_update(port, 1, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
__override int svdm_dp_attention(int port, uint32_t *payload)
@@ -235,6 +236,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
int cur_lvl = gpio_get_level(GPIO_USB_C0_HPD_OD);
int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
+ mux_state_t mux_state;
dp_status[port] = payload[1];
@@ -245,7 +247,9 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
return 1;
}
- usb_mux_hpd_update(port, lvl, irq);
+ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(port, mux_state);
if (irq & cur_lvl) {
uint64_t now = get_time().val;
@@ -288,6 +292,7 @@ __override void svdm_exit_dp_mode(int port)
#ifdef VARIANT_KUKUI_DP_MUX_GPIO
board_set_dp_mux_control(0, 0);
#endif
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c
index 89da53e6dc..4f338ab131 100644
--- a/baseboard/octopus/baseboard.c
+++ b/baseboard/octopus/baseboard.c
@@ -237,7 +237,8 @@ void baseboard_tcpc_init(void)
* HPD pulse to enable video path
*/
for (int port = 0; port < board_get_usb_pd_port_count(); ++port)
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
/* Called after the cbi_init (via +2) */
DECLARE_HOOK(HOOK_INIT, baseboard_tcpc_init, HOOK_PRIO_INIT_I2C + 2);
diff --git a/baseboard/trogdor/usb_pd_policy.c b/baseboard/trogdor/usb_pd_policy.c
index 79726cc5e6..d7ed03e941 100644
--- a/baseboard/trogdor/usb_pd_policy.c
+++ b/baseboard/trogdor/usb_pd_policy.c
@@ -147,6 +147,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
int cur_lvl = gpio_get_level(hpd);
+ mux_state_t mux_state;
dp_status[port] = payload[1];
@@ -213,7 +214,9 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
pd_notify_dp_alt_mode_entry(port);
/* Configure TCPC for the HPD event, for proper muxing */
- usb_mux_hpd_update(port, lvl, irq);
+ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(port, mux_state);
/* Signal AP for the HPD event, through GPIO to AP */
if (irq & cur_lvl) {
@@ -251,7 +254,8 @@ __override void svdm_exit_dp_mode(int port)
gpio_set_level(GPIO_DP_MUX_SEL, 0);
/* Signal AP for the HPD low event */
- usb_mux_hpd_update(port, 0, 0);
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
gpio_set_level(GPIO_DP_HOT_PLUG_DET, 0);
}
}