summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-09-30 14:23:47 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-30 23:19:53 -0700
commit29162aeeccdbe46ea2b17df105d61f379e6581f2 (patch)
tree5ad6e906226bfc22953425e013a0aa25218cbc85
parent7e7dd8cd1aa232e2790ddfe09bffbe908f3d0230 (diff)
downloadchrome-ec-29162aeeccdbe46ea2b17df105d61f379e6581f2.tar.gz
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>
-rw-r--r--common/i2c.c9
-rw-r--r--include/system.h15
2 files changed, 14 insertions, 10 deletions
diff --git a/common/i2c.c b/common/i2c.c
index a17edc51d4..c3c8d50a9c 100644
--- a/common/i2c.c
+++ b/common/i2c.c
@@ -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);
}
}
diff --git a/include/system.h b/include/system.h
index e6e585ba21..2a1c1784ca 100644
--- a/include/system.h
+++ b/include/system.h
@@ -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. */