diff options
author | Denis Brockus <dbrockus@chromium.org> | 2019-07-16 15:10:11 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-20 23:09:18 +0000 |
commit | 473bd883b60fd5b00377766dae2bacad246de0d2 (patch) | |
tree | 992d9f03104277934c22c869eceb634e2cf5f7ec /driver/als_opt3001.c | |
parent | 053491b560d2c4e374bb739373d8ae25c41f6315 (diff) | |
download | chrome-ec-473bd883b60fd5b00377766dae2bacad246de0d2.tar.gz |
Remove __7b, __8b and __7bf
The extentions were added to make the compiler perform most
of the verification that the conversion was being done correctly
to remove 8bit addressing as the standard I2C/SPI address type.
Now that the compiler has verified the code, the extra
extentions are being removed
BUG=chromium:971296
BRANCH=none
TEST=make buildall -j
TEST=verify sensor functionality on arcada_ish
Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'driver/als_opt3001.c')
-rw-r--r-- | driver/als_opt3001.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/driver/als_opt3001.c b/driver/als_opt3001.c index 42a06bfdcc..e6332184c0 100644 --- a/driver/als_opt3001.c +++ b/driver/als_opt3001.c @@ -17,7 +17,7 @@ static int opt3001_i2c_read(const int reg, int *data_ptr) { int ret; - ret = i2c_read16__7bf(I2C_PORT_ALS, OPT3001_I2C_ADDR__7bf, + ret = i2c_read16(I2C_PORT_ALS, OPT3001_I2C_ADDR_FLAGS, reg, data_ptr); if (!ret) *data_ptr = ((*data_ptr << 8) & 0xFF00) | @@ -32,7 +32,7 @@ static int opt3001_i2c_read(const int reg, int *data_ptr) static int opt3001_i2c_write(const int reg, int data) { data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF); - return i2c_write16__7bf(I2C_PORT_ALS, OPT3001_I2C_ADDR__7bf, + return i2c_write16(I2C_PORT_ALS, OPT3001_I2C_ADDR_FLAGS, reg, data); } @@ -110,13 +110,13 @@ struct i2c_stress_test_dev opt3001_i2c_stress_test_dev = { /** * Read register from OPT3001 light sensor. */ -static int opt3001_i2c_read__7bf(const int port, - const uint16_t i2c_addr__7bf, +static int opt3001_i2c_read(const int port, + const uint16_t i2c_addr_flags, const int reg, int *data_ptr) { int ret; - ret = i2c_read16__7bf(port, i2c_addr__7bf, + ret = i2c_read16(port, i2c_addr_flags, reg, data_ptr); if (!ret) *data_ptr = ((*data_ptr << 8) & 0xFF00) | @@ -128,13 +128,12 @@ static int opt3001_i2c_read__7bf(const int port, /** * Write register to OPT3001 light sensor. */ -static int opt3001_i2c_write__7bf(const int port, - const uint16_t i2c_addr__7bf, +static int opt3001_i2c_write(const int port, + const uint16_t i2c_addr_flags, const int reg, int data) { data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF); - return i2c_write16__7bf(port, i2c_addr__7bf, - reg, data); + return i2c_write16(port, i2c_addr_flags, reg, data); } /** @@ -146,7 +145,7 @@ int opt3001_read_lux(const struct motion_sensor_t *s, intv3_t v) int ret; int data; - ret = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf, + ret = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags, OPT3001_REG_RESULT, &data); if (ret) return ret; @@ -218,12 +217,12 @@ static int opt3001_set_data_rate(const struct motion_sensor_t *s, if (rate > 1000) rate = 1000; } - rv = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf, + rv = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags, OPT3001_REG_CONFIGURE, ®); if (rv) return rv; - rv = opt3001_i2c_write__7bf(s->port, s->i2c_spi_addr__7bf, + rv = opt3001_i2c_write(s->port, s->i2c_spi_addr_flags, OPT3001_REG_CONFIGURE, (reg & OPT3001_MODE_MASK) | (mode << OPT3001_MODE_OFFSET)); @@ -271,14 +270,14 @@ static int opt3001_init(const struct motion_sensor_t *s) int data; int ret; - ret = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf, + ret = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags, OPT3001_REG_MAN_ID, &data); if (ret) return ret; if (data != OPT3001_MANUFACTURER_ID) return EC_ERROR_ACCESS_DENIED; - ret = opt3001_i2c_read__7bf(s->port, s->i2c_spi_addr__7bf, + ret = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags, OPT3001_REG_DEV_ID, &data); if (ret) return ret; @@ -290,7 +289,7 @@ static int opt3001_init(const struct motion_sensor_t *s) * [11] : 1b Conversion time 800ms * [4] : 1b Latched window-style comparison operation */ - opt3001_i2c_write__7bf(s->port, s->i2c_spi_addr__7bf, + opt3001_i2c_write(s->port, s->i2c_spi_addr_flags, OPT3001_REG_CONFIGURE, 0xC810); opt3001_set_range(s, s->default_range, 0); @@ -316,8 +315,8 @@ struct i2c_stress_test_dev opt3001_i2c_stress_test_dev = { .read_val = OPT3001_DEVICE_ID, .write_reg = OPT3001_REG_INT_LIMIT_LSB, }, - .i2c_read__7bf = &opt3001_i2c_read__7bf, - .i2c_write__7bf = &opt3001_i2c_write__7bf, + .i2c_read = &opt3001_i2c_read, + .i2c_write = &opt3001_i2c_write, }; #endif /* CONFIG_CMD_I2C_STRESS_TEST_ALS */ #endif /* HAS_TASK_ALS */ |