summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-08-14 15:05:26 -0600
committerCommit Bot <commit-bot@chromium.org>2021-08-30 20:33:28 +0000
commitfe3a60e79265658a8e5336c0eaada4977e083cd3 (patch)
tree09db3f89c5eb663daca1e5a1ed2b20708f37ab5c /board
parentd32885333e9bba9915d5388b08e888e06dfad511 (diff)
downloadchrome-ec-fe3a60e79265658a8e5336c0eaada4977e083cd3.tar.gz
USB MUX: Convert usb_mux HPD functions to use mux_state_t
Since we have definitions for HPD IRQ and level in the mux flags, extend this to the HPD update function in the usb_mux structure as well. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I19c3a65fc821a341338d73fabd7876339b37fe7d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095437 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/burnet/board.c2
-rw-r--r--board/cerise/board.c2
-rw-r--r--board/damu/board.c2
-rw-r--r--board/fennel/board.c2
-rw-r--r--board/icarus/board.c2
-rw-r--r--board/jacuzzi/board.c2
-rw-r--r--board/kakadu/board.c2
-rw-r--r--board/kappa/board.c2
-rw-r--r--board/katsu/board.c2
-rw-r--r--board/kodama/board.c2
-rw-r--r--board/kukui/board.c2
-rw-r--r--board/makomo/board.c2
-rw-r--r--board/munna/board.c2
-rw-r--r--board/pdeval-stm32f072/usb_pd_policy.c11
-rw-r--r--board/pico/board.c2
-rw-r--r--board/reef_it8320/board.c4
-rw-r--r--board/stern/board.c2
-rw-r--r--board/willow/board.c2
18 files changed, 28 insertions, 19 deletions
diff --git a/board/burnet/board.c b/board/burnet/board.c
index 7ed540de6a..c5c66a15fc 100644
--- a/board/burnet/board.c
+++ b/board/burnet/board.c
@@ -141,7 +141,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/cerise/board.c b/board/cerise/board.c
index 7bfd5f87a3..dfdb9230f9 100644
--- a/board/cerise/board.c
+++ b/board/cerise/board.c
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/damu/board.c b/board/damu/board.c
index e15f6a1928..fcb74cd482 100644
--- a/board/damu/board.c
+++ b/board/damu/board.c
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/fennel/board.c b/board/fennel/board.c
index 67e4edb892..11ca03e0a5 100644
--- a/board/fennel/board.c
+++ b/board/fennel/board.c
@@ -140,7 +140,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/icarus/board.c b/board/icarus/board.c
index b0f2bb7060..bffad091fa 100644
--- a/board/icarus/board.c
+++ b/board/icarus/board.c
@@ -122,7 +122,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c
index 34c1ab899e..9f655474d2 100644
--- a/board/jacuzzi/board.c
+++ b/board/jacuzzi/board.c
@@ -143,7 +143,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/kakadu/board.c b/board/kakadu/board.c
index 580bfe2355..dd36672bfe 100644
--- a/board/kakadu/board.c
+++ b/board/kakadu/board.c
@@ -108,7 +108,7 @@ struct mt6370_thermal_bound thermal_bound = {
};
static void board_hpd_update(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/kappa/board.c b/board/kappa/board.c
index 655d53d672..b8c5fee622 100644
--- a/board/kappa/board.c
+++ b/board/kappa/board.c
@@ -137,7 +137,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/katsu/board.c b/board/katsu/board.c
index 2571683ec7..e487538180 100644
--- a/board/katsu/board.c
+++ b/board/katsu/board.c
@@ -107,7 +107,7 @@ struct mt6370_thermal_bound thermal_bound = {
};
static void board_hpd_update(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/kodama/board.c b/board/kodama/board.c
index 8112c880ce..33ecbba384 100644
--- a/board/kodama/board.c
+++ b/board/kodama/board.c
@@ -104,7 +104,7 @@ struct mt6370_thermal_bound thermal_bound = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 562377af77..9abcc08cdc 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -119,7 +119,7 @@ void board_set_dp_mux_control(int output_enable, int polarity)
}
static void board_hpd_update(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/makomo/board.c b/board/makomo/board.c
index 8b135ba433..70056b3f2c 100644
--- a/board/makomo/board.c
+++ b/board/makomo/board.c
@@ -138,7 +138,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/munna/board.c b/board/munna/board.c
index 2727401c10..cb5d818b22 100644
--- a/board/munna/board.c
+++ b/board/munna/board.c
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c
index 57ef5a5826..45a0aa44ff 100644
--- a/board/pdeval-stm32f072/usb_pd_policy.c
+++ b/board/pdeval-stm32f072/usb_pd_policy.c
@@ -260,8 +260,10 @@ __override void svdm_dp_post_config(int port)
if (!(dp_flags[port] & DP_FLAGS_HPD_HI_PENDING))
return;
+ /* Note: Usage is deprecated, use usb_mux_hpd_update instead */
if (IS_ENABLED(CONFIG_USB_PD_TCPM_ANX7447))
- anx7447_tcpc_update_hpd_status(mux, 1, 0);
+ anx7447_tcpc_update_hpd_status(mux, USB_PD_MUX_HPD_LVL |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
__override int svdm_dp_attention(int port, uint32_t *payload)
@@ -270,9 +272,14 @@ __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]);
const struct usb_mux *mux = &usb_muxes[port];
+ mux_state_t 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);
+ /* Note: Usage is deprecated, use usb_mux_hpd_update instead */
CPRINTS("Attention: 0x%x", payload[1]);
- anx7447_tcpc_update_hpd_status(mux, lvl, irq);
+ anx7447_tcpc_update_hpd_status(mux, mux_state);
#endif
dp_status[port] = payload[1];
diff --git a/board/pico/board.c b/board/pico/board.c
index ffabee3880..4f5351706f 100644
--- a/board/pico/board.c
+++ b/board/pico/board.c
@@ -242,7 +242,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index 8b60074c02..96fad41763 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -111,8 +111,10 @@ const enum gpio_signal hibernate_wake_pins[] = {
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
static void it83xx_tcpc_update_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
+ int hpd_lvl = (mux_state & USB_PD_MUX_HPD_LVL) ? 1 : 0;
+ int hpd_irq = (mux_state & USB_PD_MUX_HPD_IRQ) ? 1 : 0;
enum gpio_signal gpio =
me->usb_port ? GPIO_USB_C1_HPD_1P8_ODL
: GPIO_USB_C0_HPD_1P8_ODL;
diff --git a/board/stern/board.c b/board/stern/board.c
index 586010a931..ce82554f16 100644
--- a/board/stern/board.c
+++ b/board/stern/board.c
@@ -139,7 +139,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify
diff --git a/board/willow/board.c b/board/willow/board.c
index 84e1abf421..ea2171431b 100644
--- a/board/willow/board.c
+++ b/board/willow/board.c
@@ -136,7 +136,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static void board_hpd_status(const struct usb_mux *me,
- int hpd_lvl, int hpd_irq)
+ mux_state_t mux_state)
{
/*
* svdm_dp_attention() did most of the work, we only need to notify