summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Brandmeyer <jbrandmeyer@chromium.org>2018-09-13 14:14:19 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-09-14 12:08:45 -0700
commit6b72a548f7a0999a43259426432132295635624b (patch)
treeb189d4bb5aa1cb21067f62cb2367e42dcc72305e
parentca25c78f48ed3fb6b52945afa9b5d83136f07c08 (diff)
downloadchrome-ec-6b72a548f7a0999a43259426432132295635624b.tar.gz
ppc: Increase deglitch time on SN5S330
The default deglitch time is short enough to trip the current limit with some commercially available USB-C -> HDMI adapters. Increase the deglitch timeout to improve compatibility with those adapters. BUG=b:113777138, b:113365815 BRANCH=none TEST=Insert 7 different USB-C to HDMI adapters, including both single-function and multifunction devices, and observe that a Careena clamshell will extend the screen to include the attached monitor on both USB-C ports 0 and 1. Brands tested include SIIG, StarTech, Amazon basics, iogear, Apple, and an unlabeled device. Change-Id: I403e4a65e90c85bdaa8078230751d611d04c9c67 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1225354 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--driver/ppc/sn5s330.c21
-rw-r--r--driver/ppc/sn5s330.h7
2 files changed, 28 insertions, 0 deletions
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index 904a968a03..66ffa2678b 100644
--- a/driver/ppc/sn5s330.c
+++ b/driver/ppc/sn5s330.c
@@ -280,6 +280,27 @@ static int sn5s330_init(int port)
return status;
}
+#ifdef CONFIG_USBC_PPC_VCONN
+ /*
+ * Set the deglitch timeout on the Vconn current limit to 640us. This
+ * improves compatibility with some USB C -> HDMI devices versus the
+ * reset default (20 us).
+ */
+ regval = 0;
+ status = i2c_read8(i2c_port, i2c_addr, SN5S330_FUNC_SET8, &regval);
+ if (status) {
+ CPRINTS("ppc p%d: Failed to read FUNC_SET8!", port);
+ return status;
+ }
+ regval &= ~SN5S330_VCONN_DEGLITCH_MASK;
+ regval |= SN5S330_VCONN_DEGLITCH_640_US;
+ status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET8, regval);
+ if (status) {
+ CPRINTS("ppc p%d: Failed to set FUNC_SET8!", port);
+ return status;
+ }
+#endif /* CONFIG_USBC_PPC_VCONN */
+
/*
* Turn off dead battery resistors, turn on CC FETs, and set the higher
* of the two VCONN current limits (min 0.6A). Many VCONN accessories
diff --git a/driver/ppc/sn5s330.h b/driver/ppc/sn5s330.h
index fcb41204ef..039fbe68e4 100644
--- a/driver/ppc/sn5s330.h
+++ b/driver/ppc/sn5s330.h
@@ -101,6 +101,13 @@ enum sn5s330_pp_idx {
#define SN5S330_CC_EN (1 << 4)
#define SN5S330_VCONN_ILIM_SEL (1 << 5)
+/* FUNC_SET_8 */
+#define SN5S330_VCONN_DEGLITCH_MASK (3 << 6)
+#define SN5S330_VCONN_DEGLITCH_63_US (0 << 6)
+#define SN5S330_VCONN_DEGLITCH_125_US (1 << 6)
+#define SN5S330_VCONN_DEGLITCH_640_US (2 << 6)
+#define SN5S330_VCONN_DEGLITCH_1280_US (3 << 6)
+
/* FUNC_SET_9 */
#define SN5S330_FORCE_OVP_EN_SBU (1 << 1)
#define SN5S330_PP2_CONFIG (1 << 2)