usb_mux: Add a callback for board specific init

This adds a callback for board specific initialization that is called
after the driver init function.  This will allow a board to apply
port-specific tuning (such as USB EQ settings) to the mux chip.

BUG=chrome-os-partner:47074
BRANCH=none
TEST=build and boot on chell

Change-Id: Ib162f9a2c5239678c46b80e5517823b336f6b66c
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313746
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Duncan Laurie
2015-11-23 14:26:45 -08:00
committed by chrome-bot
parent 156461b212
commit 1ea9dece80
2 changed files with 13 additions and 0 deletions

View File

@@ -24,6 +24,10 @@ void usb_mux_init(int port)
res = mux->driver->init(mux->port_addr);
if (res)
CPRINTS("Error initializing mux port(%d): %d", port, res);
/* Apply board specific initialization */
if (mux->board_init)
mux->board_init(mux);
}
/*

View File

@@ -66,6 +66,15 @@ struct usb_mux {
const int port_addr;
/* Mux driver */
const struct usb_mux_driver *driver;
/**
* Board specific initialization for USB mux that is
* called after mux->driver->init() function.
*
* @param mux USB mux to tune
* @return EC_SUCCESS on success, non-zero error code on failure.
*/
int (*board_init)(const struct usb_mux *mux);
};
/* Supported USB mux drivers */