drivers/sensor: lis2dw12: move int-pin in DTS binding

Take the int-pin information (i.e. what pin between INT1
and INT2 the drdy is attached to) directly from DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2021-05-27 13:23:09 +02:00 committed by Anas Nashif
commit 351b28e122
5 changed files with 20 additions and 20 deletions

View file

@ -52,20 +52,6 @@ config LIS2DW12_THREAD_STACK_SIZE
help
Stack size of thread used by the driver to handle interrupts.
choice
prompt "Sensor INT pin number"
default LIS2DW12_INT_PIN_1
help
The number of LIS2DW12 int pin used to generate interrupt to cpu.
Supported values are int1 or int2
config LIS2DW12_INT_PIN_1
bool "int1"
config LIS2DW12_INT_PIN_2
bool "int2"
endchoice
menuconfig LIS2DW12_PULSE
bool "Pulse detection"
help

View file

@ -381,11 +381,7 @@ const struct lis2dw12_device_config lis2dw12_cfg = {
.int_gpio_port = DT_INST_GPIO_LABEL(0, irq_gpios),
.int_gpio_pin = DT_INST_GPIO_PIN(0, irq_gpios),
.int_gpio_flags = DT_INST_GPIO_FLAGS(0, irq_gpios),
#if defined(CONFIG_LIS2DW12_INT_PIN_1)
.int_pin = 1,
#elif defined(CONFIG_LIS2DW12_INT_PIN_2)
.int_pin = 2,
#endif /* CONFIG_LIS2DW12_INT_PIN */
.int_pin = DT_INST_PROP(0, int_pin),
#ifdef CONFIG_LIS2DW12_PULSE
#if defined(CONFIG_LIS2DW12_ONLY_SINGLE)

View file

@ -244,6 +244,7 @@ int lis2dw12_init_interrupt(const struct device *dev)
lis2dw12->dev = dev;
LOG_INF("%s: int-pin is on INT%d", dev->name, cfg->int_pin);
#if defined(CONFIG_LIS2DW12_TRIGGER_OWN_THREAD)
k_sem_init(&lis2dw12->gpio_sem, 0, K_SEM_MAX_LIMIT);

View file

@ -11,3 +11,21 @@ properties:
This pin defaults to active high when produced by the sensor.
The property value should ensure the flags properly describe
the signal that is presented to the driver.
int-pin:
type: int
required: false
default: 1
enum:
- 1
- 2
description: |
Select DRDY pin number (1 or 2).
1 # drdy is generated from INT1
2 # drdy is generated from INT2
This number represents which of the two interrupt pins
(INT1 or INT2) the drdy line is attached to. This property is not
mandatory and if not present it defaults to 1 which is the
configuration at power-up.

View file

@ -539,7 +539,6 @@ UNDEF_KCONFIG_WHITELIST = {
"FOO_LOG_LEVEL",
"FOO_SETTING_1",
"FOO_SETTING_2",
"LIS2DW12_INT_PIN",
"LSM6DSO_INT_PIN",
"MISSING",
"MODULES",