diff options
author | Diana Z <dzigterman@chromium.org> | 2021-08-14 22:58:16 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-16 17:14:04 +0000 |
commit | abc6c7ad71d85532db725198cecab0aa282e7b50 (patch) | |
tree | 49b217857e2079e69a4a7f472eddb95a83adff19 /zephyr/projects | |
parent | 414feb169e244b2037e6a92a45500cc73faeea08 (diff) | |
download | chrome-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 'zephyr/projects')
-rw-r--r-- | zephyr/projects/herobrine/herobrine_npcx9/src/usb_pd_policy.c | 8 | ||||
-rw-r--r-- | zephyr/projects/herobrine/herobrine_npcx9/src/usbc_config.c | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/zephyr/projects/herobrine/herobrine_npcx9/src/usb_pd_policy.c b/zephyr/projects/herobrine/herobrine_npcx9/src/usb_pd_policy.c index c17ca0c565..7ca2688aef 100644 --- a/zephyr/projects/herobrine/herobrine_npcx9/src/usb_pd_policy.c +++ b/zephyr/projects/herobrine/herobrine_npcx9/src/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/zephyr/projects/herobrine/herobrine_npcx9/src/usbc_config.c b/zephyr/projects/herobrine/herobrine_npcx9/src/usbc_config.c index a3da4b5592..20646c28c2 100644 --- a/zephyr/projects/herobrine/herobrine_npcx9/src/usbc_config.c +++ b/zephyr/projects/herobrine/herobrine_npcx9/src/usbc_config.c @@ -231,7 +231,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); |