summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2016-08-15 14:25:32 +0200
committerchrome-bot <chrome-bot@chromium.org>2016-08-16 00:58:14 -0700
commit81421ba013fb536c38b509165d385caf78f723e6 (patch)
tree58a8b7e20d8744d7e0c264b9d6340652a5ee0b72 /driver
parentb23470dab7878f3a93475369db4c43468e960dbf (diff)
downloadchrome-ec-81421ba013fb536c38b509165d385caf78f723e6.tar.gz
fusb302: enable setting Rp value
Configure the FUSB302 current source used for Rp according to the CONFIG_USB_PD_PULLUP_xxx value. Set the default Rp for Kevin to 1.5A. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:54452 chrome-os-partner:56110 TEST=manual: plug to Samus, enable charging on the Samus side, measure the CC voltage with Twinkie, get 950mV instead of 450mV. Change-Id: I98faf18132a097e49e9c0fa8e1395d230608ee9e Reviewed-on: https://chromium-review.googlesource.com/369190 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/fusb302.c9
-rw-r--r--driver/tcpm/fusb302.h4
2 files changed, 13 insertions, 0 deletions
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index 424c203496..a174e5193e 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -397,6 +397,15 @@ static int fusb302_tcpm_init(int port)
/* Interrupt Enable */
tcpc_read(port, TCPC_REG_CONTROL0, &reg);
reg &= ~TCPC_REG_CONTROL0_INT_MASK;
+ /* Set the current source for Rp value */
+ reg &= ~TCPC_REG_CONTROL0_HOST_CUR_MASK;
+#ifdef CONFIG_USB_PD_PULLUP_1_5A
+ reg |= TCPC_REG_CONTROL0_HOST_CUR_1A5;
+#elif defined(CONFIG_USB_PD_PULLUP_3A)
+ reg |= TCPC_REG_CONTROL0_HOST_CUR_3A0;
+#else
+ reg |= TCPC_REG_CONTROL0_HOST_CUR_USB;
+#endif
tcpc_write(port, TCPC_REG_CONTROL0, reg);
/* Set VCONN switch defaults */
diff --git a/driver/tcpm/fusb302.h b/driver/tcpm/fusb302.h
index 56f1813d7b..edf8c3fdf8 100644
--- a/driver/tcpm/fusb302.h
+++ b/driver/tcpm/fusb302.h
@@ -60,6 +60,10 @@
#define TCPC_REG_CONTROL0 0x06
#define TCPC_REG_CONTROL0_TX_FLUSH (1<<6)
#define TCPC_REG_CONTROL0_INT_MASK (1<<5)
+#define TCPC_REG_CONTROL0_HOST_CUR_MASK (3<<2)
+#define TCPC_REG_CONTROL0_HOST_CUR_3A0 (3<<2)
+#define TCPC_REG_CONTROL0_HOST_CUR_1A5 (2<<2)
+#define TCPC_REG_CONTROL0_HOST_CUR_USB (1<<2)
#define TCPC_REG_CONTROL0_TX_START (1<<0)
#define TCPC_REG_CONTROL1 0x07