summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott <scollyer@chromium.org>2017-03-30 15:43:28 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-04-04 12:18:45 -0700
commit460371042c5422fdad907ded7b8dfe547e16e2ee (patch)
tree2b6421e13df3b2f1b2aa1b375eca2c48a0a1ff7d
parente69a10388476c963c52d99967d15362a5ce44064 (diff)
downloadchrome-ec-460371042c5422fdad907ded7b8dfe547e16e2ee.tar.gz
servo_v4: Don't disable SBU mux when TypeC detach occurs
When a USB PD connection is made, servo_v4 senses the polarity of the SBU signals and sets the SBU mux for the deteted polarity. If the DUT is reset, the SBU mux needs to retain the same state so the H1 console USB endpoint is not disrupted. Modified the CCD_MODE_DISABLED case to no longer disable the SBU mux. In addition, removed the static variable ccd_mode as it was being set, but not ever being checked, so wasn't serving any purpose. BUG=b:36561120 BRANCH=servo_v4 TEST=Connect servo_v4 to Electro. On Electro EC console enter 'reboot' verify the H1 USB console remains connected. Change-Id: I4f0f5167221c04314ca5be063411f200896bbdf6 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/464068 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r--board/servo_v4/board.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c
index b12126c7d8..61271508e7 100644
--- a/board/servo_v4/board.c
+++ b/board/servo_v4/board.c
@@ -304,8 +304,6 @@ static void init_ioexpander(void)
/* Define voltage thresholds for SBU USB detection */
#define GND_MAX_MV 350
#define USB_HIGH_MV 1500
-/* Tracks current state of ccd */
-static int ccd_mode;
static void ccd_measure_sbu(void);
DECLARE_DEFERRED(ccd_measure_sbu);
@@ -324,16 +322,12 @@ static void ccd_measure_sbu(void)
/* SBU flip = 1 */
write_ioexpander(0, 2, 1);
msleep(10);
- gpio_set_level(GPIO_SBU_MUX_EN, 1);
- ccd_mode = CCD_MODE_ENABLED;
CPRINTS("CCD: connected flip");
} else if ((sbu2 > USB_HIGH_MV) &&
(sbu1 < GND_MAX_MV)) {
/* SBU flip = 0 */
write_ioexpander(0, 2, 0);
msleep(10);
- gpio_set_level(GPIO_SBU_MUX_EN, 1);
- ccd_mode = CCD_MODE_ENABLED;
CPRINTS("CCD: connected noflip");
} else {
/* Measure again after 100 msec */
@@ -352,10 +346,12 @@ void ccd_set_mode(enum ccd_mode new_mode)
/* Disable ccd_measure_sbu deferred call always */
hook_call_deferred(&ccd_measure_sbu_data, -1);
- /* Turn off CCD */
- gpio_set_level(GPIO_SBU_MUX_EN, 0);
- CPRINTS("CCD: disconnect");
- ccd_mode = CCD_MODE_DISABLED;
+ /*
+ * The DUT port has detected a detach event. Don't want to
+ * disconnect the SBU mux here so that the H1 USB console can
+ * remain connected.
+ */
+ CPRINTS("CCD: TypeC detach, no change to SBU mux");
}
}
@@ -382,7 +378,11 @@ static void board_init(void)
init_ioexpander();
init_uservo_port();
- /* Initialize CCD mode and disable sbu mux. */
- ccd_set_mode(CCD_MODE_DISABLED);
+ /*
+ * Enable SBU mux. The polarity is set each time a new PD attach event
+ * occurs. But, the SBU mux is not disabled on detach so that the H1 USB
+ * console will survie a DUT EC reset.
+ */
+ gpio_set_level(GPIO_SBU_MUX_EN, 1);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);