diff options
author | Zhuohao Lee <zhuohao@chromium.org> | 2018-08-06 14:18:55 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-07 01:50:39 -0700 |
commit | 7c47fcc96889866ee143e01b56f78b3732657a7f (patch) | |
tree | 7e2455270ced9d72e447aabfa6806df1e0b14565 /board/sweetberry | |
parent | b3ff32c510e8842d9ee043d9c9b09a1efb60f9db (diff) | |
download | chrome-ec-7c47fcc96889866ee143e01b56f78b3732657a7f.tar.gz |
i2c: add i2c_lock before and after calling i2c_xfer
According to the include/i2c.h, we need to call i2c_lock
before and after calling i2c_xfer. This patch adds the lock
to protect the i2c data transmission.
BUG=none
BRANCH=master
TEST=make buildall -j
Change-Id: If125333902105c35ca332c154bbb8012c363d1bf
Signed-off-by: Zhuohao Lee <zhuohao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1163543
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Diffstat (limited to 'board/sweetberry')
-rw-r--r-- | board/sweetberry/board.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/board/sweetberry/board.c b/board/sweetberry/board.c index 9488695e1e..8640cfd87f 100644 --- a/board/sweetberry/board.c +++ b/board/sweetberry/board.c @@ -121,6 +121,8 @@ static void board_init(void) uint8_t tmp; /* i2c 0 has a tendancy to get wedged. TODO(nsanders): why? */ + i2c_lock(0, 1); i2c_xfer(0, 0, NULL, 0, &tmp, 1, I2C_XFER_SINGLE); + i2c_lock(0, 0); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); |