mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-02 13:14:51 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user