drivers: sensor: use unified kernel API

Change-Id: I5d51e65105f9dee3d5eb49c60b9e5636ebd14df6
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
This commit is contained in:
Baohong Liu 2016-11-30 15:14:07 -08:00 committed by Anas Nashif
commit 313700e26f
11 changed files with 16 additions and 16 deletions

View file

@ -37,7 +37,7 @@ static int ak8975_sample_fetch(struct device *dev, enum sensor_channel chan)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(AK8975_MEASURE_TIME_US); k_busy_wait(AK8975_MEASURE_TIME_US);
if (i2c_burst_read(drv_data->i2c, CONFIG_AK8975_I2C_ADDR, if (i2c_burst_read(drv_data->i2c, CONFIG_AK8975_I2C_ADDR,
AK8975_REG_DATA_START, buf, 6) < 0) { AK8975_REG_DATA_START, buf, 6) < 0) {

View file

@ -69,7 +69,7 @@ static int bmc150_magn_set_power_mode(struct device *dev,
!state) < 0) { !state) < 0) {
return -EIO; return -EIO;
} }
sys_thread_busy_wait(5 * USEC_PER_MSEC); k_busy_wait(5 * USEC_PER_MSEC);
return 0; return 0;
case BMC150_MAGN_POWER_MODE_SLEEP: case BMC150_MAGN_POWER_MODE_SLEEP:

View file

@ -317,7 +317,7 @@ int bmg160_init(struct device *dev)
/* reset the chip */ /* reset the chip */
bmg160_write_byte(dev, BMG160_REG_BGW_SOFTRESET, BMG160_RESET); bmg160_write_byte(dev, BMG160_REG_BGW_SOFTRESET, BMG160_RESET);
sys_thread_busy_wait(1000); /* wait for the chip to come up */ k_busy_wait(1000); /* wait for the chip to come up */
if (bmg160_write_byte(dev, BMG160_REG_RANGE, if (bmg160_write_byte(dev, BMG160_REG_RANGE,
BMG160_DEFAULT_RANGE) < 0) { BMG160_DEFAULT_RANGE) < 0) {

View file

@ -153,7 +153,7 @@ static int bmi160_pmu_set(struct device *dev, union bmi160_pmu_status *pmu_sts)
* Cannot use a nano timer here since this is called from the * Cannot use a nano timer here since this is called from the
* init function and the timeouts were not initialized yet. * init function and the timeouts were not initialized yet.
*/ */
sys_thread_busy_wait(cmds[i].delay_us); k_busy_wait(cmds[i].delay_us);
/* make sure the PMU_STATUS was set, though */ /* make sure the PMU_STATUS was set, though */
do { do {
@ -318,7 +318,7 @@ static int bmi160_do_calibration(struct device *dev, uint8_t foc_conf)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(250000); /* calibration takes a maximum of 250ms */ k_busy_wait(250000); /* calibration takes a maximum of 250ms */
return 0; return 0;
} }
@ -851,7 +851,7 @@ int bmi160_init(struct device *dev)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(1000); k_busy_wait(1000);
/* do a dummy read from 0x7F to activate SPI */ /* do a dummy read from 0x7F to activate SPI */
if (bmi160_byte_read(dev, 0x7F, &val) < 0) { if (bmi160_byte_read(dev, 0x7F, &val) < 0) {
@ -859,7 +859,7 @@ int bmi160_init(struct device *dev)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(100); k_busy_wait(100);
if (bmi160_byte_read(dev, BMI160_REG_CHIPID, &val) < 0) { if (bmi160_byte_read(dev, BMI160_REG_CHIPID, &val) < 0) {
SYS_LOG_DBG("Failed to read chip id."); SYS_LOG_DBG("Failed to read chip id.");

View file

@ -73,7 +73,7 @@ static int dht_sample_fetch(struct device *dev, enum sensor_channel chan)
/* send start signal */ /* send start signal */
gpio_pin_write(drv_data->gpio, CONFIG_DHT_GPIO_PIN_NUM, 0); gpio_pin_write(drv_data->gpio, CONFIG_DHT_GPIO_PIN_NUM, 0);
sys_thread_busy_wait(DHT_START_SIGNAL_DURATION); k_busy_wait(DHT_START_SIGNAL_DURATION);
gpio_pin_write(drv_data->gpio, CONFIG_DHT_GPIO_PIN_NUM, 1); gpio_pin_write(drv_data->gpio, CONFIG_DHT_GPIO_PIN_NUM, 1);

View file

@ -254,7 +254,7 @@ static int fxos8700_init(struct device *dev)
/* The sensor requires us to wait 1 ms after a software reset before /* The sensor requires us to wait 1 ms after a software reset before
* attempting further communications. * attempting further communications.
*/ */
sys_thread_busy_wait(USEC_PER_MSEC); k_busy_wait(USEC_PER_MSEC);
/* Set the mode (accel-only, mag-only, or hybrid) */ /* Set the mode (accel-only, mag-only, or hybrid) */
if (i2c_reg_update_byte(data->i2c, config->i2c_address, if (i2c_reg_update_byte(data->i2c, config->i2c_address,

View file

@ -323,7 +323,7 @@ static int hp206c_init(struct device *dev)
k_timer_init(&hp206c->tmr, NULL, NULL); k_timer_init(&hp206c->tmr, NULL, NULL);
#endif #endif
sys_thread_busy_wait(500); k_busy_wait(500);
if (hp206c_osr_set(dev, HP206C_DEFAULT_OSR) < 0) { if (hp206c_osr_set(dev, HP206C_DEFAULT_OSR) < 0) {
SYS_LOG_ERR("OSR value is not supported."); SYS_LOG_ERR("OSR value is not supported.");

View file

@ -118,14 +118,14 @@ static int lps25hb_init_chip(struct device *dev)
uint8_t chip_id; uint8_t chip_id;
lps25hb_power_ctrl(dev, 0); lps25hb_power_ctrl(dev, 0);
sys_thread_busy_wait(50 * USEC_PER_MSEC); k_busy_wait(50 * USEC_PER_MSEC);
if (lps25hb_power_ctrl(dev, 1) < 0) { if (lps25hb_power_ctrl(dev, 1) < 0) {
SYS_LOG_DBG("failed to power on device"); SYS_LOG_DBG("failed to power on device");
return -EIO; return -EIO;
} }
sys_thread_busy_wait(20 * USEC_PER_MSEC); k_busy_wait(20 * USEC_PER_MSEC);
if (i2c_reg_read_byte(data->i2c_master, config->i2c_slave_addr, if (i2c_reg_read_byte(data->i2c_master, config->i2c_slave_addr,
LPS25HB_REG_WHO_AM_I, &chip_id) < 0) { LPS25HB_REG_WHO_AM_I, &chip_id) < 0) {

View file

@ -39,7 +39,7 @@ static inline int lsm6ds0_reboot(struct device *dev)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(50 * USEC_PER_MSEC); k_busy_wait(50 * USEC_PER_MSEC);
return 0; return 0;
} }

View file

@ -42,7 +42,7 @@ static inline int lsm9ds0_mfd_reboot_memory(struct device *dev)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(50 * USEC_PER_MSEC); k_busy_wait(50 * USEC_PER_MSEC);
return 0; return 0;
} }

View file

@ -175,7 +175,7 @@ static int sht3xd_init(struct device *dev)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(SHT3XD_CLEAR_STATUS_WAIT_USEC); k_busy_wait(SHT3XD_CLEAR_STATUS_WAIT_USEC);
/* set periodic measurement mode */ /* set periodic measurement mode */
if (sht3xd_write_command(drv_data, if (sht3xd_write_command(drv_data,
@ -185,7 +185,7 @@ static int sht3xd_init(struct device *dev)
return -EIO; return -EIO;
} }
sys_thread_busy_wait(sht3xd_measure_wait[SHT3XD_REPEATABILITY_IDX]); k_busy_wait(sht3xd_measure_wait[SHT3XD_REPEATABILITY_IDX]);
#ifdef CONFIG_SHT3XD_TRIGGER #ifdef CONFIG_SHT3XD_TRIGGER
if (sht3xd_init_interrupt(dev) < 0) { if (sht3xd_init_interrupt(dev) < 0) {