2023-08-11 09:40:09

by Linus Walleij

[permalink] [raw]
Subject: [PATCH 2/2] iio: imu: lsm6dsx: Add support for ism330dhc

The ISM330DHC sensor is used in the SpaceX Starlink ground
terminals.

Signed-off-by: Linus Walleij <[email protected]>
---
drivers/iio/imu/st_lsm6dsx/Kconfig | 8 ++++----
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 2 ++
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 6 +++++-
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c | 5 +++++
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c | 4 ++++
5 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/Kconfig b/drivers/iio/imu/st_lsm6dsx/Kconfig
index 5865a295a4df..fbb5da92f954 100644
--- a/drivers/iio/imu/st_lsm6dsx/Kconfig
+++ b/drivers/iio/imu/st_lsm6dsx/Kconfig
@@ -12,10 +12,10 @@ config IIO_ST_LSM6DSX
help
Say yes here to build support for STMicroelectronics LSM6DSx imu
sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
- ism330dlc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx, lsm6dsr,
- lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, lsm6dstx,
- lsm6dsv, lsm6dsv16x, lsm6dso16is, ism330is, asm330lhb, lsm6dst
- and the accelerometer/gyroscope of lsm9ds1.
+ ism330dlc, ism330dhc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx,
+ lsm6dsr, lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop,
+ lsm6dstx, lsm6dsv, lsm6dsv16x, lsm6dso16is, ism330is, asm330lhb,
+ lsm6dst and the accelerometer/gyroscope of lsm9ds1.

To compile this driver as a module, choose M here: the module
will be called st_lsm6dsx.
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
index 4d013889c287..b702ec768067 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
@@ -20,6 +20,7 @@
#define ST_LSM6DSL_DEV_NAME "lsm6dsl"
#define ST_LSM6DSM_DEV_NAME "lsm6dsm"
#define ST_ISM330DLC_DEV_NAME "ism330dlc"
+#define ST_ISM330DHC_DEV_NAME "ism330dhc"
#define ST_LSM6DSO_DEV_NAME "lsm6dso"
#define ST_ASM330LHH_DEV_NAME "asm330lhh"
#define ST_LSM6DSOX_DEV_NAME "lsm6dsox"
@@ -45,6 +46,7 @@ enum st_lsm6dsx_hw_id {
ST_LSM6DSL_ID,
ST_LSM6DSM_ID,
ST_ISM330DLC_ID,
+ ST_ISM330DHC_ID,
ST_LSM6DSO_ID,
ST_ASM330LHH_ID,
ST_LSM6DSOX_ID,
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index c743c4871ad6..e39651ac86fb 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -20,7 +20,7 @@
* - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
* - FIFO size: 8KB
*
- * - LSM6DS3H/LSM6DSL/LSM6DSM/ISM330DLC/LSM6DS3TR-C:
+ * - LSM6DS3H/LSM6DSL/LSM6DSM/ISM330DLC/ISM330DHC/LSM6DS3TR-C:
* - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416
* - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
* - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
@@ -809,6 +809,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
.hw_id = ST_LSM6DSRX_ID,
.name = ST_LSM6DSRX_DEV_NAME,
.wai = 0x6b,
+ }, {
+ .hw_id = ST_ISM330DHC_ID,
+ .name = ST_ISM330DHC_DEV_NAME,
+ .wai = 0x6b,
}, {
.hw_id = ST_LSM6DSO_ID,
.name = ST_LSM6DSO_DEV_NAME,
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
index 911444ec57c0..506a5a146bd5 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
@@ -62,6 +62,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
.compatible = "st,ism330dlc",
.data = (void *)ST_ISM330DLC_ID,
},
+ {
+ .compatible = "st,ism330dhc",
+ .data = (void *)ST_ISM330DHC_ID,
+ },
{
.compatible = "st,lsm6dso",
.data = (void *)ST_LSM6DSO_ID,
@@ -150,6 +154,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
{ ST_LSM6DSL_DEV_NAME, ST_LSM6DSL_ID },
{ ST_LSM6DSM_DEV_NAME, ST_LSM6DSM_ID },
{ ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID },
+ { ST_ISM330DHC_DEV_NAME, ST_ISM330DHC_ID },
{ ST_LSM6DSO_DEV_NAME, ST_LSM6DSO_ID },
{ ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID },
{ ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID },
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
index f56c170c41a9..5ebe59cdc35f 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
@@ -57,6 +57,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
.compatible = "st,ism330dlc",
.data = (void *)ST_ISM330DLC_ID,
},
+ {
+ .compatible = "st,ism330dhc",
+ .data = (void *)ST_ISM330DHC_ID,
+ },
{
.compatible = "st,lsm6dso",
.data = (void *)ST_LSM6DSO_ID,

--
2.34.1



2023-08-11 10:11:37

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [PATCH 2/2] iio: imu: lsm6dsx: Add support for ism330dhc

> The ISM330DHC sensor is used in the SpaceX Starlink ground
> terminals.
>
> Signed-off-by: Linus Walleij <[email protected]>
> ---
> drivers/iio/imu/st_lsm6dsx/Kconfig | 8 ++++----
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 2 ++
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 6 +++++-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c | 5 +++++
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c | 4 ++++
> 5 files changed, 20 insertions(+), 5 deletions(-)

Hi Linus,

on st website we have just ISM330DHCX and not ISM330DHC. Should we rename it in
ISM330DHCX?

>
> diff --git a/drivers/iio/imu/st_lsm6dsx/Kconfig b/drivers/iio/imu/st_lsm6dsx/Kconfig
> index 5865a295a4df..fbb5da92f954 100644
> --- a/drivers/iio/imu/st_lsm6dsx/Kconfig
> +++ b/drivers/iio/imu/st_lsm6dsx/Kconfig
> @@ -12,10 +12,10 @@ config IIO_ST_LSM6DSX
> help
> Say yes here to build support for STMicroelectronics LSM6DSx imu
> sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
> - ism330dlc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx, lsm6dsr,
> - lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, lsm6dstx,
> - lsm6dsv, lsm6dsv16x, lsm6dso16is, ism330is, asm330lhb, lsm6dst
> - and the accelerometer/gyroscope of lsm9ds1.
> + ism330dlc, ism330dhc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx,
> + lsm6dsr, lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop,
> + lsm6dstx, lsm6dsv, lsm6dsv16x, lsm6dso16is, ism330is, asm330lhb,
> + lsm6dst and the accelerometer/gyroscope of lsm9ds1.
>
> To compile this driver as a module, choose M here: the module
> will be called st_lsm6dsx.
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> index 4d013889c287..b702ec768067 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> @@ -20,6 +20,7 @@
> #define ST_LSM6DSL_DEV_NAME "lsm6dsl"
> #define ST_LSM6DSM_DEV_NAME "lsm6dsm"
> #define ST_ISM330DLC_DEV_NAME "ism330dlc"
> +#define ST_ISM330DHC_DEV_NAME "ism330dhc"
> #define ST_LSM6DSO_DEV_NAME "lsm6dso"
> #define ST_ASM330LHH_DEV_NAME "asm330lhh"
> #define ST_LSM6DSOX_DEV_NAME "lsm6dsox"
> @@ -45,6 +46,7 @@ enum st_lsm6dsx_hw_id {
> ST_LSM6DSL_ID,
> ST_LSM6DSM_ID,
> ST_ISM330DLC_ID,
> + ST_ISM330DHC_ID,
> ST_LSM6DSO_ID,
> ST_ASM330LHH_ID,
> ST_LSM6DSOX_ID,
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index c743c4871ad6..e39651ac86fb 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -20,7 +20,7 @@
> * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
> * - FIFO size: 8KB
> *
> - * - LSM6DS3H/LSM6DSL/LSM6DSM/ISM330DLC/LSM6DS3TR-C:
> + * - LSM6DS3H/LSM6DSL/LSM6DSM/ISM330DLC/ISM330DHC/LSM6DS3TR-C:
> * - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416
> * - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
> * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
> @@ -809,6 +809,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
> .hw_id = ST_LSM6DSRX_ID,
> .name = ST_LSM6DSRX_DEV_NAME,
> .wai = 0x6b,
> + }, {
> + .hw_id = ST_ISM330DHC_ID,
> + .name = ST_ISM330DHC_DEV_NAME,
> + .wai = 0x6b,
> }, {
> .hw_id = ST_LSM6DSO_ID,
> .name = ST_LSM6DSO_DEV_NAME,
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
> index 911444ec57c0..506a5a146bd5 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
> @@ -62,6 +62,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
> .compatible = "st,ism330dlc",
> .data = (void *)ST_ISM330DLC_ID,
> },
> + {
> + .compatible = "st,ism330dhc",
> + .data = (void *)ST_ISM330DHC_ID,
> + },
> {
> .compatible = "st,lsm6dso",
> .data = (void *)ST_LSM6DSO_ID,
> @@ -150,6 +154,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
> { ST_LSM6DSL_DEV_NAME, ST_LSM6DSL_ID },
> { ST_LSM6DSM_DEV_NAME, ST_LSM6DSM_ID },
> { ST_ISM330DLC_DEV_NAME, ST_ISM330DLC_ID },
> + { ST_ISM330DHC_DEV_NAME, ST_ISM330DHC_ID },
> { ST_LSM6DSO_DEV_NAME, ST_LSM6DSO_ID },
> { ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID },
> { ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID },
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
> index f56c170c41a9..5ebe59cdc35f 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
> @@ -57,6 +57,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
> .compatible = "st,ism330dlc",
> .data = (void *)ST_ISM330DLC_ID,
> },
> + {
> + .compatible = "st,ism330dhc",
> + .data = (void *)ST_ISM330DHC_ID,
> + },
> {
> .compatible = "st,lsm6dso",
> .data = (void *)ST_LSM6DSO_ID,

here we are missing st_lsm6dsx_spi_id_table[] configuration.

Regards,
Lorenzo

>
> --
> 2.34.1
>


Attachments:
(No filename) (5.14 kB)
signature.asc (235.00 B)
Download all attachments