Commit 6af0e8a9 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Jonathan Cameron

iio: imu: st_lsm6dsx: add support to LSM6DSOX

Add support to STM LSM6DSOX 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dsox.pdfSigned-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 753a9870
...@@ -9,7 +9,7 @@ config IIO_ST_LSM6DSX ...@@ -9,7 +9,7 @@ config IIO_ST_LSM6DSX
help help
Say yes here to build support for STMicroelectronics LSM6DSx imu Say yes here to build support for STMicroelectronics LSM6DSx imu
sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm, sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
ism330dlc, lsm6dso, asm330lhh ism330dlc, lsm6dso, lsm6dsox, asm330lhh
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called st_lsm6dsx. will be called st_lsm6dsx.
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define ST_ISM330DLC_DEV_NAME "ism330dlc" #define ST_ISM330DLC_DEV_NAME "ism330dlc"
#define ST_LSM6DSO_DEV_NAME "lsm6dso" #define ST_LSM6DSO_DEV_NAME "lsm6dso"
#define ST_ASM330LHH_DEV_NAME "asm330lhh" #define ST_ASM330LHH_DEV_NAME "asm330lhh"
#define ST_LSM6DSOX_DEV_NAME "lsm6dsox"
enum st_lsm6dsx_hw_id { enum st_lsm6dsx_hw_id {
ST_LSM6DS3_ID, ST_LSM6DS3_ID,
...@@ -30,6 +31,7 @@ enum st_lsm6dsx_hw_id { ...@@ -30,6 +31,7 @@ enum st_lsm6dsx_hw_id {
ST_ISM330DLC_ID, ST_ISM330DLC_ID,
ST_LSM6DSO_ID, ST_LSM6DSO_ID,
ST_ASM330LHH_ID, ST_ASM330LHH_ID,
ST_LSM6DSOX_ID,
ST_LSM6DSX_MAX_ID, ST_LSM6DSX_MAX_ID,
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* (e.g. Gx, Gy, Gz, Ax, Ay, Az), then data are repeated depending on the * (e.g. Gx, Gy, Gz, Ax, Ay, Az), then data are repeated depending on the
* value of the decimation factor and ODR set for each FIFO data set. * value of the decimation factor and ODR set for each FIFO data set.
* *
* LSM6DSO/ASM330LHH: The FIFO buffer can be configured to store data * LSM6DSO/LSM6DSOX/ASM330LHH: The FIFO buffer can be configured to store data
* from gyroscope and accelerometer. Each sample is queued with a tag (1B) * from gyroscope and accelerometer. Each sample is queued with a tag (1B)
* indicating data source (gyroscope, accelerometer, hw timer). * indicating data source (gyroscope, accelerometer, hw timer).
* *
...@@ -506,7 +506,7 @@ st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag, ...@@ -506,7 +506,7 @@ st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag,
} }
/** /**
* st_lsm6dsx_read_tagged_fifo() - LSM6DSO/ASM330LHH read FIFO routine * st_lsm6dsx_read_tagged_fifo() - LSM6DSO/LSM6DSOX/ASM330LHH read FIFO routine
* @hw: Pointer to instance of struct st_lsm6dsx_hw. * @hw: Pointer to instance of struct st_lsm6dsx_hw.
* *
* Read samples from the hw FIFO and push them to IIO buffers. * Read samples from the hw FIFO and push them to IIO buffers.
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000 * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
* - FIFO size: 4KB * - FIFO size: 4KB
* *
* - LSM6DSO/ASM330LHH * - LSM6DSO/LSM6DSOX/ASM330LHH
* - Accelerometer/Gyroscope supported ODR [Hz]: 13, 26, 52, 104, 208, 416 * - Accelerometer/Gyroscope supported ODR [Hz]: 13, 26, 52, 104, 208, 416
* - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16 * - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
* - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000 * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
...@@ -287,6 +287,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { ...@@ -287,6 +287,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
.max_fifo_size = 512, .max_fifo_size = 512,
.id = { .id = {
[0] = ST_LSM6DSO_ID, [0] = ST_LSM6DSO_ID,
[1] = ST_LSM6DSOX_ID,
}, },
.batch = { .batch = {
[ST_LSM6DSX_ID_ACC] = { [ST_LSM6DSX_ID_ACC] = {
......
...@@ -69,6 +69,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = { ...@@ -69,6 +69,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
.compatible = "st,asm330lhh", .compatible = "st,asm330lhh",
.data = (void *)ST_ASM330LHH_ID, .data = (void *)ST_ASM330LHH_ID,
}, },
{
.compatible = "st,lsm6dsox",
.data = (void *)ST_LSM6DSOX_ID,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match); MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
...@@ -81,6 +85,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = { ...@@ -81,6 +85,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
{ ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID }, { ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID },
{ ST_LSM6DSO_DEV_NAME, ST_LSM6DSO_ID }, { ST_LSM6DSO_DEV_NAME, ST_LSM6DSO_ID },
{ ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID }, { ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID },
{ ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID },
{}, {},
}; };
MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table); MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
......
...@@ -69,6 +69,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = { ...@@ -69,6 +69,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
.compatible = "st,asm330lhh", .compatible = "st,asm330lhh",
.data = (void *)ST_ASM330LHH_ID, .data = (void *)ST_ASM330LHH_ID,
}, },
{
.compatible = "st,lsm6dsox",
.data = (void *)ST_LSM6DSOX_ID,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match); MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
...@@ -81,6 +85,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = { ...@@ -81,6 +85,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
{ ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID }, { ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID },
{ ST_LSM6DSO_DEV_NAME, ST_LSM6DSO_ID }, { ST_LSM6DSO_DEV_NAME, ST_LSM6DSO_ID },
{ ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID }, { ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID },
{ ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID },
{}, {},
}; };
MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table); MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment