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>
diff --git a/drivers/sensor/lis2dw12/Kconfig b/drivers/sensor/lis2dw12/Kconfig
index 3b1b77d..58d6330 100644
--- a/drivers/sensor/lis2dw12/Kconfig
+++ b/drivers/sensor/lis2dw12/Kconfig
@@ -52,20 +52,6 @@
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
diff --git a/drivers/sensor/lis2dw12/lis2dw12.c b/drivers/sensor/lis2dw12/lis2dw12.c
index e4f506a..84f264e 100644
--- a/drivers/sensor/lis2dw12/lis2dw12.c
+++ b/drivers/sensor/lis2dw12/lis2dw12.c
@@ -381,11 +381,7 @@
.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)
diff --git a/drivers/sensor/lis2dw12/lis2dw12_trigger.c b/drivers/sensor/lis2dw12/lis2dw12_trigger.c
index 81537d2..d8e238c 100644
--- a/drivers/sensor/lis2dw12/lis2dw12_trigger.c
+++ b/drivers/sensor/lis2dw12/lis2dw12_trigger.c
@@ -244,6 +244,7 @@
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);
diff --git a/dts/bindings/sensor/st,lis2dw12-common.yaml b/dts/bindings/sensor/st,lis2dw12-common.yaml
index 5f3fd93..a79fa43 100644
--- a/dts/bindings/sensor/st,lis2dw12-common.yaml
+++ b/dts/bindings/sensor/st,lis2dw12-common.yaml
@@ -11,3 +11,21 @@
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.
diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py
index ff82fbb..eb71db9 100755
--- a/scripts/ci/check_compliance.py
+++ b/scripts/ci/check_compliance.py
@@ -539,7 +539,6 @@
"FOO_LOG_LEVEL",
"FOO_SETTING_1",
"FOO_SETTING_2",
- "LIS2DW12_INT_PIN",
"LSM6DSO_INT_PIN",
"MISSING",
"MODULES",