driver/sensor: lis2mdl: 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
4b5393c228
commit
7fa48d4d6e
8 changed files with 21 additions and 8 deletions
|
@ -81,7 +81,7 @@
|
|||
status = "disabled";
|
||||
reg = <0x1e>;
|
||||
label = "LSM303AGR-MAGN";
|
||||
irq-gpios = <&gpio0 27 0>; /* A3 */
|
||||
irq-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>; /* A3 */
|
||||
};
|
||||
|
||||
lsm303agr-accel@19 {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
compatible = "st,lis2mdl","st,lsm303agr-magn";
|
||||
reg = <0x1e>;
|
||||
label = "LSM303AGR-MAGN";
|
||||
irq-gpios = <&arduino_header 3 0>; /* A3 */
|
||||
irq-gpios = <&arduino_header 3 GPIO_ACTIVE_HIGH>; /* A3 */
|
||||
};
|
||||
|
||||
lsm303agr-accel@19 {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
lis2mdl@1e {
|
||||
compatible = "st,lis2mdl";
|
||||
reg = <0x1e>;
|
||||
irq-gpios = <&arduino_header 2 0>; /* A2 */
|
||||
irq-gpios = <&arduino_header 2 GPIO_ACTIVE_HIGH>; /* A2 */
|
||||
label = "LIS2MDL";
|
||||
};
|
||||
|
||||
|
|
|
@ -259,6 +259,7 @@ static const struct lis2mdl_config lis2mdl_dev_config = {
|
|||
#ifdef CONFIG_LIS2MDL_TRIGGER
|
||||
.gpio_name = DT_INST_0_ST_LIS2MDL_IRQ_GPIOS_CONTROLLER,
|
||||
.gpio_pin = DT_INST_0_ST_LIS2MDL_IRQ_GPIOS_PIN,
|
||||
.gpio_flags = DT_INST_0_ST_LIS2MDL_IRQ_GPIOS_FLAGS,
|
||||
#endif /* CONFIG_LIS2MDL_TRIGGER */
|
||||
#if defined(DT_ST_LIS2MDL_BUS_SPI)
|
||||
.bus_init = lis2mdl_spi_init,
|
||||
|
|
|
@ -33,6 +33,7 @@ struct lis2mdl_config {
|
|||
#ifdef CONFIG_LIS2MDL_TRIGGER
|
||||
char *gpio_name;
|
||||
u32_t gpio_pin;
|
||||
u8_t gpio_flags;
|
||||
#endif /* CONFIG_LIS2MDL_TRIGGER */
|
||||
#ifdef DT_ST_LIS2MDL_BUS_I2C
|
||||
u16_t i2c_slv_addr;
|
||||
|
|
|
@ -62,7 +62,8 @@ static void lis2mdl_handle_interrupt(void *arg)
|
|||
lis2mdl->handler_drdy(dev, &drdy_trigger);
|
||||
}
|
||||
|
||||
gpio_pin_enable_callback(lis2mdl->gpio, config->gpio_pin);
|
||||
gpio_pin_interrupt_configure(lis2mdl->gpio, config->gpio_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
||||
static void lis2mdl_gpio_callback(struct device *dev,
|
||||
|
@ -74,7 +75,7 @@ static void lis2mdl_gpio_callback(struct device *dev,
|
|||
|
||||
ARG_UNUSED(pins);
|
||||
|
||||
gpio_pin_disable_callback(dev, config->gpio_pin);
|
||||
gpio_pin_interrupt_configure(dev, config->gpio_pin, GPIO_INT_DISABLE);
|
||||
|
||||
#if defined(CONFIG_LIS2MDL_TRIGGER_OWN_THREAD)
|
||||
k_sem_give(&lis2mdl->gpio_sem);
|
||||
|
@ -134,8 +135,7 @@ int lis2mdl_init_interrupt(struct device *dev)
|
|||
#endif
|
||||
|
||||
gpio_pin_configure(lis2mdl->gpio, config->gpio_pin,
|
||||
GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE |
|
||||
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
|
||||
GPIO_INPUT | config->gpio_flags);
|
||||
|
||||
gpio_init_callback(&lis2mdl->gpio_cb,
|
||||
lis2mdl_gpio_callback,
|
||||
|
@ -146,5 +146,6 @@ int lis2mdl_init_interrupt(struct device *dev)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
return gpio_pin_enable_callback(lis2mdl->gpio, config->gpio_pin);
|
||||
return gpio_pin_interrupt_configure(lis2mdl->gpio, config->gpio_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
}
|
||||
|
|
|
@ -12,3 +12,8 @@ properties:
|
|||
irq-gpios:
|
||||
type: phandle-array
|
||||
required: false
|
||||
description: IRQ 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.
|
||||
|
|
|
@ -12,3 +12,8 @@ properties:
|
|||
irq-gpios:
|
||||
type: phandle-array
|
||||
required: false
|
||||
description: IRQ 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue