driver/sensor: lis3mdl: update to use new GPIO API
Get rid of all the deprecated functions and definitions replacing them with the new ones. Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
parent
be8ca9da96
commit
b0ad7bb594
4 changed files with 21 additions and 10 deletions
|
@ -22,7 +22,7 @@
|
||||||
lis3mdl-magn@1e {
|
lis3mdl-magn@1e {
|
||||||
compatible = "st,lis3mdl-magn";
|
compatible = "st,lis3mdl-magn";
|
||||||
reg = <0x1e>;
|
reg = <0x1e>;
|
||||||
irq-gpios = <&arduino_header 4 0>; /* A4 */
|
irq-gpios = <&arduino_header 4 GPIO_ACTIVE_HIGH>; /* A4 */
|
||||||
label = "LIS3MDL";
|
label = "LIS3MDL";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,9 @@ int lis3mdl_trigger_set(struct device *dev,
|
||||||
|
|
||||||
drv_data->data_ready_trigger = *trig;
|
drv_data->data_ready_trigger = *trig;
|
||||||
|
|
||||||
gpio_pin_enable_callback(drv_data->gpio,
|
gpio_pin_interrupt_configure(drv_data->gpio,
|
||||||
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
|
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
|
||||||
|
GPIO_INT_EDGE_TO_ACTIVE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +48,9 @@ static void lis3mdl_gpio_callback(struct device *dev,
|
||||||
|
|
||||||
ARG_UNUSED(pins);
|
ARG_UNUSED(pins);
|
||||||
|
|
||||||
gpio_pin_disable_callback(dev, DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
|
gpio_pin_interrupt_configure(dev,
|
||||||
|
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
|
||||||
|
GPIO_INT_DISABLE);
|
||||||
|
|
||||||
#if defined(CONFIG_LIS3MDL_TRIGGER_OWN_THREAD)
|
#if defined(CONFIG_LIS3MDL_TRIGGER_OWN_THREAD)
|
||||||
k_sem_give(&drv_data->gpio_sem);
|
k_sem_give(&drv_data->gpio_sem);
|
||||||
|
@ -66,8 +69,9 @@ static void lis3mdl_thread_cb(void *arg)
|
||||||
&drv_data->data_ready_trigger);
|
&drv_data->data_ready_trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpio_pin_enable_callback(drv_data->gpio,
|
gpio_pin_interrupt_configure(drv_data->gpio,
|
||||||
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
|
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
|
||||||
|
GPIO_INT_EDGE_TO_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_LIS3MDL_TRIGGER_OWN_THREAD
|
#ifdef CONFIG_LIS3MDL_TRIGGER_OWN_THREAD
|
||||||
|
@ -110,8 +114,8 @@ int lis3mdl_init_interrupt(struct device *dev)
|
||||||
|
|
||||||
gpio_pin_configure(drv_data->gpio,
|
gpio_pin_configure(drv_data->gpio,
|
||||||
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
|
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
|
||||||
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
|
GPIO_INPUT |
|
||||||
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
|
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_FLAGS);
|
||||||
|
|
||||||
gpio_init_callback(&drv_data->gpio_cb,
|
gpio_init_callback(&drv_data->gpio_cb,
|
||||||
lis3mdl_gpio_callback,
|
lis3mdl_gpio_callback,
|
||||||
|
@ -148,8 +152,9 @@ int lis3mdl_init_interrupt(struct device *dev)
|
||||||
drv_data->dev = dev;
|
drv_data->dev = dev;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gpio_pin_enable_callback(drv_data->gpio,
|
gpio_pin_interrupt_configure(drv_data->gpio,
|
||||||
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN);
|
DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN,
|
||||||
|
GPIO_INT_EDGE_TO_ACTIVE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,3 +11,8 @@ properties:
|
||||||
irq-gpios:
|
irq-gpios:
|
||||||
required: false
|
required: false
|
||||||
type: phandle-array
|
type: phandle-array
|
||||||
|
description: DRDY pin
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
|
@ -125,6 +125,7 @@
|
||||||
#define DT_INST_0_ST_LIS3MDL_MAGN_BASE_ADDRESS 0x19
|
#define DT_INST_0_ST_LIS3MDL_MAGN_BASE_ADDRESS 0x19
|
||||||
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN 0
|
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_PIN 0
|
||||||
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_CONTROLLER ""
|
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_CONTROLLER ""
|
||||||
|
#define DT_INST_0_ST_LIS3MDL_MAGN_IRQ_GPIOS_FLAGS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DT_INST_0_ST_LPS25HB_PRESS_LABEL
|
#ifndef DT_INST_0_ST_LPS25HB_PRESS_LABEL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue