From 28fe21716cdacac0ecc025407b727eaf5a99b720 Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Fri, 16 Oct 2020 16:03:58 -0700 Subject: driver: bmi: remove unnecessary msleep() 1ms sleep after every write is not necessary. The only place it is is at init time and it is taken care of. Remove unused function. Remove sleep when ODR changes, it causes EC to stall. BUG=b:170155773 BRANCH=hatch, zork TEST=On volteer check hardware.SensorRing passes continuously. Change-Id: I5fd06c9cd6a79ee6cc7f92c448e18fb71a906184 Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2483357 Reviewed-by: Ching-Kang Yen --- driver/accelgyro_bmi_common.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) (limited to 'driver/accelgyro_bmi_common.c') diff --git a/driver/accelgyro_bmi_common.c b/driver/accelgyro_bmi_common.c index 2d8cfa2c45..30093258f9 100644 --- a/driver/accelgyro_bmi_common.c +++ b/driver/accelgyro_bmi_common.c @@ -198,13 +198,6 @@ int bmi_write8(const int port, const uint16_t i2c_spi_addr_flags, reg, data); #endif } - /* - * From Bosch: BMI needs a delay of 450us after each write if it - * is in suspend mode, otherwise the operation may be ignored by - * the sensor. Given we are only doing write during init, add - * the delay unconditionally. - */ - msleep(1); return rv; } @@ -230,34 +223,6 @@ int bmi_read16(const int port, const uint16_t i2c_spi_addr_flags, return rv; } -/** - * Write 16bit register from accelerometer. - */ -int bmi_write16(const int port, const uint16_t i2c_spi_addr_flags, - const int reg, int data) -{ - int rv = -EC_ERROR_PARAM1; - - if (SLAVE_IS_SPI(i2c_spi_addr_flags)) { -#ifdef CONFIG_SPI_ACCEL_PORT - CPRINTS("%s() spi part is not implemented", __func__); -#endif - } else { -#ifdef I2C_PORT_ACCEL - rv = i2c_write16(port, i2c_spi_addr_flags, - reg, data); -#endif - } - /* - * From Bosch: BMI needs a delay of 450us after each write if it - * is in suspend mode, otherwise the operation may be ignored by - * the sensor. Given we are only doing write during init, add - * the delay unconditionally. - */ - msleep(1); - return rv; -} - /** * Read 32bit register from accelerometer. */ @@ -320,13 +285,6 @@ int bmi_write_n(const int port, const uint16_t i2c_spi_addr_flags, reg, data_ptr, len); #endif } - /* - * From Bosch: BMI needs a delay of 450us after each write if it - * is in suspend mode, otherwise the operation may be ignored by - * the sensor. Given we are only doing write during init, add - * the delay unconditionally. - */ - msleep(1); return rv; } /* -- cgit v1.2.1