From d1a18f82ed831d4e640336ff5571f5fa64bc7b36 Mon Sep 17 00:00:00 2001 From: Denis Brockus Date: Tue, 25 Jun 2019 12:44:16 -0600 Subject: Use 7bit I2C/SPI slave addresses in EC Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal --- test/battery_get_params_smart.c | 6 ++++-- test/sbs_charging_v2.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/battery_get_params_smart.c b/test/battery_get_params_smart.c index 9a1eeda825..5ee62d3682 100644 --- a/test/battery_get_params_smart.c +++ b/test/battery_get_params_smart.c @@ -40,12 +40,14 @@ int sb_read(int cmd, int *param) if (read_count >= fail_on_first && read_count <= fail_on_last) return EC_ERROR_UNKNOWN; - return i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, cmd, param); + return i2c_read16__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf, + cmd, param); } int sb_write(int cmd, int param) { write_count++; - return i2c_write16(I2C_PORT_BATTERY, BATTERY_ADDR, cmd, param); + return i2c_write16__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf, + cmd, param); } diff --git a/test/sbs_charging_v2.c b/test/sbs_charging_v2.c index 06af4b4f00..7270173997 100644 --- a/test/sbs_charging_v2.c +++ b/test/sbs_charging_v2.c @@ -180,7 +180,7 @@ static int test_charge_state(void) /* Detach battery, charging error */ ccprintf("[CHARGING TEST] Detach battery\n"); - TEST_ASSERT(test_detach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR) == + TEST_ASSERT(test_detach_i2c__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf) == EC_SUCCESS); msleep(BATTERY_DETACH_DELAY); state = wait_charging_state(); @@ -188,7 +188,7 @@ static int test_charge_state(void) /* Attach battery again, charging */ ccprintf("[CHARGING TEST] Attach battery\n"); - test_attach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR); + test_attach_i2c__7bf(I2C_PORT_BATTERY, BATTERY_ADDR__7bf); /* And changing full capacity should trigger a host event */ ev_clear(EC_HOST_EVENT_BATTERY); sb_write(SB_FULL_CHARGE_CAPACITY, 0xeff0); -- cgit v1.2.1