summaryrefslogtreecommitdiff
path: root/driver/tcpm
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-09-25 11:33:53 -0600
committerCommit Bot <commit-bot@chromium.org>2019-10-07 23:33:24 +0000
commit0783b019fc880443a768acdc1286499a49594baa (patch)
tree68751a4d70cb7c97af0421f5cef2c98e73b52b24 /driver/tcpm
parent87d1b1904dc58fbadd21cd5c7c6b03da2e42d077 (diff)
downloadchrome-ec-0783b019fc880443a768acdc1286499a49594baa.tar.gz
pd: FRS enable/disable and interrupt handling
BUG=b:138599955 BRANCH=none TEST=make buildall -j Change-Id: I0c639aae18e8c2c2d1b457e2e209f8484a834f6b Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825507 Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'driver/tcpm')
-rw-r--r--driver/tcpm/tcpci.h3
-rw-r--r--driver/tcpm/tcpm.h19
2 files changed, 20 insertions, 2 deletions
diff --git a/driver/tcpm/tcpci.h b/driver/tcpm/tcpci.h
index d2950b7b1a..491fe195ed 100644
--- a/driver/tcpm/tcpci.h
+++ b/driver/tcpm/tcpci.h
@@ -20,7 +20,7 @@
#define TCPC_REG_PD_INT_REV 0xa
#define TCPC_REG_ALERT 0x10
-#define TCPC_REG_ALERT_MASK_ALL 0xfff
+#define TCPC_REG_ALERT_MASK_ALL 0xffff
#define TCPC_REG_ALERT_VENDOR_DEF (1<<15)
#define TCPC_REG_ALERT_VBUS_DISCNCT (1<<11)
#define TCPC_REG_ALERT_RX_BUF_OVF (1<<10)
@@ -42,7 +42,6 @@
#define TCPC_REG_POWER_STATUS_MASK 0x14
#define TCPC_REG_FAULT_STATUS_MASK 0x15
#define TCPC_REG_CONFIG_STD_OUTPUT 0x18
-
#define TCPC_REG_CONFIG_STD_OUTPUT_MUX_MASK (3 << 2)
#define TCPC_REG_CONFIG_STD_OUTPUT_MUX_NONE (0 << 2)
#define TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB BIT(2)
diff --git a/driver/tcpm/tcpm.h b/driver/tcpm/tcpm.h
index a5b029d700..51b315fb77 100644
--- a/driver/tcpm/tcpm.h
+++ b/driver/tcpm/tcpm.h
@@ -396,4 +396,23 @@ int tcpm_has_pending_message(int port);
*/
void tcpm_clear_pending_messages(int port);
+/**
+ * Enable/Disable TCPC Fast Role Swap detection
+ *
+ * @param port Type-C port number
+ * @param enable FRS enable (true) disable (false)
+ */
+static inline void tcpm_set_frs_enable(int port, int enable)
+{
+ const struct tcpm_drv *tcpc;
+
+ /*
+ * set_frs_enable will be set to tcpci_tcp_fast_role_swap_enable
+ * if it is handled by the tcpci for the tcpc chipset
+ */
+ tcpc = tcpc_config[port].drv;
+ if (tcpc->set_frs_enable)
+ tcpc->set_frs_enable(port, enable);
+}
+
#endif