summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-08-08 12:31:23 -0600
committerCommit Bot <commit-bot@chromium.org>2019-08-09 21:50:56 +0000
commit85d086a15e2dca92c573e5d36ef03db6b428a76b (patch)
tree6518a4221df0290165aeddf81ddcfd0f00829329
parenta34c6b36d254ad7f537976ba5a3b18844c25e1dc (diff)
downloadchrome-ec-85d086a15e2dca92c573e5d36ef03db6b428a76b.tar.gz
usb: convert cc1 from int to enum
Refactor code to use proper type for cc1 and cc2 lines. BRANCH=none BUG=none TEST=builds. No functional change. Change-Id: Id292db8480920e2b191bac9d9ecc2685f61e4ea9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1744654 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/usb_pd_protocol.c18
-rw-r--r--common/usb_pd_tcpc.c5
-rw-r--r--common/usbc/usb_prl_sm.c3
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c32
-rw-r--r--common/usbc/usbc_task.c3
-rw-r--r--driver/tcpm/anx74xx.c3
-rw-r--r--driver/tcpm/fusb302.c10
-rw-r--r--driver/tcpm/it83xx.c3
-rw-r--r--driver/tcpm/mt6370.c3
-rw-r--r--driver/tcpm/nct38xx.c3
-rw-r--r--driver/tcpm/stub.c3
-rw-r--r--driver/tcpm/tcpci.c3
-rw-r--r--driver/tcpm/tcpci.h4
-rw-r--r--driver/tcpm/tcpm.h6
-rw-r--r--fuzz/usb_pd_fuzz.c3
-rw-r--r--include/usb_pd_tcpc.h3
-rw-r--r--include/usb_pd_tcpm.h21
-rw-r--r--include/usb_tc_sm.h4
18 files changed, 73 insertions, 57 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 3f82341d2b..10bf785ac3 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -690,7 +690,7 @@ static inline void set_state(int port, enum pd_states next_state)
if (next_state == PD_STATE_SRC_DISCONNECTED ||
next_state == PD_STATE_SNK_DISCONNECTED) {
#ifdef CONFIG_USBC_PPC
- int cc1, cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
tcpm_get_cc(port, &cc1, &cc2);
/*
@@ -874,8 +874,7 @@ static int pd_transmit(int port, enum tcpm_transmit_type type,
*/
sink_can_xmit(port, SINK_TX_NG);
} else if (type != TCPC_TX_HARD_RESET) {
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
tcpm_get_cc(port, &cc1, &cc2);
if (cc1 == TYPEC_CC_VOLT_RP_1_5 ||
@@ -924,8 +923,7 @@ static int pd_transmit(int port, enum tcpm_transmit_type type,
#ifdef CONFIG_USB_PD_REV30
static void pd_ca_send_pending(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
/* Check if a message has been buffered. */
if (!pd[port].ca_buffered)
@@ -2485,7 +2483,8 @@ static void pd_partner_port_reset(int port)
#endif /* CONFIG_USB_PD_DUAL_ROLE */
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
-static enum pd_states drp_auto_toggle_next_state(int port, int cc1, int cc2)
+static enum pd_states drp_auto_toggle_next_state(int port,
+ enum tcpc_cc_voltage_status cc1, enum tcpc_cc_voltage_status cc2)
{
enum pd_states next_state;
@@ -2617,7 +2616,8 @@ void pd_ping_enable(int port, int enable)
/**
* Returns the polarity of a Sink.
*/
-static inline int get_snk_polarity(int cc1, int cc2)
+static inline int get_snk_polarity(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2)
{
/* the following assumes:
* TYPEC_CC_VOLT_RP_3_0 > TYPEC_CC_VOLT_RP_1_5
@@ -2823,7 +2823,7 @@ void pd_task(void *u)
int port = TASK_ID_TO_PD_PORT(task_get_current());
uint32_t payload[7];
int timeout = 10*MSEC;
- int cc1, cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
int res, incoming_packet = 0;
int hard_reset_count = 0;
#ifdef CONFIG_USB_PD_DUAL_ROLE
@@ -3081,7 +3081,7 @@ void pd_task(void *u)
#endif
#ifdef CONFIG_USB_PD_DUAL_ROLE
if (pd[port].task_state == PD_STATE_SOFT_RESET) {
- int cc1, cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
/*
* Set the terminations to match our power
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c
index 216793381f..ae8c2746a6 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -1071,7 +1071,8 @@ int tcpc_set_cc(int port, int pull)
return EC_SUCCESS;
}
-int tcpc_get_cc(int port, int *cc1, int *cc2)
+int tcpc_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
*cc2 = pd[port].cc_status[1];
*cc1 = pd[port].cc_status[0];
@@ -1317,7 +1318,7 @@ static void tcpc_i2c_write(int port, int reg, int len, uint8_t *payload)
static int tcpc_i2c_read(int port, int reg, uint8_t *payload)
{
- int cc1, cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
int alert;
switch (reg) {
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index f013497cc4..a08f662e76 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -811,8 +811,7 @@ static int prl_tx_snk_pending_entry(int port)
static int prl_tx_snk_pending_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
tcpm_get_cc(port, &cc1, &cc2);
if (cc1 == TYPEC_CC_VOLT_RP_3_0 || cc2 == TYPEC_CC_VOLT_RP_3_0) {
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 8ec2d27d54..810fc5476e 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -761,7 +761,7 @@ void pd_prevent_low_power_mode(int port, int prevent)
static void sink_power_sub_states(int port)
{
- int cc1, cc2, cc;
+ enum tcpc_cc_voltage_status cc1, cc2, cc;
enum tcpc_cc_voltage_status new_cc_voltage;
tcpm_get_cc(port, &cc1, &cc2);
@@ -920,8 +920,7 @@ static int tc_unattached_snk_entry(int port)
static int tc_unattached_snk_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
/*
* TODO(b/137498392): Add wait before sampling the CC
@@ -978,8 +977,7 @@ static int tc_attach_wait_snk_entry(int port)
static int tc_attach_wait_snk_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
enum pd_cc_states new_cc_state;
/* Check for connection */
@@ -1059,8 +1057,7 @@ static int tc_attached_snk(int port, enum sm_signal sig)
static int tc_attached_snk_entry(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
tc[port].state_id = TC_ATTACHED_SNK;
CPRINTS("C%d: %s", port, tc_state_names[tc[port].state_id]);
@@ -1143,8 +1140,7 @@ static int tc_unoriented_dbg_acc_src_entry(int port)
static int tc_unoriented_dbg_acc_src_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
/* Check for connection */
tcpm_get_cc(port, &cc1, &cc2);
@@ -1253,8 +1249,7 @@ static int tc_unattached_src_entry(int port)
static int tc_unattached_src_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
/* Check for connection */
tcpm_get_cc(port, &cc1, &cc2);
@@ -1303,8 +1298,7 @@ static int tc_attach_wait_src_entry(int port)
static int tc_attach_wait_src_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
enum pd_cc_states new_cc_state;
/* Check for connection */
@@ -1371,8 +1365,7 @@ static int tc_attached_src(int port, enum sm_signal sig)
static int tc_attached_src_entry(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
tc[port].state_id = TC_ATTACHED_SRC;
CPRINTS("C%d: %s", port, tc_state_names[tc[port].state_id]);
@@ -1421,8 +1414,7 @@ static int tc_attached_src_entry(int port)
static int tc_attached_src_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
enum pd_cc_states new_cc_state;
/* Check for connection */
@@ -1508,8 +1500,7 @@ static int tc_try_src_entry(int port)
static int tc_try_src_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
enum pd_cc_states new_cc_state;
/* Check for connection */
@@ -1582,8 +1573,7 @@ static int tc_try_wait_snk_entry(int port)
static int tc_try_wait_snk_run(int port)
{
- int cc1;
- int cc2;
+ enum tcpc_cc_voltage_status cc1, cc2;
enum pd_cc_states new_cc_state;
/* Check for connection */
diff --git a/common/usbc/usbc_task.c b/common/usbc/usbc_task.c
index 7ff8bbf44f..b5b94c126a 100644
--- a/common/usbc/usbc_task.c
+++ b/common/usbc/usbc_task.c
@@ -129,7 +129,8 @@ enum typec_state_id get_typec_state_id(int port)
* DTS USB-C @ 3 A Rp3A0 RpUSB
*/
-inline enum pd_cc_polarity_type get_snk_polarity(int cc1, int cc2)
+enum pd_cc_polarity_type get_snk_polarity(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2)
{
/* the following assumes:
* TYPEC_CC_VOLT_RP_3_0 > TYPEC_CC_VOLT_RP_1_5
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index 47a7349f6a..36c29f0701 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -640,7 +640,8 @@ static int anx74xx_check_cc_type(int cc_reg)
return cc;
}
-static int anx74xx_tcpm_get_cc(int port, int *cc1, int *cc2)
+static int anx74xx_tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
int rv = EC_SUCCESS;
int reg = 0;
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index f8196a586f..ee16a206b3 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -164,7 +164,9 @@ static int measure_cc_pin_source(int port, int cc_measure)
}
/* Determine cc pin state for source when in manual detect mode */
-static void detect_cc_pin_source_manual(int port, int *cc1_lvl, int *cc2_lvl)
+static void detect_cc_pin_source_manual(int port,
+ enum tcpc_cc_voltage_status *cc1_lvl,
+ enum tcpc_cc_voltage_status *cc2_lvl)
{
int cc1_measure = TCPC_REG_SWITCHES0_MEAS_CC1;
int cc2_measure = TCPC_REG_SWITCHES0_MEAS_CC2;
@@ -184,7 +186,8 @@ static void detect_cc_pin_source_manual(int port, int *cc1_lvl, int *cc2_lvl)
}
/* Determine cc pin state for sink */
-static void detect_cc_pin_sink(int port, int *cc1, int *cc2)
+static void detect_cc_pin_sink(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
int reg;
int orig_meas_cc1;
@@ -456,7 +459,8 @@ static int fusb302_tcpm_release(int port)
return EC_ERROR_UNIMPLEMENTED;
}
-static int fusb302_tcpm_get_cc(int port, int *cc1, int *cc2)
+static int fusb302_tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
if (state[port].pulling_up) {
/* Source mode? */
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index b0ea91f89e..4d65e71a34 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -438,7 +438,8 @@ static int it83xx_tcpm_release(int port)
return EC_ERROR_UNIMPLEMENTED;
}
-static int it83xx_tcpm_get_cc(int port, int *cc1, int *cc2)
+static int it83xx_tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
*cc2 = it83xx_get_cc(port, USBPD_CC_PIN_2);
*cc1 = it83xx_get_cc(port, USBPD_CC_PIN_1);
diff --git a/driver/tcpm/mt6370.c b/driver/tcpm/mt6370.c
index 1d729f28e1..cad8a7fbbc 100644
--- a/driver/tcpm/mt6370.c
+++ b/driver/tcpm/mt6370.c
@@ -71,7 +71,8 @@ static int mt6370_init(int port)
return rv;
}
-static int mt6370_get_cc(int port, int *cc1, int *cc2)
+static int mt6370_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
int status;
int rv;
diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c
index 472af584ae..42925910de 100644
--- a/driver/tcpm/nct38xx.c
+++ b/driver/tcpm/nct38xx.c
@@ -167,7 +167,8 @@ static int tcpci_nct38xx_set_cc(int port, int pull)
return rv;
}
-static int tcpci_nct38xx_get_cc(int port, int *cc1, int *cc2)
+static int tcpci_nct38xx_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
int rv;
int rc;
diff --git a/driver/tcpm/stub.c b/driver/tcpm/stub.c
index 23529b5185..0ebe8af999 100644
--- a/driver/tcpm/stub.c
+++ b/driver/tcpm/stub.c
@@ -47,7 +47,8 @@ int tcpm_init(int port)
return init_power_status_mask(port);
}
-int tcpm_get_cc(int port, int *cc1, int *cc2)
+int tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
return tcpc_get_cc(port, cc1, cc2);
}
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index ab0b4f777c..829f636cff 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -190,7 +190,8 @@ static int clear_power_status_mask(int port)
return tcpc_write(port, TCPC_REG_POWER_STATUS_MASK, 0);
}
-int tcpci_tcpm_get_cc(int port, int *cc1, int *cc2)
+int tcpci_tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
int status;
int rv;
diff --git a/driver/tcpm/tcpci.h b/driver/tcpm/tcpci.h
index 285cba1f57..9bec93e325 100644
--- a/driver/tcpm/tcpci.h
+++ b/driver/tcpm/tcpci.h
@@ -10,6 +10,7 @@
#include "tcpm.h"
#include "usb_mux.h"
+#include "usb_pd_tcpm.h"
#define TCPC_REG_VENDOR_ID 0x0
#define TCPC_REG_PRODUCT_ID 0x2
@@ -135,7 +136,8 @@ extern const struct usb_mux_driver tcpci_tcpm_usb_mux_driver;
void tcpci_tcpc_alert(int port);
int tcpci_tcpm_init(int port);
-int tcpci_tcpm_get_cc(int port, int *cc1, int *cc2);
+int tcpci_tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2);
int tcpci_tcpm_get_vbus_level(int port);
int tcpci_tcpm_select_rp_value(int port, int rp);
int tcpci_tcpm_set_cc(int port, int pull);
diff --git a/driver/tcpm/tcpm.h b/driver/tcpm/tcpm.h
index ca7d3cf7bd..1ef4073211 100644
--- a/driver/tcpm/tcpm.h
+++ b/driver/tcpm/tcpm.h
@@ -124,7 +124,8 @@ static inline int tcpm_release(int port)
return tcpc_config[port].drv->release(port);
}
-static inline int tcpm_get_cc(int port, int *cc1, int *cc2)
+static inline int tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
return tcpc_config[port].drv->get_cc(port, cc1, cc2);
}
@@ -266,7 +267,8 @@ int tcpm_init(int port);
*
* @return EC_SUCCESS or error
*/
-int tcpm_get_cc(int port, int *cc1, int *cc2);
+int tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2);
/**
* Read VBUS
diff --git a/fuzz/usb_pd_fuzz.c b/fuzz/usb_pd_fuzz.c
index fd2df968c1..3c97d7b0bb 100644
--- a/fuzz/usb_pd_fuzz.c
+++ b/fuzz/usb_pd_fuzz.c
@@ -60,7 +60,8 @@ struct tcpc_state {
static struct tcpc_state mock_tcpc_state[CONFIG_USB_PD_PORT_COUNT];
-static int mock_tcpm_get_cc(int port, int *cc1, int *cc2)
+static int mock_tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2)
{
*cc1 = mock_tcpc_state[port].cc1;
*cc2 = mock_tcpc_state[port].cc2;
diff --git a/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h
index 04426315f9..3f6fa2d139 100644
--- a/include/usb_pd_tcpc.h
+++ b/include/usb_pd_tcpc.h
@@ -48,7 +48,8 @@ void pd_vbus_evt_p1(enum gpio_signal signal);
int tcpc_alert_status(int port, int *alert);
int tcpc_alert_status_clear(int port, uint16_t mask);
int tcpc_alert_mask_set(int port, uint16_t mask);
-int tcpc_get_cc(int port, int *cc1, int *cc2);
+int tcpc_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2);
int tcpc_select_rp_value(int port, int rp);
int tcpc_set_cc(int port, int pull);
int tcpc_set_polarity(int port, int polarity);
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 858e7003d0..7151cce4bf 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -10,6 +10,7 @@
#include "ec_commands.h"
#include "i2c.h"
+#include "usb_pd_tcpm.h"
/* Default retry count for transmitting */
#define PD_RETRY_COUNT 3
@@ -68,7 +69,7 @@ enum tcpc_transmit_complete {
/**
* Returns whether the sink has detected a Rp resistor on the other side.
*/
-static inline int cc_is_rp(int cc)
+static inline int cc_is_rp(enum tcpc_cc_voltage_status cc)
{
return (cc == TYPEC_CC_VOLT_RP_DEF) || (cc == TYPEC_CC_VOLT_RP_1_5) ||
(cc == TYPEC_CC_VOLT_RP_3_0);
@@ -77,7 +78,8 @@ static inline int cc_is_rp(int cc)
/**
* Returns true if both CC lines are completely open.
*/
-static inline int cc_is_open(int cc1, int cc2)
+static inline int cc_is_open(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2)
{
return cc1 == TYPEC_CC_VOLT_OPEN && cc2 == TYPEC_CC_VOLT_OPEN;
}
@@ -85,7 +87,8 @@ static inline int cc_is_open(int cc1, int cc2)
/**
* Returns true if we detect the port partner is a snk debug accessory.
*/
-static inline int cc_is_snk_dbg_acc(int cc1, int cc2)
+static inline int cc_is_snk_dbg_acc(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2)
{
return cc1 == TYPEC_CC_VOLT_RD && cc2 == TYPEC_CC_VOLT_RD;
}
@@ -93,7 +96,8 @@ static inline int cc_is_snk_dbg_acc(int cc1, int cc2)
/**
* Returns true if the port partner is an audio accessory.
*/
-static inline int cc_is_audio_acc(int cc1, int cc2)
+static inline int cc_is_audio_acc(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2)
{
return cc1 == TYPEC_CC_VOLT_RA && cc2 == TYPEC_CC_VOLT_RA;
}
@@ -101,7 +105,8 @@ static inline int cc_is_audio_acc(int cc1, int cc2)
/**
* Returns true if the port partner is presenting at least one Rd
*/
-static inline int cc_is_at_least_one_rd(int cc1, int cc2)
+static inline int cc_is_at_least_one_rd(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2)
{
return cc1 == TYPEC_CC_VOLT_RD || cc2 == TYPEC_CC_VOLT_RD;
}
@@ -109,7 +114,8 @@ static inline int cc_is_at_least_one_rd(int cc1, int cc2)
/**
* Returns true if the port partner is presenting Rd on only one CC line.
*/
-static inline int cc_is_only_one_rd(int cc1, int cc2)
+static inline int cc_is_only_one_rd(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2)
{
return cc_is_at_least_one_rd(cc1, cc2) && cc1 != cc2;
}
@@ -143,7 +149,8 @@ struct tcpm_drv {
*
* @return EC_SUCCESS or error
*/
- int (*get_cc)(int port, int *cc1, int *cc2);
+ int (*get_cc)(int port, enum tcpc_cc_voltage_status *cc1,
+ enum tcpc_cc_voltage_status *cc2);
/**
* Read VBUS
diff --git a/include/usb_tc_sm.h b/include/usb_tc_sm.h
index fedee1c7ec..1019bf2c20 100644
--- a/include/usb_tc_sm.h
+++ b/include/usb_tc_sm.h
@@ -9,6 +9,7 @@
#define __CROS_EC_USB_TC_H
#include "usb_sm.h"
+#include "usb_pd_tcpm.h"
enum typec_state_id {
TC_DISABLED,
@@ -131,7 +132,8 @@ void tc_set_timeout(int port, uint64_t timeout);
* @param cc2 value of CC2 set by tcpm_get_cc
* @return 0 if cc1 is connected, else 1 for cc2
*/
-enum pd_cc_polarity_type get_snk_polarity(int cc1, int cc2);
+enum pd_cc_polarity_type get_snk_polarity(enum tcpc_cc_voltage_status cc1,
+ enum tcpc_cc_voltage_status cc2);
/**
* Restarts the TCPC