sensors: lsm303dlhc: Convert to new DT_<COMPAT>_<INSTANCE> defines

Convert lsm303dlhc_accel & lsm303dlhc_magn 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>
This commit is contained in:
Kumar Gala 2019-01-16 12:36:39 -06:00 committed by Anas Nashif
parent 4118b8843f
commit efd31af624
5 changed files with 18 additions and 31 deletions

View file

@ -1,13 +0,0 @@
/* This file is a temporary workaround for mapping of the generated information
* to the current driver definitions. This will be removed when the drivers
* are modified to handle the generated information, or the mapping of
* generated data matches the driver definitions.
*/
#define DT_LSM303DLHC_ACCEL_NAME DT_ST_STM32_I2C_V2_40005400_ST_LSM303DLHC_ACCEL_19_LABEL
#define DT_LSM303DLHC_ACCEL_I2C_ADDR DT_ST_STM32_I2C_V2_40005400_ST_LSM303DLHC_ACCEL_19_BASE_ADDRESS
#define DT_LSM303DLHC_ACCEL_I2C_MASTER_DEV DT_ST_STM32_I2C_V2_40005400_ST_LSM303DLHC_ACCEL_19_BUS_NAME
#define DT_LSM303DLHC_MAGN_NAME DT_ST_STM32_I2C_V2_40005400_ST_LSM303DLHC_MAGN_1E_LABEL
#define DT_LSM303DLHC_MAGN_I2C_ADDR DT_ST_STM32_I2C_V2_40005400_ST_LSM303DLHC_MAGN_1E_BASE_ADDRESS
#define DT_LSM303DLHC_MAGN_I2C_MASTER_DEV DT_ST_STM32_I2C_V2_40005400_ST_LSM303DLHC_MAGN_1E_BUS_NAME

View file

@ -183,13 +183,13 @@ static int lsm303dlhc_accel_init(struct device *dev)
}
static const struct lsm303dlhc_accel_config lsm303dlhc_accel_config = {
.i2c_name = DT_LSM303DLHC_ACCEL_I2C_MASTER_DEV,
.i2c_address = DT_LSM303DLHC_ACCEL_I2C_ADDR,
.i2c_name = DT_ST_LSM303DLHC_ACCEL_0_BUS_NAME,
.i2c_address = DT_ST_LSM303DLHC_ACCEL_0_BASE_ADDRESS,
};
static struct lsm303dlhc_accel_data lsm303dlhc_accel_driver;
DEVICE_AND_API_INIT(lsm303dlhc_accel, DT_LSM303DLHC_ACCEL_NAME,
DEVICE_AND_API_INIT(lsm303dlhc_accel, DT_ST_LSM303DLHC_ACCEL_0_LABEL,
lsm303dlhc_accel_init, &lsm303dlhc_accel_driver,
&lsm303dlhc_accel_config, POST_KERNEL,
CONFIG_SENSOR_INIT_PRIORITY, &lsm303dlhc_accel_driver_api);

View file

@ -132,13 +132,13 @@ static int lsm303dlhc_magn_init(struct device *dev)
}
static const struct lsm303dlhc_magn_config lsm303dlhc_magn_config = {
.i2c_name = DT_LSM303DLHC_MAGN_I2C_MASTER_DEV,
.i2c_address = DT_LSM303DLHC_MAGN_I2C_ADDR,
.i2c_name = DT_ST_LSM303DLHC_MAGN_0_BUS_NAME,
.i2c_address = DT_ST_LSM303DLHC_MAGN_0_BASE_ADDRESS,
};
static struct lsm303dlhc_magn_data lsm303dlhc_magn_driver;
DEVICE_AND_API_INIT(lsm303dlhc_magn, DT_LSM303DLHC_MAGN_NAME,
DEVICE_AND_API_INIT(lsm303dlhc_magn, DT_ST_LSM303DLHC_MAGN_0_LABEL,
lsm303dlhc_magn_init, &lsm303dlhc_magn_driver,
&lsm303dlhc_magn_config, POST_KERNEL,
CONFIG_SENSOR_INIT_PRIORITY, &lsm303dlhc_magn_driver_api);

View file

@ -38,19 +38,19 @@ end:
void main(void)
{
struct device *accelerometer = device_get_binding(
DT_LSM303DLHC_ACCEL_NAME);
DT_ST_LSM303DLHC_ACCEL_0_LABEL);
struct device *magnetometer = device_get_binding(
DT_LSM303DLHC_MAGN_NAME);
DT_ST_LSM303DLHC_MAGN_0_LABEL);
if (accelerometer == NULL) {
printf("Could not get %s device\n",
DT_LSM303DLHC_ACCEL_NAME);
DT_ST_LSM303DLHC_ACCEL_0_LABEL);
return;
}
if (magnetometer == NULL) {
printf("Could not get %s device\n",
DT_LSM303DLHC_MAGN_NAME);
DT_ST_LSM303DLHC_MAGN_0_LABEL);
return;
}

View file

@ -124,16 +124,16 @@
#define DT_VL53L0X_I2C_MASTER_DEV_NAME ""
#endif
#ifndef DT_LSM303DLHC_ACCEL_NAME
#define DT_LSM303DLHC_ACCEL_NAME ""
#define DT_LSM303DLHC_ACCEL_I2C_MASTER_DEV ""
#define DT_LSM303DLHC_ACCEL_I2C_ADDR 0x19
#ifndef DT_ST_LSM303DLHC_ACCEL_0_LABEL
#define DT_ST_LSM303DLHC_ACCEL_0_LABEL ""
#define DT_ST_LSM303DLHC_ACCEL_0_BUS_NAME ""
#define DT_ST_LSM303DLHC_ACCEL_0_BASE_ADDRESS 0x19
#endif
#ifndef DT_LSM303DLHC_MAGN_NAME
#define DT_LSM303DLHC_MAGN_NAME ""
#define DT_LSM303DLHC_MAGN_I2C_MASTER_DEV ""
#define DT_LSM303DLHC_MAGN_I2C_ADDR 0x1e
#ifndef DT_ST_LSM303DLHC_MAGN_0_LABEL
#define DT_ST_LSM303DLHC_MAGN_0_LABEL ""
#define DT_ST_LSM303DLHC_MAGN_0_BUS_NAME ""
#define DT_ST_LSM303DLHC_MAGN_0_BASE_ADDRESS 0x1e
#endif
#ifndef DT_LIS2DH_DEV_NAME