system: Add i2c slave sleep mask

Add i2c slave sleep mask bit so that deep sleep can be inhibited from
the i2c slave interface independently of the i2c master interface.

BUG=chrome-os-partner:45010
TEST=`make buildall -j`
BRANCH=None

Change-Id: I21755f72a24fedf332e707abf609dc5f8b57e5be
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/303403
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2015-09-30 14:23:47 -07:00
committed by chrome-bot
parent 7e7dd8cd1a
commit 29162aeecc
2 changed files with 14 additions and 10 deletions

View File

@@ -56,15 +56,18 @@ void i2c_lock(int port, int lock)
ASSERT(port != -1);
#endif
if (lock) {
/* Don't allow deep sleep when I2C port is locked */
disable_sleep(SLEEP_MASK_I2C);
/*
* Don't allow deep sleep when I2C port is locked
* TODO(crbug.com/537759): Fix sleep mask for multi-port lock.
*/
disable_sleep(SLEEP_MASK_I2C_MASTER);
mutex_lock(port_mutex + port);
} else {
mutex_unlock(port_mutex + port);
/* Allow deep sleep again after I2C port is unlocked */
enable_sleep(SLEEP_MASK_I2C);
enable_sleep(SLEEP_MASK_I2C_MASTER);
}
}

View File

@@ -294,13 +294,14 @@ enum {
/*
* Sleep masks to prevent going in to deep sleep.
*/
SLEEP_MASK_AP_RUN = (1 << 0), /* the main CPU is running */
SLEEP_MASK_UART = (1 << 1), /* UART communication on-going */
SLEEP_MASK_I2C = (1 << 2), /* I2C master communication on-going */
SLEEP_MASK_CHARGING = (1 << 3), /* Charging loop on-going */
SLEEP_MASK_USB_PWR = (1 << 4), /* USB power loop on-going */
SLEEP_MASK_USB_PD = (1 << 5), /* USB PD device connected */
SLEEP_MASK_SPI = (1 << 6), /* SPI communications on-going */
SLEEP_MASK_AP_RUN = (1 << 0), /* the main CPU is running */
SLEEP_MASK_UART = (1 << 1), /* UART communication ongoing */
SLEEP_MASK_I2C_MASTER = (1 << 2), /* I2C master communication ongoing */
SLEEP_MASK_CHARGING = (1 << 3), /* Charging loop ongoing */
SLEEP_MASK_USB_PWR = (1 << 4), /* USB power loop ongoing */
SLEEP_MASK_USB_PD = (1 << 5), /* USB PD device connected */
SLEEP_MASK_SPI = (1 << 6), /* SPI communications ongoing */
SLEEP_MASK_I2C_SLAVE = (1 << 7), /* I2C slave communication ongoing */
SLEEP_MASK_FORCE_NO_DSLEEP = (1 << 15), /* Force disable. */