summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDivya Sasidharan <divya.s.sasidharan@intel.com>2020-12-22 16:45:04 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-11 20:55:42 +0000
commit9577f11c94055b344d2a2305f9e5ea62dd818b86 (patch)
tree89487a05f12ce8a591e03b635cfe074cb2c9fa5d
parent0478fa3a828e8e93e66e607ebc8ae9a10ee0a028 (diff)
downloadchrome-ec-9577f11c94055b344d2a2305f9e5ea62dd818b86.tar.gz
usb_mux: Optimize reading mux state on unconnected port
If Type-C port has nothing connected then the query of mux state should not power on the mux for reading the state. This helps reduce unnecessary power on/off retimer or mux for ports with no device attached to it. BUG=b:174240235 BRANCH=None TEST=Test enumeration of type-c devices is not affected. Also check on voxel if retimer init is not called periodically when device is not connected. Change-Id: I2f1c4093889164c0d47c3ac33e7a46ab524bcce0 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2601679 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--driver/usb_mux/usb_mux.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index 246d6acff0..b566383e86 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -232,27 +232,17 @@ void usb_mux_set(int port, mux_state_t mux_mode,
mux_state_t usb_mux_get(int port)
{
mux_state_t mux_state;
- bool is_low_power_mode;
int rv;
if (port >= board_get_usb_pd_port_count()) {
return USB_PD_MUX_NONE;
}
- /* Store the status of LPM flag (low power mode) */
- is_low_power_mode = flags[port] & USB_MUX_FLAG_IN_LPM;
-
- exit_low_power_mode(port);
+ if (flags[port] & USB_MUX_FLAG_IN_LPM)
+ return USB_PD_MUX_NONE;
rv = configure_mux(port, USB_MUX_GET_MODE, &mux_state);
- /*
- * If the LPM flag was set prior to reading the mux state, re-enter the
- * low power mode.
- */
- if (is_low_power_mode)
- enter_low_power_mode(port);
-
return rv ? USB_PD_MUX_NONE : mux_state;
}