boards: stm32: argonkey: Add dts support to sensors

This patch adds dts support to lps22hb/hts221/vl53l0x
I2C sensors as well as lsm6dsl SPI sensor.

Since some info, like gpio for irq triggering or SPI bus
characteristics, may be provided through dts, they need
to be made optional in the LSM6DSL driver by usage of
macros like HAS_DTS_SPI_PINS or HAS_DTS_SPI_DEVICE.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
This commit is contained in:
Armando Visconti 2018-04-20 14:54:40 +02:00 committed by Maureen Helm
commit 17c15ff182
4 changed files with 68 additions and 1 deletions

View file

@ -53,6 +53,15 @@
&spi2 {
status = "ok";
/* ST Microelectronics LSM6DSL accel/gyro sensor */
lsm6dsl@1 {
compatible = "st,lsm6dsl-spi";
reg = <1>;
spi-max-frequency = <1000000>;
irq-gpios = <&gpiob 1 0>;
label = "LSM6DSL-SPI";
};
};
&i2c1 {
@ -63,6 +72,24 @@
&i2c2 {
status = "ok";
clock-frequency = <I2C_BITRATE_FAST>;
hts221@5f {
compatible = "st,hts221";
reg = <0x5f>;
label = "HTS221";
};
lps22hb-press@5d {
compatible = "st,lps22hb-press";
reg = <0x5d>;
label = "LPS22HB";
};
vl53l0x@29 {
compatible = "st,vl53l0x";
reg = <0x29>;
label = "VL53L0X";
};
};
&i2c3 {

View file

@ -7,3 +7,4 @@
config BOARD_96B_ARGONKEY
bool "96Boards Argonkey"
depends on SOC_STM32F412CG
select HAS_DTS_SPI_PINS

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2018 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*
* This file is a temporary workaround for mapping of the generated information
* to the current driver definitions. This will be removed when the drivers
* are modified to handle the generated information, or the mapping of
* generated data matches the driver definitions.
*/
#define CONFIG_HTS221_NAME ST_STM32_I2C_V1_40005800_ST_HTS221_5F_LABEL
#define CONFIG_HTS221_I2C_MASTER_DEV_NAME ST_STM32_I2C_V1_40005800_ST_HTS221_5F_BUS_NAME
#define CONFIG_LPS22HB_DEV_NAME ST_STM32_I2C_V1_40005800_ST_LPS22HB_PRESS_5D_LABEL
#define CONFIG_LPS22HB_I2C_ADDR ST_STM32_I2C_V1_40005800_ST_LPS22HB_PRESS_5D_BASE_ADDRESS
#define CONFIG_LPS22HB_I2C_MASTER_DEV_NAME ST_STM32_I2C_V1_40005800_ST_LPS22HB_PRESS_5D_BUS_NAME
#define CONFIG_VL53L0X_NAME ST_STM32_I2C_V1_40005800_ST_VL53L0X_29_LABEL
#define CONFIG_VL53L0X_I2C_ADDR ST_STM32_I2C_V1_40005800_ST_VL53L0X_29_BASE_ADDRESS
#define CONFIG_VL53L0X_I2C_MASTER_DEV_NAME ST_STM32_I2C_V1_40005800_ST_VL53L0X_29_BUS_NAME
#define CONFIG_LSM6DSL_SPI_SELECT_SLAVE ST_STM32_SPI_40003800_ST_LSM6DSL_SPI_1_BASE_ADDRESS
#define CONFIG_LSM6DSL_SPI_MASTER_DEV_NAME ST_STM32_SPI_40003800_ST_LSM6DSL_SPI_1_BUS_NAME
#define CONFIG_LSM6DSL_SPI_BUS_FREQ ST_STM32_SPI_40003800_ST_LSM6DSL_SPI_1_SPI_MAX_FREQUENCY
#define CONFIG_LSM6DSL_GPIO_DEV_NAME ST_STM32_SPI_40003800_ST_LSM6DSL_SPI_1_IRQ_GPIOS_CONTROLLER
#define CONFIG_LSM6DSL_GPIO_PIN_NUM ST_STM32_SPI_40003800_ST_LSM6DSL_SPI_1_IRQ_GPIOS_PIN

View file

@ -60,6 +60,8 @@ config LSM6DSL_I2C_MASTER_DEV_NAME
endif #HAS_DTS_I2C_DEVICE
if !HAS_DTS_SPI_DEVICE
config LSM6DSL_SPI_SELECT_SLAVE
hex "LSM6DSL SPI slave select pin"
depends on LSM6DSL && LSM6DSL_SPI
@ -83,6 +85,8 @@ config LSM6DSL_SPI_MASTER_DEV_NAME
Specify the device name of the spi master device to which LSM6DSL is
connected.
endif #HAS_DTS_SPI_DEVICE
config LSM6DSL_SPI_GPIO_CS
bool "LSM6DSL SPI CS through a GPIO pin"
default n
@ -91,6 +95,8 @@ config LSM6DSL_SPI_GPIO_CS
This option is useful if one needs to manage SPI CS through a GPIO
pin to by-pass the SPI controller's CS logic.
if !HAS_DTS_SPI_PINS
config LSM6DSL_SPI_GPIO_CS_DRV_NAME
string "GPIO driver's name to use to drive SPI CS through"
default ""
@ -107,7 +113,9 @@ config LSM6DSL_SPI_GPIO_CS_PIN
This option is mandatory to set which GPIO pin to use in order
to actually emulate the SPI CS.
choice
endif # !HAS_DTS_SPI_PINS
choice LSM6DSL_TRIGGER_MODE
prompt "Trigger mode"
depends on LSM6DSL
default LSM6DSL_TRIGGER_NONE
@ -136,6 +144,8 @@ config LSM6DSL_TRIGGER
bool
depends on LSM6DSL
if !HAS_DTS_SPI_PINS
config LSM6DSL_GPIO_DEV_NAME
string
prompt "GPIO device"
@ -152,6 +162,8 @@ config LSM6DSL_GPIO_PIN_NUM
The number of the GPIO on which the interrupt signal from the LSM6DSL
chip will be received.
endif #HAS_DTS_SPI_DEVICE
config LSM6DSL_THREAD_PRIORITY
int
prompt "Thread priority"