iio: imu: st_lsm6dsx: add support to ism330dlc
Add support to STM ISM330DLC 6-axis (acc + gyro) Mems sensor http://www.st.com/resource/en/datasheet/ism330dlc.pdf Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
be75eb86ac
commit
179c8d608c
@ -8,7 +8,8 @@ config IIO_ST_LSM6DSX
|
|||||||
select IIO_ST_LSM6DSX_SPI if (SPI_MASTER)
|
select IIO_ST_LSM6DSX_SPI if (SPI_MASTER)
|
||||||
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
|
||||||
|
|
||||||
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.
|
||||||
|
@ -18,12 +18,14 @@
|
|||||||
#define ST_LSM6DS3H_DEV_NAME "lsm6ds3h"
|
#define ST_LSM6DS3H_DEV_NAME "lsm6ds3h"
|
||||||
#define ST_LSM6DSL_DEV_NAME "lsm6dsl"
|
#define ST_LSM6DSL_DEV_NAME "lsm6dsl"
|
||||||
#define ST_LSM6DSM_DEV_NAME "lsm6dsm"
|
#define ST_LSM6DSM_DEV_NAME "lsm6dsm"
|
||||||
|
#define ST_ISM330DLC_DEV_NAME "ism330dlc"
|
||||||
|
|
||||||
enum st_lsm6dsx_hw_id {
|
enum st_lsm6dsx_hw_id {
|
||||||
ST_LSM6DS3_ID,
|
ST_LSM6DS3_ID,
|
||||||
ST_LSM6DS3H_ID,
|
ST_LSM6DS3H_ID,
|
||||||
ST_LSM6DSL_ID,
|
ST_LSM6DSL_ID,
|
||||||
ST_LSM6DSM_ID,
|
ST_LSM6DSM_ID,
|
||||||
|
ST_ISM330DLC_ID,
|
||||||
ST_LSM6DSX_MAX_ID,
|
ST_LSM6DSX_MAX_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* STMicroelectronics st_lsm6dsx FIFO buffer library driver
|
* STMicroelectronics st_lsm6dsx FIFO buffer library driver
|
||||||
*
|
*
|
||||||
* LSM6DS3/LSM6DS3H/LSM6DSL/LSM6DSM: The FIFO buffer can be configured
|
* LSM6DS3/LSM6DS3H/LSM6DSL/LSM6DSM/ISM330DLC: The FIFO buffer can be
|
||||||
* to store data from gyroscope and accelerometer. Samples are queued
|
* configured to store data from gyroscope and accelerometer. Samples are
|
||||||
* without any tag according to a specific pattern based on 'FIFO data sets'
|
* queued without any tag according to a specific pattern based on
|
||||||
* (6 bytes each):
|
* 'FIFO data sets' (6 bytes each):
|
||||||
* - 1st data set is reserved for gyroscope data
|
* - 1st data set is reserved for gyroscope data
|
||||||
* - 2nd data set is reserved for accelerometer data
|
* - 2nd data set is reserved for accelerometer data
|
||||||
* The FIFO pattern changes depending on the ODRs and decimation factors
|
* The FIFO pattern changes depending on the ODRs and decimation factors
|
||||||
@ -276,7 +276,7 @@ static inline int st_lsm6dsx_read_block(struct st_lsm6dsx_hw *hw, u8 *data,
|
|||||||
#define ST_LSM6DSX_IIO_BUFF_SIZE (ALIGN(ST_LSM6DSX_SAMPLE_SIZE, \
|
#define ST_LSM6DSX_IIO_BUFF_SIZE (ALIGN(ST_LSM6DSX_SAMPLE_SIZE, \
|
||||||
sizeof(s64)) + sizeof(s64))
|
sizeof(s64)) + sizeof(s64))
|
||||||
/**
|
/**
|
||||||
* st_lsm6dsx_read_fifo() - LSM6DS3-LSM6DS3H-LSM6DSL-LSM6DSM read FIFO routine
|
* st_lsm6dsx_read_fifo() - hw FIFO read 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.
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
|
* - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
|
||||||
* - FIFO size: 8KB
|
* - FIFO size: 8KB
|
||||||
*
|
*
|
||||||
* - LSM6DS3H/LSM6DSL/LSM6DSM:
|
* - LSM6DS3H/LSM6DSL/LSM6DSM/ISM330DLC:
|
||||||
* - 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
|
||||||
@ -252,6 +252,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
|
|||||||
.id = {
|
.id = {
|
||||||
[0] = ST_LSM6DSL_ID,
|
[0] = ST_LSM6DSL_ID,
|
||||||
[1] = ST_LSM6DSM_ID,
|
[1] = ST_LSM6DSM_ID,
|
||||||
|
[2] = ST_ISM330DLC_ID,
|
||||||
},
|
},
|
||||||
.decimator = {
|
.decimator = {
|
||||||
[ST_LSM6DSX_ID_ACC] = {
|
[ST_LSM6DSX_ID_ACC] = {
|
||||||
|
@ -57,6 +57,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
|
|||||||
.compatible = "st,lsm6dsm",
|
.compatible = "st,lsm6dsm",
|
||||||
.data = (void *)ST_LSM6DSM_ID,
|
.data = (void *)ST_LSM6DSM_ID,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.compatible = "st,ism330dlc",
|
||||||
|
.data = (void *)ST_ISM330DLC_ID,
|
||||||
|
},
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
|
MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
|
||||||
@ -66,6 +70,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
|
|||||||
{ ST_LSM6DS3H_DEV_NAME, ST_LSM6DS3H_ID },
|
{ ST_LSM6DS3H_DEV_NAME, ST_LSM6DS3H_ID },
|
||||||
{ ST_LSM6DSL_DEV_NAME, ST_LSM6DSL_ID },
|
{ ST_LSM6DSL_DEV_NAME, ST_LSM6DSL_ID },
|
||||||
{ ST_LSM6DSM_DEV_NAME, ST_LSM6DSM_ID },
|
{ ST_LSM6DSM_DEV_NAME, ST_LSM6DSM_ID },
|
||||||
|
{ ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID },
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
|
MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
|
||||||
|
@ -57,6 +57,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
|
|||||||
.compatible = "st,lsm6dsm",
|
.compatible = "st,lsm6dsm",
|
||||||
.data = (void *)ST_LSM6DSM_ID,
|
.data = (void *)ST_LSM6DSM_ID,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.compatible = "st,ism330dlc",
|
||||||
|
.data = (void *)ST_ISM330DLC_ID,
|
||||||
|
},
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
|
MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
|
||||||
@ -66,6 +70,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
|
|||||||
{ ST_LSM6DS3H_DEV_NAME, ST_LSM6DS3H_ID },
|
{ ST_LSM6DS3H_DEV_NAME, ST_LSM6DS3H_ID },
|
||||||
{ ST_LSM6DSL_DEV_NAME, ST_LSM6DSL_ID },
|
{ ST_LSM6DSL_DEV_NAME, ST_LSM6DSL_ID },
|
||||||
{ ST_LSM6DSM_DEV_NAME, ST_LSM6DSM_ID },
|
{ ST_LSM6DSM_DEV_NAME, ST_LSM6DSM_ID },
|
||||||
|
{ ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID },
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
|
MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user