drivers: sensor: fxos8700: convert to new DT API
Use the new devicetree.h API instead of the legacy macros. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
8f84520130
commit
8d2f22f9ea
1 changed files with 15 additions and 13 deletions
|
@ -5,6 +5,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT nxp_fxos8700
|
||||
|
||||
#include "fxos8700.h"
|
||||
#include <sys/util.h>
|
||||
#include <sys/__assert.h>
|
||||
|
@ -521,12 +523,12 @@ static const struct sensor_driver_api fxos8700_driver_api = {
|
|||
};
|
||||
|
||||
static const struct fxos8700_config fxos8700_config = {
|
||||
.i2c_name = DT_INST_0_NXP_FXOS8700_BUS_NAME,
|
||||
.i2c_address = DT_INST_0_NXP_FXOS8700_BASE_ADDRESS,
|
||||
#ifdef DT_INST_0_NXP_FXOS8700_RESET_GPIOS_CONTROLLER
|
||||
.reset_name = DT_INST_0_NXP_FXOS8700_RESET_GPIOS_CONTROLLER,
|
||||
.reset_pin = DT_INST_0_NXP_FXOS8700_RESET_GPIOS_PIN,
|
||||
.reset_flags = DT_INST_0_NXP_FXOS8700_RESET_GPIOS_FLAGS,
|
||||
.i2c_name = DT_INST_BUS_LABEL(0),
|
||||
.i2c_address = DT_INST_REG_ADDR(0),
|
||||
#if DT_INST_NODE_HAS_PROP(0, reset_gpios)
|
||||
.reset_name = DT_INST_GPIO_LABEL(0, reset_gpios),
|
||||
.reset_pin = DT_INST_GPIO_PIN(0, reset_gpios),
|
||||
.reset_flags = DT_INST_GPIO_FLAGS(0, reset_gpios),
|
||||
#else
|
||||
.reset_name = NULL,
|
||||
.reset_pin = 0,
|
||||
|
@ -566,13 +568,13 @@ static const struct fxos8700_config fxos8700_config = {
|
|||
#endif
|
||||
#ifdef CONFIG_FXOS8700_TRIGGER
|
||||
#ifdef CONFIG_FXOS8700_DRDY_INT1
|
||||
.gpio_name = DT_INST_0_NXP_FXOS8700_INT1_GPIOS_CONTROLLER,
|
||||
.gpio_pin = DT_INST_0_NXP_FXOS8700_INT1_GPIOS_PIN,
|
||||
.gpio_flags = DT_INST_0_NXP_FXOS8700_INT1_GPIOS_FLAGS,
|
||||
.gpio_name = DT_INST_GPIO_LABEL(0, int1_gpios),
|
||||
.gpio_pin = DT_INST_GPIO_PIN(0, int1_gpios),
|
||||
.gpio_flags = DT_INST_GPIO_FLAGS(0, int1_gpios),
|
||||
#else
|
||||
.gpio_name = DT_INST_0_NXP_FXOS8700_INT2_GPIOS_CONTROLLER,
|
||||
.gpio_pin = DT_INST_0_NXP_FXOS8700_INT2_GPIOS_PIN,
|
||||
.gpio_flags = DT_INST_0_NXP_FXOS8700_INT2_GPIOS_FLAGS,
|
||||
.gpio_name = DT_INST_GPIO_LABEL(0, int2_gpios),
|
||||
.gpio_pin = DT_INST_GPIO_PIN(0, int2_gpios),
|
||||
.gpio_flags = DT_INST_GPIO_FLAGS(0, int2_gpios),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_FXOS8700_PULSE
|
||||
|
@ -588,7 +590,7 @@ static const struct fxos8700_config fxos8700_config = {
|
|||
|
||||
static struct fxos8700_data fxos8700_data;
|
||||
|
||||
DEVICE_AND_API_INIT(fxos8700, DT_INST_0_NXP_FXOS8700_LABEL, fxos8700_init,
|
||||
DEVICE_AND_API_INIT(fxos8700, DT_INST_LABEL(0), fxos8700_init,
|
||||
&fxos8700_data, &fxos8700_config,
|
||||
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY,
|
||||
&fxos8700_driver_api);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue