summaryrefslogtreecommitdiff
path: root/driver/accelgyro_lsm6dsm.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-07-16 15:10:11 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-20 23:09:18 +0000
commit473bd883b60fd5b00377766dae2bacad246de0d2 (patch)
tree992d9f03104277934c22c869eceb634e2cf5f7ec /driver/accelgyro_lsm6dsm.c
parent053491b560d2c4e374bb739373d8ae25c41f6315 (diff)
downloadchrome-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/accelgyro_lsm6dsm.c')
-rw-r--r--driver/accelgyro_lsm6dsm.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/driver/accelgyro_lsm6dsm.c b/driver/accelgyro_lsm6dsm.c
index aa60013f33..e2bba975d6 100644
--- a/driver/accelgyro_lsm6dsm.c
+++ b/driver/accelgyro_lsm6dsm.c
@@ -106,14 +106,14 @@ static int config_interrupt(const struct motion_sensor_t *accel)
int ret = EC_SUCCESS;
int int1_ctrl_val;
- ret = st_raw_read8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ ret = st_raw_read8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_INT1_CTRL, &int1_ctrl_val);
if (ret != EC_SUCCESS)
return ret;
#ifdef CONFIG_ACCEL_FIFO
/* As soon as one sample is ready, trigger an interrupt. */
- ret = st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ ret = st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL1_ADDR,
OUT_XYZ_SIZE / sizeof(uint16_t));
if (ret != EC_SUCCESS)
@@ -122,7 +122,7 @@ static int config_interrupt(const struct motion_sensor_t *accel)
LSM6DSM_INT_FIFO_FULL;
#endif /* CONFIG_ACCEL_FIFO */
- return st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ return st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_INT1_CTRL, int1_ctrl_val);
}
@@ -135,7 +135,7 @@ static int config_interrupt(const struct motion_sensor_t *accel)
*/
static int fifo_disable(const struct motion_sensor_t *accel)
{
- return st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ return st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL5_ADDR, 0x00);
}
@@ -195,7 +195,7 @@ static int fifo_enable(const struct motion_sensor_t *accel)
/* FIFO ODR must be set before the decimation factors */
odr_reg_val = LSM6DSM_ODR_TO_REG(max_odr) <<
LSM6DSM_FIFO_CTRL5_ODR_OFF;
- err = st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ err = st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL5_ADDR, odr_reg_val);
/* Scan all sensors configuration to calculate FIFO decimator. */
@@ -213,12 +213,12 @@ static int fifo_enable(const struct motion_sensor_t *accel)
private->config.samples_in_pattern[i] = 0;
}
}
- st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL3_ADDR,
(decimators[FIFO_DEV_GYRO] << LSM6DSM_FIFO_DEC_G_OFF) |
(decimators[FIFO_DEV_ACCEL] << LSM6DSM_FIFO_DEC_XL_OFF));
#ifdef CONFIG_LSM6DSM_SEC_I2C
- st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL4_ADDR,
decimators[FIFO_DEV_MAG]);
@@ -255,7 +255,7 @@ static int fifo_enable(const struct motion_sensor_t *accel)
* After ODR and decimation values are set, continuous mode can be
* enabled
*/
- err = st_raw_write8__7bf(accel->port, accel->i2c_spi_addr__7bf,
+ err = st_raw_write8(accel->port, accel->i2c_spi_addr_flags,
LSM6DSM_FIFO_CTRL5_ADDR,
odr_reg_val | LSM6DSM_FIFO_MODE_CONTINUOUS_VAL);
if (err != EC_SUCCESS)
@@ -396,7 +396,7 @@ static int load_fifo(struct motion_sensor_t *s, const struct fstatus *fsts,
length = left;
/* Read data and copy in buffer. */
- err = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ err = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSM_FIFO_DATA_ADDR,
fifo, length);
*last_fifo_read_ts = __hw_clock_source_read();
@@ -427,7 +427,7 @@ static int is_fifo_empty(struct motion_sensor_t *s, struct fstatus *fsts)
if (s->flags & MOTIONSENSE_FLAG_INT_SIGNAL)
return gpio_get_level(s->int_signal);
CPRINTS("Interrupt signal not set for %s", s->name);
- res = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ res = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSM_FIFO_STS1_ADDR,
(int8_t *)fsts, sizeof(*fsts));
/* If we failed to read the FIFO size assume empty. */
@@ -475,7 +475,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event)
last_interrupt_timestamp;
/* Read how many data pattern on FIFO to read and pattern. */
- ret = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
LSM6DSM_FIFO_STS1_ADDR,
(uint8_t *)&fsts, sizeof(fsts));
if (ret != EC_SUCCESS)
@@ -655,7 +655,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready)
{
int ret, tmp;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_STATUS_REG, &tmp);
if (ret != EC_SUCCESS) {
CPRINTS("%s type:0x%X RS Error", s->name, s->type);
@@ -699,7 +699,7 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
xyz_reg = get_xyz_reg(s->type);
/* Read data bytes starting at xyz_reg. */
- ret = st_raw_read_n_noinc__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read_n_noinc(s->port, s->i2c_spi_addr_flags,
xyz_reg, raw, OUT_XYZ_SIZE);
if (ret != EC_SUCCESS)
return ret;
@@ -715,7 +715,7 @@ static int init(const struct motion_sensor_t *s)
struct stprivate_data *data = s->drv_data;
uint8_t ctrl_reg, reg_val = 0;
- ret = st_raw_read8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_read8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_WHO_AM_I_REG, &tmp);
if (ret != EC_SUCCESS)
return EC_ERROR_UNKNOWN;
@@ -741,19 +741,19 @@ static int init(const struct motion_sensor_t *s)
ctrl_reg = LSM6DSM_ODR_REG(MOTIONSENSE_TYPE_ACCEL);
/* Power OFF gyro. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL2_ADDR, 0);
if (ret != EC_SUCCESS)
goto err_unlock;
/* Power ON Accel. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, reg_val);
if (ret != EC_SUCCESS)
goto err_unlock;
/* Software reset. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL3_ADDR, LSM6DSM_SW_RESET);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -767,12 +767,12 @@ static int init(const struct motion_sensor_t *s)
*/
/* Power ON Accel. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, reg_val);
if (ret != EC_SUCCESS)
goto err_unlock;
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
LSM6DSM_CTRL3_ADDR, LSM6DSM_BOOT);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -784,7 +784,7 @@ static int init(const struct motion_sensor_t *s)
msleep(15);
/* Power OFF Accel. */
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
ctrl_reg, 0);
if (ret != EC_SUCCESS)
goto err_unlock;
@@ -794,11 +794,11 @@ static int init(const struct motion_sensor_t *s)
* Output data not updated until have been read.
* Prefer interrupt to be active low.
*/
- ret = st_raw_write8__7bf(s->port, s->i2c_spi_addr__7bf,
- LSM6DSM_CTRL3_ADDR,
- LSM6DSM_BDU
- | LSM6DSM_H_L_ACTIVE
- | LSM6DSM_IF_INC);
+ ret = st_raw_write8(s->port, s->i2c_spi_addr_flags,
+ LSM6DSM_CTRL3_ADDR,
+ LSM6DSM_BDU
+ | LSM6DSM_H_L_ACTIVE
+ | LSM6DSM_IF_INC);
if (ret != EC_SUCCESS)
goto err_unlock;