summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2018-08-09 13:37:25 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-08-15 16:37:13 -0700
commitbddf57fa4be379a3e3fe0028df011ac6027a2f67 (patch)
tree9559a1adb601c8cdd1375de14d16c3454463dae2
parent5012ca7804c594c763cc36ee93db1e90c118eac8 (diff)
downloadchrome-ec-bddf57fa4be379a3e3fe0028df011ac6027a2f67.tar.gz
ss-mux: move enter_low_power_mode method to drv
After implementing this new method twice, I realized that the enter_low_power_mode method did not need to be configured at the board level so it can move to the more common mux driver. BRANCH=none BUG=none TEST=bip low power mux operation still works Change-Id: I33d7191ae22da089972929eb60b3bae568a2c447 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1169904 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--driver/usb_mux.c4
-rw-r--r--include/usb_mux.h24
2 files changed, 14 insertions, 14 deletions
diff --git a/driver/usb_mux.c b/driver/usb_mux.c
index 921a6b29c0..9d2df37a51 100644
--- a/driver/usb_mux.c
+++ b/driver/usb_mux.c
@@ -38,8 +38,8 @@ static void enter_low_power_mode(int port)
flags[port] |= USB_MUX_FLAG_IN_LPM;
/* Apply any low power customization if present */
- if (mux->enter_low_power_mode) {
- res = mux->enter_low_power_mode(mux);
+ if (mux->driver->enter_low_power_mode) {
+ res = mux->driver->enter_low_power_mode(mux->port_addr);
if (res)
CPRINTS("Err: enter_low_power_mode mux port(%d): %d",
diff --git a/include/usb_mux.h b/include/usb_mux.h
index 6a01aae3df..8944c4b774 100644
--- a/include/usb_mux.h
+++ b/include/usb_mux.h
@@ -68,6 +68,18 @@ struct usb_mux_driver {
* @return EC_SUCCESS on success, non-zero error code on failure.
*/
int (*get)(int port_addr, mux_state_t *mux_state);
+
+ /**
+ * Optional method that is called after the mux fully disconnects.
+ *
+ * Note: this method does not need to be defined for TCPC/MUX combos
+ * where the TCPC is actively used since the PD state machine
+ * will put the chip into lower power mode.
+ *
+ * @param mux USB mux to put into low power.
+ * @return EC_SUCCESS on success, non-zero error code on failure.
+ */
+ int (*enter_low_power_mode)(int port_addr);
};
/* Describes a USB mux present in the system */
@@ -82,18 +94,6 @@ struct usb_mux {
const struct usb_mux_driver *driver;
/**
- * Optional method that is called after the mux fully disconnects.
- *
- * Note: this method does not need to be defined for TCPC/MUX combos
- * where the TCPC is actively used since the PD state machine
- * will put the chip into lower power mode.
- *
- * @param mux USB mux to put into low power.
- * @return EC_SUCCESS on success, non-zero error code on failure.
- */
- int (*enter_low_power_mode)(const struct usb_mux *mux);
-
- /**
* Optional method for tuning for USB mux during mux->driver->init().
*
* @param mux USB mux to tune