diff options
Diffstat (limited to 'driver/tcpm')
-rw-r--r-- | driver/tcpm/anx7447.c | 6 | ||||
-rw-r--r-- | driver/tcpm/anx7447.h | 3 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.c | 6 | ||||
-rw-r--r-- | driver/tcpm/anx74xx.h | 3 | ||||
-rw-r--r-- | driver/tcpm/it83xx.c | 59 | ||||
-rw-r--r-- | driver/tcpm/it8xxx2.c | 57 | ||||
-rw-r--r-- | driver/tcpm/nct38xx.c | 48 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.c | 15 | ||||
-rw-r--r-- | driver/tcpm/rt1718s.c | 45 | ||||
-rw-r--r-- | driver/tcpm/rt1718s.h | 29 | ||||
-rw-r--r-- | driver/tcpm/tcpci.c | 4 |
11 files changed, 228 insertions, 47 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c index dde7b7e306..9ef281bc99 100644 --- a/driver/tcpm/anx7447.c +++ b/driver/tcpm/anx7447.c @@ -455,13 +455,17 @@ static void anx7447_tcpc_alert(int port) static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; void anx7447_tcpc_update_hpd_status(const struct usb_mux *me, - mux_state_t mux_state) + mux_state_t mux_state, + bool *ack_required) { int reg = 0; int port = me->usb_port; int hpd_lvl = (mux_state & USB_PD_MUX_HPD_LVL) ? 1 : 0; int hpd_irq = (mux_state & USB_PD_MUX_HPD_IRQ) ? 1 : 0; + /* This driver does not use host command ACKs */ + *ack_required = false; + /* * All calls within this method need to update to a mux_read/write calls * that use the secondary address. This is a non-trival change and no diff --git a/driver/tcpm/anx7447.h b/driver/tcpm/anx7447.h index 75982e6b91..3b27a19e2d 100644 --- a/driver/tcpm/anx7447.h +++ b/driver/tcpm/anx7447.h @@ -143,7 +143,8 @@ extern const struct tcpm_drv anx7447_tcpm_drv; extern const struct usb_mux_driver anx7447_usb_mux_driver; void anx7447_tcpc_clear_hpd_status(int port); void anx7447_tcpc_update_hpd_status(const struct usb_mux *me, - mux_state_t mux_state); + mux_state_t mux_state, + bool *ack_required); /** * Erase OCM flash if it's not empty diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c index 567005920e..1fc813c448 100644 --- a/driver/tcpm/anx74xx.c +++ b/driver/tcpm/anx74xx.c @@ -233,13 +233,17 @@ static void anx74xx_tcpc_discharge_vbus(int port, int enable) static uint64_t hpd_deadline[CONFIG_USB_PD_PORT_MAX_COUNT]; void anx74xx_tcpc_update_hpd_status(const struct usb_mux *me, - mux_state_t mux_state) + mux_state_t mux_state, + bool *ack_required) { int reg; int port = me->usb_port; int hpd_lvl = (mux_state & USB_PD_MUX_HPD_LVL) ? 1 : 0; int hpd_irq = (mux_state & USB_PD_MUX_HPD_IRQ) ? 1 : 0; + /* This driver does not use host command ACKs */ + *ack_required = false; + mux_read(me, ANX74XX_REG_HPD_CTRL_0, ®); if (hpd_lvl) reg |= ANX74XX_REG_HPD_OUT_DATA; diff --git a/driver/tcpm/anx74xx.h b/driver/tcpm/anx74xx.h index 8d700d4d86..19ac3e304f 100644 --- a/driver/tcpm/anx74xx.h +++ b/driver/tcpm/anx74xx.h @@ -220,7 +220,8 @@ extern const struct usb_mux_driver anx74xx_tcpm_usb_mux_driver; void anx74xx_tcpc_set_vbus(int port, int enable); void anx74xx_tcpc_clear_hpd_status(int port); void anx74xx_tcpc_update_hpd_status(const struct usb_mux *me, - mux_state_t mux_state); + mux_state_t mux_state, + bool *ack_required); #ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC extern struct i2c_stress_test_dev anx74xx_i2c_stress_test_dev; diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c index 7bd2913bd7..c809cce153 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -737,8 +737,8 @@ static int it83xx_tcpm_enter_low_power_mode(int port) { /* * ITE embedded TCPC SLEEP_MASK_USB_PD flag is only controlled by - * it83xx driver in set_pd_sleep_mask(), and do low power mode in - * idle_task(). + * it83xx driver in tc_update_pd_sleep_mask(), and do low power + * mode in idle_task(). * In deep sleep mode, ITE TCPC clock is turned off, and the * timer every 5ms to exit the mode and wakeup PD task to run * (ex. change the CC lines termination). @@ -786,17 +786,17 @@ void switch_plug_out_type(enum usbpd_port port) it83xx_tcpm_switch_plug_out_type(port); } -void set_pd_sleep_mask(int port) +__override void tc_update_pd_sleep_mask(int port) { int i; bool prevent_deep_sleep = false; /* - * Set SLEEP_MASK_USB_PD for deep sleep mode: - * 1.Enable deep sleep mode, when all ITE ports are in Unattach.SRC/SNK - * state (HOOK_DISCONNECT called) and other ports aren't pd_capable(). - * 2.Disable deep sleep mode, when one of ITE port is in Attach.SRC/SNK - * state (HOOK_CONNECT called) or one of other ports is pd_capable(). + * Check ITE embedded pd ports to set SLEEP_MASK_USB_PD: + * In tc_attached_[src, snk]_entry states, calling HOOK_CONNECT + * to enable BMC PHY, and if one of ITE pd ports BMC PHY is enable, + * then EC deep doze mode will be disabled. + * Otherwise, EC deep doze mode will be enabled. */ for (i = 0; i < CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT; ++i) { if (IT83XX_USBPD_GCR(i) & USBPD_REG_MASK_BMC_PHY) { @@ -806,9 +806,11 @@ void set_pd_sleep_mask(int port) } /* - * Check if any other ports have a PD port partner connected. Deep - * sleep is forbidden if any PD port partner is connected. Above, we - * only checked for the ITE ports. + * Check Other stand alone pd ports to set SLEEP_MASK_USB_PD: + * In [pe_src_send_capabilities_run, pe_snk_select_capability_entry] + * states receive [GoodCRC, SRC_CAP] from port partner, then EC deep + * doze mode will be disabled. + * Otherwise, EC deep doze mode will be enabled. */ if (!prevent_deep_sleep) { for (; i < board_get_usb_pd_port_count(); i++) @@ -826,6 +828,16 @@ static void it83xx_tcpm_hook_connect(void) { int port = TASK_ID_TO_PD_PORT(task_get_current()); + /* + * If it isn't ITE active port, then return. + * + * NOTE: If we don't use all the ITE pd ports on a board, then we + * need to start from port0 to use the ITE pd port. If we + * start from port1, then port1 HOOK function never works. + */ + if (port > (CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT - 1)) + return; + #ifdef CONFIG_USB_PD_TCPMV2 /* * There are five cases that hook_connect() be called by TCPMv2: @@ -848,7 +860,14 @@ static void it83xx_tcpm_hook_connect(void) #endif /* Enable PD PHY Tx and Rx module since type-c has connected. */ USBPD_ENABLE_BMC_PHY(port); - set_pd_sleep_mask(port); + /* + * After we're in attached.[SRC, SNK] states and before we receive + * [GoodCRC of SRC_CAP, SRC_CAP] this period time, if EC goes to + * deep doze mode, the pd clock will be gated, then pd can't + * transmit and receive any messages, so we disable deep doze mode + * to make sure that pd won't miss any messages. + */ + tc_update_pd_sleep_mask(port); } DECLARE_HOOK(HOOK_USB_PD_CONNECT, it83xx_tcpm_hook_connect, HOOK_PRIO_DEFAULT); @@ -857,6 +876,16 @@ static void it83xx_tcpm_hook_disconnect(void) { int port = TASK_ID_TO_PD_PORT(task_get_current()); + /* + * If it isn't ITE active port, then return. + * + * NOTE: If we don't use all the ITE pd ports on a board, then we + * need to start from port0 to use the ITE pd port. If we + * start from port1, then port1 HOOK function never works. + */ + if (port > (CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT - 1)) + return; + if (IS_ENABLED(IT83XX_INTC_PLUG_IN_OUT_SUPPORT)) /* * Switch to detect plug in and enable detect plug in interrupt, @@ -876,7 +905,11 @@ static void it83xx_tcpm_hook_disconnect(void) if (IS_ENABLED(CONFIG_USB_PD_DECODE_SOP)) sop_prime_en[port] = 0; USBPD_DISABLE_BMC_PHY(port); - set_pd_sleep_mask(port); + /* + * Since PD BMC PHY is off, then EC can go to deep doze mode and + * turn off pd clock. + */ + tc_update_pd_sleep_mask(port); } DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, it83xx_tcpm_hook_disconnect, diff --git a/driver/tcpm/it8xxx2.c b/driver/tcpm/it8xxx2.c index dd5d1231fc..7bed654132 100644 --- a/driver/tcpm/it8xxx2.c +++ b/driver/tcpm/it8xxx2.c @@ -657,7 +657,7 @@ static int it8xxx2_tcpm_enter_low_power_mode(int port) { /* * ITE embedded TCPC SLEEP_MASK_USB_PD flag is only controlled by - * it8xxx2 driver in it8xxx2_set_pd_sleep_mask(), and do low power + * it8xxx2 driver in tc_update_pd_sleep_mask(), and do low power * mode in idle_task(). * In deep sleep mode, ITE TCPC clock is turned off, and the * timer every 5ms to exit the mode and wakeup PD task to run @@ -844,17 +844,17 @@ static int it8xxx2_tcpm_init(int port) return EC_SUCCESS; } -static void it8xxx2_set_pd_sleep_mask(int port) +__override void tc_update_pd_sleep_mask(int port) { int i; bool prevent_deep_sleep = false; /* - * Set SLEEP_MASK_USB_PD for deep sleep mode: - * 1.Enable deep sleep mode, when all ITE ports are in Unattach.SRC/SNK - * state (HOOK_DISCONNECT called) and other ports aren't pd_capable(). - * 2.Disable deep sleep mode, when one of ITE port is in Attach.SRC/SNK - * state (HOOK_CONNECT called) or one of other ports is pd_capable(). + * Check ITE embedded pd ports to set SLEEP_MASK_USB_PD: + * In tc_attached_[src, snk]_entry states, calling HOOK_CONNECT + * to enable BMC PHY, and if one of ITE pd ports BMC PHY is enable, + * then EC deep doze mode will be disabled. + * Otherwise, EC deep doze mode will be enabled. */ for (i = 0; i < CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT; ++i) { if (IT83XX_USBPD_PDGCR(i) & USBPD_REG_MASK_BMC_PHY) { @@ -864,9 +864,11 @@ static void it8xxx2_set_pd_sleep_mask(int port) } /* - * Check if any other ports have a PD port partner connected. Deep - * sleep is forbidden if any PD port partner is connected. Above, we - * only checked for the ITE ports. + * Check Other stand alone pd ports to set SLEEP_MASK_USB_PD: + * In [pe_src_send_capabilities_run, pe_snk_select_capability_entry] + * states receive [GoodCRC, SRC_CAP] from port partner, then EC deep + * doze mode will be disabled. + * Otherwise, EC deep doze mode will be enabled. */ if (!prevent_deep_sleep) { for (; i < board_get_usb_pd_port_count(); i++) @@ -884,6 +886,16 @@ static void it8xxx2_tcpm_hook_connect(void) { int port = TASK_ID_TO_PD_PORT(task_get_current()); + /* + * If it isn't ITE active port, then return. + * + * NOTE: If we don't use all the ITE pd ports on a board, then we + * need to start from port0 to use the ITE pd port. If we + * start from port1, then port1 HOOK function never works. + */ + if (port > (CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT - 1)) + return; + #ifdef CONFIG_USB_PD_TCPMV2 /* * There are five cases that hook_connect() be called by TCPMv2: @@ -906,7 +918,14 @@ static void it8xxx2_tcpm_hook_connect(void) #endif /* Enable PD PHY Tx and Rx module since type-c has connected. */ USBPD_ENABLE_BMC_PHY(port); - it8xxx2_set_pd_sleep_mask(port); + /* + * After we're in attached.[SRC, SNK] states and before we receive + * [GoodCRC of SRC_CAP, SRC_CAP] this period time, if EC goes to + * deep doze mode, the pd clock will be gated, then pd can't + * transmit and receive any messages, so we disable deep doze mode + * to make sure that pd won't miss any messages. + */ + tc_update_pd_sleep_mask(port); } DECLARE_HOOK(HOOK_USB_PD_CONNECT, it8xxx2_tcpm_hook_connect, HOOK_PRIO_DEFAULT); @@ -915,6 +934,16 @@ static void it8xxx2_tcpm_hook_disconnect(void) { int port = TASK_ID_TO_PD_PORT(task_get_current()); + /* + * If it isn't ITE active port, then return. + * + * NOTE: If we don't use all the ITE pd ports on a board, then we + * need to start from port0 to use the ITE pd port. If we + * start from port1, then port1 HOOK function never works. + */ + if (port > (CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT - 1)) + return; + if (IS_ENABLED(IT83XX_INTC_PLUG_IN_OUT_SUPPORT)) /* * Switch to detect plug in and enable detect plug in interrupt, @@ -934,7 +963,11 @@ static void it8xxx2_tcpm_hook_disconnect(void) if (IS_ENABLED(CONFIG_USB_PD_DECODE_SOP)) sop_prime_en[port] = 0; USBPD_DISABLE_BMC_PHY(port); - it8xxx2_set_pd_sleep_mask(port); + /* + * Since PD BMC PHY is off, then EC can go to deep doze mode and + * turn off pd clock. + */ + tc_update_pd_sleep_mask(port); } DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, it8xxx2_tcpm_hook_disconnect, diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c index 00240516e5..0d45c8aa9f 100644 --- a/driver/tcpm/nct38xx.c +++ b/driver/tcpm/nct38xx.c @@ -14,6 +14,17 @@ #include "tcpm/tcpci.h" #include "usb_common.h" +#ifdef CONFIG_ZEPHYR +#include <device.h> +#include <drivers/gpio/gpio_nct38xx.h> +#include "usbc/tcpc_nct38xx.h" +#endif + +#if defined(CONFIG_ZEPHYR) && defined(CONFIG_IO_EXPANDER_NCT38XX) +#error CONFIG_IO_EXPANDER_NCT38XX cannot be used with Zephyr. +#error Enable the Zephyr driver CONFIG_GPIO_NCT38XX instead. +#endif + #if !defined(CONFIG_USB_PD_TCPM_TCPCI) #error "NCT38XX is using part of standard TCPCI control" #error "Please upgrade your board configuration" @@ -134,8 +145,19 @@ static int nct38xx_init(int port) * Enable the Vendor Define alert event only when the IO expander * feature is defined */ - if (IS_ENABLED(CONFIG_IO_EXPANDER_NCT38XX)) + if (IS_ENABLED(CONFIG_IO_EXPANDER_NCT38XX) || + IS_ENABLED(CONFIG_GPIO_NCT38XX)) { +#ifdef CONFIG_ZEPHYR + const struct device *dev = + nct38xx_get_gpio_device_from_port(port); + + if (!device_is_ready(dev)) { + CPRINTS("C%d: device is not ready", port); + return EC_ERROR_BUSY; + } +#endif /* CONFIG_ZEPHYR */ reg |= TCPC_REG_ALERT_VENDOR_DEF; + } rv = tcpc_update16(port, TCPC_REG_ALERT_MASK, @@ -244,6 +266,20 @@ __overridable int board_map_nct38xx_tcpc_port_to_ioex(int port) return port; } +static inline void nct38xx_tcpc_vendor_defined_alert(int port) +{ +#ifdef CONFIG_ZEPHYR + const struct device *dev = nct38xx_get_gpio_device_from_port(port); + + nct38xx_gpio_alert_handler(dev); +#else + int ioexport; + + ioexport = board_map_nct38xx_tcpc_port_to_ioex(port); + nct38xx_ioex_event_handler(ioexport); +#endif /* CONFIG_ZEPHYR */ +} + static void nct38xx_tcpc_alert(int port) { int alert, rv; @@ -274,12 +310,10 @@ static void nct38xx_tcpc_alert(int port) * tcpci_tcpc_alert(). Check the Vendor Defined Alert bit to * handle the IOEX IO's interrupt event. */ - if (IS_ENABLED(CONFIG_IO_EXPANDER_NCT38XX) && - rv == EC_SUCCESS && (alert & TCPC_REG_ALERT_VENDOR_DEF)) { - int ioexport; - - ioexport = board_map_nct38xx_tcpc_port_to_ioex(port); - nct38xx_ioex_event_handler(ioexport); + if ((IS_ENABLED(CONFIG_IO_EXPANDER_NCT38XX) || + IS_ENABLED(CONFIG_GPIO_NCT38XX)) && + rv == EC_SUCCESS && (alert & TCPC_REG_ALERT_VENDOR_DEF)) { + nct38xx_tcpc_vendor_defined_alert(port); } } diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 426219f1fa..572616efb4 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -383,12 +383,16 @@ bool check_ps8755_chip(int port) } void ps8xxx_tcpc_update_hpd_status(const struct usb_mux *me, - mux_state_t mux_state) + mux_state_t mux_state, + bool *ack_required) { int port = me->usb_port; int hpd_lvl = (mux_state & USB_PD_MUX_HPD_LVL) ? 1 : 0; int hpd_irq = (mux_state & USB_PD_MUX_HPD_IRQ) ? 1 : 0; + /* This driver does not use host command ACKs */ + *ack_required = false; + if (IS_ENABLED(CONFIG_USB_PD_TCPM_PS8751_CUSTOM_MUX_DRIVER) && product_id[me->usb_port] == PS8751_PRODUCT_ID && me->flags & USB_MUX_FLAG_NOT_TCPC) @@ -710,11 +714,12 @@ static int ps8xxx_get_chip_info(int port, int live, static int ps8xxx_enter_low_power_mode(int port) { /* - * PS8751 has the auto sleep function that enters low power mode on - * its own in ~2 seconds. Other chips don't have it. Stub it out for - * PS8751. + * PS8751/PS8815 has the auto sleep function that enters + * low power mode on its own in ~2 seconds. Other chips + * don't have it. Stub it out for PS8751/PS8815. */ - if (product_id[port] == PS8751_PRODUCT_ID) + if (product_id[port] == PS8751_PRODUCT_ID || + product_id[port] == PS8815_PRODUCT_ID) return EC_SUCCESS; return tcpci_enter_low_power_mode(port); diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c index 9d5a8895ad..81356c946c 100644 --- a/driver/tcpm/rt1718s.c +++ b/driver/tcpm/rt1718s.c @@ -88,7 +88,7 @@ int rt1718s_read16(int port, int reg, int *val) } -static int rt1718s_sw_reset(int port) +int rt1718s_sw_reset(int port) { int rv; @@ -252,6 +252,9 @@ static int rt1718s_init(int port) TCPC_REG_ALERT_MASK_VENDOR_DEF, MASK_SET)); + if (IS_ENABLED(CONFIG_USB_PD_FRS_TCPC)) + rt1718s_frs_init(port); + RETURN_ERROR(board_rt1718s_init(port)); return EC_SUCCESS; @@ -326,7 +329,11 @@ static void rt1718s_bc12_usb_charger_task(const int port) uint32_t evt = task_wait_event(-1); if (evt & USB_CHG_EVENT_VBUS) { - if (pd_snk_is_vbus_provided(port)) + bool is_non_pd_sink = !pd_capable(port) && + pd_get_power_role(port) == PD_ROLE_SINK && + pd_snk_is_vbus_provided(port); + + if (is_non_pd_sink) rt1718s_enable_bc12_sink(port, true); else rt1718s_update_charge_manager( @@ -428,7 +435,7 @@ static int rt1718s_enter_low_power_mode(int port) int rt1718s_get_adc(int port, enum rt1718s_adc_channel channel, int *adc_val) { - static struct mutex adc_lock; + static mutex_t adc_lock; int rv; const int max_wait_times = 30; @@ -520,6 +527,35 @@ int rt1718s_gpio_get_level(int port, enum rt1718s_gpio signal) return !!(val & RT1718S_GPIO_CTRL_I); } +static int command_rt1718s_gpio(int argc, char **argv) +{ + int i, j; + uint32_t flags; + + for (i = 0; i < board_get_usb_pd_port_count(); i++) { + + if (tcpc_config[i].drv != &rt1718s_tcpm_drv) + continue; + + for (j = 0; j < RT1718S_GPIO_COUNT; j++) { + int rv; + + rv = rt1718s_read8(i, RT1718S_GPIO_CTRL(j), &flags); + if (rv) + return EC_ERROR_UNKNOWN; + + ccprintf("C%d GPIO%d OD=%d PU=%d PD=%d OE=%d HL=%d\n", + i, j, !(flags & RT1718S_GPIO_CTRL_OD_N), + !!(flags & RT1718S_GPIO_CTRL_PU), + !!(flags & RT1718S_GPIO_CTRL_PD), + !!(flags & RT1718S_GPIO_CTRL_OE), + !!(flags & RT1718S_GPIO_CTRL_O)); + } + } + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(rt1718s_gpio, command_rt1718s_gpio, "", "RT1718S GPIO"); + /* RT1718S is a TCPCI compatible port controller */ const struct tcpm_drv rt1718s_tcpm_drv = { .init = &rt1718s_init, @@ -554,6 +590,9 @@ const struct tcpm_drv rt1718s_tcpm_drv = { #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &rt1718s_enter_low_power_mode, #endif +#ifdef CONFIG_USB_PD_FRS_TCPC + .set_frs_enable = &rt1718s_set_frs_enable, +#endif }; const struct bc12_drv rt1718s_bc12_drv = { diff --git a/driver/tcpm/rt1718s.h b/driver/tcpm/rt1718s.h index 07c3ed3f82..2e74132847 100644 --- a/driver/tcpm/rt1718s.h +++ b/driver/tcpm/rt1718s.h @@ -10,7 +10,8 @@ #include "usb_pd_tcpm.h" /* RT1718S Private RegMap */ -#define RT1718S_I2C_ADDR_FLAGS 0x43 +#define RT1718S_I2C_ADDR1_FLAGS 0x43 +#define RT1718S_I2C_ADDR2_FLAGS 0x40 #define RT1718S_VID 0x29CF #define RT1718S_PID 0x1718 @@ -213,6 +214,7 @@ enum rt1718s_gpio { RT1718S_GPIO1 = 0, RT1718S_GPIO2, RT1718S_GPIO3, + RT1718S_GPIO_COUNT, }; /** @@ -242,4 +244,29 @@ void rt1718s_gpio_set_level(int port, enum rt1718s_gpio signal, int value); */ int rt1718s_gpio_get_level(int port, enum rt1718s_gpio signal); +/** + * Set fast role swap. + * + * @param port USB-C port + * @param enable enable/disable FRS + * @return EC_SUCCESS if success, EC_ERROR_UNKNOWN otherwise. + */ +int rt1718s_set_frs_enable(int port, int enable); + +/** + * Initialize RT1718S FRS function + * + * @param port USB-C port + * @return EC_SUCCESS if success, EC_ERROR_UNKNOWN otherwise. + */ +int rt1718s_frs_init(int port); + + +/** + * Software reset RT1718S + * + * @param port USB-C port + * @return EC_SUCCESS if success, EC_ERROR_UNKNOWN otherwise. + */ +int rt1718s_sw_reset(int port); #endif /* __CROS_EC_USB_PD_TCPM_MT6370_H */ diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index 359cb04d30..b04d7be1af 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -877,12 +877,12 @@ struct queue { * Head points to the index of the first empty slot to put a new RX * message. Must be masked before used in lookup. */ - uint32_t head; + atomic_t head; /* * Tail points to the index of the first message for the PD task to * consume. Must be masked before used in lookup. */ - uint32_t tail; + atomic_t tail; struct cached_tcpm_message buffer[CACHE_DEPTH]; }; static struct queue cached_messages[CONFIG_USB_PD_PORT_MAX_COUNT]; |