summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2020-04-10 11:08:27 -0700
committerCommit Bot <commit-bot@chromium.org>2020-04-12 03:41:33 +0000
commit3f2623d4598f13691747ea4980c5edbd362f958c (patch)
tree103b96d85de2be847b44a440ee43f1819914b7c1 /driver
parente0b4917a07f1a2ec4d0e1d363b2553314714a3ca (diff)
downloadchrome-ec-3f2623d4598f13691747ea4980c5edbd362f958c.tar.gz
TCPC: On CC Alerts, only send CC Events after reading cc status
Some TCPCs generate CC Alerts when drp auto toggle is active and nothing is connected to the port. So, get the CC line status and only generate a PD_EVENT_CC if CC1 or CC2 does not equal TYPEC_CC_VOLT_OPEN. BUG=b:153792197 BRANCH=none TEST=make -j buildall Change-Id: Iacae33b5b461fa5ef70e06278e25381b5c532b47 Signed-off-by: Sam Hurst <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2144928 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/tcpci.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 4a9e8abe6f..8c7773fba6 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -1016,8 +1016,26 @@ void tcpci_tcpc_alert(int port)
tcpc_write16(port, TCPC_REG_ALERT, status);
if (status & TCPC_REG_ALERT_CC_STATUS) {
- /* CC status changed, wake task */
- pd_event |= PD_EVENT_CC;
+ if (IS_ENABLED(CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE)) {
+ enum tcpc_cc_voltage_status cc1;
+ enum tcpc_cc_voltage_status cc2;
+
+ /*
+ * Some TCPCs generate CC Alerts when
+ * drp auto toggle is active and nothing
+ * is connected to the port. So, get the
+ * CC line status and only generate a
+ * PD_EVENT_CC if something is connected.
+ */
+ tcpci_tcpm_get_cc(port, &cc1, &cc2);
+ if (cc1 != TYPEC_CC_VOLT_OPEN ||
+ cc2 != TYPEC_CC_VOLT_OPEN)
+ /* CC status cchanged, wake task */
+ pd_event |= PD_EVENT_CC;
+ } else {
+ /* CC status changed, wake task */
+ pd_event |= PD_EVENT_CC;
+ }
}
if (status & TCPC_REG_ALERT_POWER_STATUS) {
int reg = 0;