sensor: adt7420: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert adt7420 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:
parent
01592071f1
commit
4f334970ad
6 changed files with 29 additions and 21 deletions
|
@ -216,14 +216,14 @@ static int adt7420_init(struct device *dev)
|
|||
static struct adt7420_data adt7420_driver;
|
||||
|
||||
static const struct adt7420_dev_config adt7420_config = {
|
||||
.i2c_port = DT_ADT7420_I2C_MASTER_DEV_NAME,
|
||||
.i2c_addr = DT_ADT7420_I2C_ADDR,
|
||||
.i2c_port = DT_ADI_ADT7420_0_BUS_NAME,
|
||||
.i2c_addr = DT_ADI_ADT7420_0_BASE_ADDRESS,
|
||||
#ifdef CONFIG_ADT7420_TRIGGER
|
||||
.gpio_port = DT_ADT7420_GPIO_DEV_NAME,
|
||||
.int_gpio = DT_ADT7420_GPIO_PIN_NUM,
|
||||
.gpio_port = DT_ADI_ADT7420_0_INT_GPIOS_CONTROLLER,
|
||||
.int_gpio = DT_ADI_ADT7420_0_INT_GPIOS_PIN,
|
||||
#endif
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(adt7420, DT_ADT7420_NAME, adt7420_init, &adt7420_driver,
|
||||
DEVICE_AND_API_INIT(adt7420, DT_ADI_ADT7420_0_LABEL, adt7420_init, &adt7420_driver,
|
||||
&adt7420_config, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY,
|
||||
&adt7420_driver_api);
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
#if defined(CONFIG_HAS_DTS_I2C)
|
||||
|
||||
#ifndef DT_ADT7420_NAME
|
||||
#define DT_ADT7420_NAME ""
|
||||
#define DT_ADT7420_I2C_ADDR 0
|
||||
#define DT_ADT7420_I2C_MASTER_DEV_NAME ""
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_HAS_DTS_I2C */
|
16
samples/sensor/adt7420/frdm_k64f.overlay
Normal file
16
samples/sensor/adt7420/frdm_k64f.overlay
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Linaro Limited
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
&i2c1 {
|
||||
status = "ok";
|
||||
clock-frequency = <I2C_BITRATE_STANDARD>;
|
||||
adt7420@13 {
|
||||
compatible = "adi,adt7420";
|
||||
reg = <0x13>;
|
||||
label = "ADT7420";
|
||||
int-gpios = <&gpioc 6 0>;
|
||||
};
|
||||
};
|
|
@ -4,4 +4,5 @@ tests:
|
|||
test:
|
||||
harness: sensor
|
||||
tags: sensors
|
||||
platform_whitelist: frdm_k64f
|
||||
depends_on: i2c
|
||||
|
|
|
@ -91,7 +91,7 @@ static void process(struct device *dev)
|
|||
|
||||
void main(void)
|
||||
{
|
||||
struct device *dev = device_get_binding(DT_ADT7420_NAME);
|
||||
struct device *dev = device_get_binding(DT_ADI_ADT7420_0_LABEL);
|
||||
|
||||
__ASSERT(dev != NULL, "Failed to get device binding");
|
||||
printf("device is %p, name is %s\n", dev, dev->config->name);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#if defined(CONFIG_HAS_DTS_I2C)
|
||||
|
||||
#ifndef DT_ADT7420_NAME
|
||||
#define DT_ADT7420_NAME ""
|
||||
#define DT_ADT7420_I2C_ADDR 0
|
||||
#define DT_ADT7420_I2C_MASTER_DEV_NAME ""
|
||||
#define DT_ADT7420_GPIO_DEV_NAME ""
|
||||
#define DT_ADT7420_GPIO_PIN_NUM 0
|
||||
#ifndef DT_ADI_ADT7420_0_LABEL
|
||||
#define DT_ADI_ADT7420_0_LABEL ""
|
||||
#define DT_ADI_ADT7420_0_BASE_ADDRESS 0
|
||||
#define DT_ADI_ADT7420_0_BUS_NAME ""
|
||||
#define DT_ADI_ADT7420_0_INT_GPIOS_CONTROLLER ""
|
||||
#define DT_ADI_ADT7420_0_INT_GPIOS_PIN 0
|
||||
#endif
|
||||
|
||||
#ifndef DT_ADXL362_DEV_NAME
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue