sensor: bmi160: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert bmi160 sensor driver to use new defines so we can remove the
dts_fixup.h code for it.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
diff --git a/boards/arc/arduino_101_sss/dts_fixup.h b/boards/arc/arduino_101_sss/dts_fixup.h
deleted file mode 100644
index 8f8a69e..0000000
--- a/boards/arc/arduino_101_sss/dts_fixup.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2018 Linaro Limited
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#define DT_BMI160_SLAVE DT_SNPS_DESIGNWARE_SPI_80010100_BOSCH_BMI160_1_BASE_ADDRESS
-#define DT_BMI160_SPI_PORT_NAME DT_SNPS_DESIGNWARE_SPI_80010100_BOSCH_BMI160_1_BUS_NAME
-#define DT_BMI160_GPIO_DEV_NAME DT_SNPS_DESIGNWARE_SPI_80010100_BOSCH_BMI160_1_INT_GPIOS_CONTROLLER
-#define DT_BMI160_GPIO_PIN_NUM DT_SNPS_DESIGNWARE_SPI_80010100_BOSCH_BMI160_1_INT_GPIOS_PIN
-#define DT_BMI160_NAME DT_SNPS_DESIGNWARE_SPI_80010100_BOSCH_BMI160_1_LABEL
-#define DT_BMI160_SPI_BUS_FREQ DT_SNPS_DESIGNWARE_SPI_80010100_BOSCH_BMI160_1_SPI_MAX_FREQUENCY
-
diff --git a/drivers/sensor/bmi160/bmi160.c b/drivers/sensor/bmi160/bmi160.c
index a7971d6..91ccf41 100644
--- a/drivers/sensor/bmi160/bmi160.c
+++ b/drivers/sensor/bmi160/bmi160.c
@@ -796,16 +796,16 @@
u8_t val = 0U;
s32_t acc_range, gyr_range;
- bmi160->spi = device_get_binding(DT_BMI160_SPI_PORT_NAME);
+ bmi160->spi = device_get_binding(DT_BOSCH_BMI160_0_BUS_NAME);
if (!bmi160->spi) {
LOG_DBG("SPI master controller not found: %s.",
- DT_BMI160_SPI_PORT_NAME);
+ DT_BOSCH_BMI160_0_BUS_NAME);
return -EINVAL;
}
bmi160->spi_cfg.operation = SPI_WORD_SET(8);
- bmi160->spi_cfg.frequency = DT_BMI160_SPI_BUS_FREQ;
- bmi160->spi_cfg.slave = DT_BMI160_SLAVE;
+ bmi160->spi_cfg.frequency = DT_BOSCH_BMI160_0_SPI_MAX_FREQUENCY;
+ bmi160->spi_cfg.slave = DT_BOSCH_BMI160_0_BASE_ADDRESS;
/* reboot the chip */
if (bmi160_byte_write(dev, BMI160_REG_CMD, BMI160_CMD_SOFT_RESET) < 0) {
@@ -900,13 +900,13 @@
const struct bmi160_device_config bmi160_config = {
#if defined(CONFIG_BMI160_TRIGGER)
- .gpio_port = DT_BMI160_GPIO_DEV_NAME,
- .int_pin = DT_BMI160_GPIO_PIN_NUM,
+ .gpio_port = DT_BOSCH_BMI160_0_INT_GPIOS_CONTROLLER,
+ .int_pin = DT_BOSCH_BMI160_0_INT_GPIOS_PIN,
#endif
};
-DEVICE_AND_API_INIT(bmi160, DT_BMI160_NAME, bmi160_init, &bmi160_data,
+DEVICE_AND_API_INIT(bmi160, DT_BOSCH_BMI160_0_LABEL, bmi160_init, &bmi160_data,
&bmi160_config, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY,
&bmi160_api);
diff --git a/samples/sensor/bmi160/src/bmi160.c b/samples/sensor/bmi160/src/bmi160.c
index 1650436..4f13421 100644
--- a/samples/sensor/bmi160/src/bmi160.c
+++ b/samples/sensor/bmi160/src/bmi160.c
@@ -417,7 +417,7 @@
#endif
printk("IMU: Binding...\n");
- bmi160 = device_get_binding(DT_BMI160_NAME);
+ bmi160 = device_get_binding(DT_BOSCH_BMI160_0_LABEL);
if (!bmi160) {
printk("Gyro: Device not found.\n");
return;
diff --git a/tests/drivers/build_all/dts_fixup.h b/tests/drivers/build_all/dts_fixup.h
index 6d1af46..08bae0a 100644
--- a/tests/drivers/build_all/dts_fixup.h
+++ b/tests/drivers/build_all/dts_fixup.h
@@ -199,13 +199,13 @@
#define DT_ADXL372_SPI_BUS_FREQ 8000000
#endif
-#ifndef DT_BMI160_NAME
-#define DT_BMI160_NAME ""
-#define DT_BMI160_SLAVE 0
-#define DT_BMI160_SPI_PORT_NAME ""
-#define DT_BMI160_GPIO_DEV_NAME ""
-#define DT_BMI160_GPIO_PIN_NUM 0
-#define DT_BMI160_SPI_BUS_FREQ 6400000
+#ifndef DT_BOSCH_BMI160_0_LABEL
+#define DT_BOSCH_BMI160_0_LABEL ""
+#define DT_BOSCH_BMI160_0_BASE_ADDRESS 0
+#define DT_BOSCH_BMI160_0_BUS_NAME ""
+#define DT_BOSCH_BMI160_0_INT_GPIOS_CONTROLLER ""
+#define DT_BOSCH_BMI160_0_INT_GPIOS_PIN 0
+#define DT_BOSCH_BMI160_0_SPI_MAX_FREQUENCY 6400000
#endif
#ifndef DT_LIS2DH_DEV_NAME