All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] add support for LSM6DSO16IS
@ 2022-11-16 13:40 Lorenzo Bianconi
  2022-11-16 13:40 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add support to LSM6DSO16IS Lorenzo Bianconi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-11-16 13:40 UTC (permalink / raw)
  To: jic23
  Cc: mario.tesi, linux-iio, devicetree, lorenzo.bianconi, robh+dt,
	krzysztof.kozlowski+dt

Add support for LSM6DSO16IS IMU mems sensor
https://www.st.com/resource/en/datasheet/lsm6dso16is.pdf

This series is based on the commit below:

commit 1adcc208048826635bcdabb03d0f40744fea512e
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Mon Nov 14 10:25:34 2022 +0100

    iio: imu: st_lsm6dsx: fix LSM6DSV sensor description

Lorenzo Bianconi (2):
  iio: imu: st_lsm6dsx: add support to LSM6DSO16IS
  dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is

 .../bindings/iio/imu/st,lsm6dsx.yaml          |   1 +
 drivers/iio/imu/st_lsm6dsx/Kconfig            |   4 +-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h       |   2 +
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  | 128 +++++++++++++++++-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c   |   5 +
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c   |   5 +
 6 files changed, 142 insertions(+), 3 deletions(-)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] iio: imu: st_lsm6dsx: add support to LSM6DSO16IS
  2022-11-16 13:40 [PATCH 0/2] add support for LSM6DSO16IS Lorenzo Bianconi
@ 2022-11-16 13:40 ` Lorenzo Bianconi
  2022-11-16 13:40 ` [PATCH 2/2] dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is Lorenzo Bianconi
  2022-11-23 20:51 ` [PATCH 0/2] add support for LSM6DSO16IS Jonathan Cameron
  2 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-11-16 13:40 UTC (permalink / raw)
  To: jic23
  Cc: mario.tesi, linux-iio, devicetree, lorenzo.bianconi, robh+dt,
	krzysztof.kozlowski+dt

Add support to STM LSM6DSO16IS (accelerometer and gyroscope) Mems sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lsm6dso16is.pdf
Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/iio/imu/st_lsm6dsx/Kconfig           |   4 +-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h      |   2 +
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 128 ++++++++++++++++++-
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c  |   5 +
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c  |   5 +
 5 files changed, 141 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/Kconfig b/drivers/iio/imu/st_lsm6dsx/Kconfig
index 37d02e0fc227..0096035728cd 100644
--- a/drivers/iio/imu/st_lsm6dsx/Kconfig
+++ b/drivers/iio/imu/st_lsm6dsx/Kconfig
@@ -13,8 +13,8 @@ config IIO_ST_LSM6DSX
 	  sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm,
 	  ism330dlc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx, lsm6dsr,
 	  lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, lsm6dstx,
-	  lsm6dsv, lsm6dsv16x, the accelerometer/gyroscope of lsm9ds1
-	  and lsm6dst.
+	  lsm6dsv, lsm6dsv16x, lsm6dso16is, the accelerometer/gyroscope
+	  of lsm9ds1 and lsm6dst.
 
 	  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 683cfadcf62e..abf14a2ce0e9 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
@@ -35,6 +35,7 @@
 #define ST_LSM6DSTX_DEV_NAME	"lsm6dstx"
 #define ST_LSM6DSV_DEV_NAME	"lsm6dsv"
 #define ST_LSM6DSV16X_DEV_NAME	"lsm6dsv16x"
+#define ST_LSM6DSO16IS_DEV_NAME	"lsm6dso16is"
 
 enum st_lsm6dsx_hw_id {
 	ST_LSM6DS3_ID,
@@ -57,6 +58,7 @@ enum st_lsm6dsx_hw_id {
 	ST_LSM6DSTX_ID,
 	ST_LSM6DSV_ID,
 	ST_LSM6DSV16X_ID,
+	ST_LSM6DSO16IS_ID,
 	ST_LSM6DSX_MAX_ID,
 };
 
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index b680682f9833..57a79bf35bba 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -27,7 +27,7 @@
  *   - FIFO size: 4KB
  *
  * - LSM6DSO/LSM6DSOX/ASM330LHH/ASM330LHHX/LSM6DSR/ISM330DHCX/LSM6DST/LSM6DSOP/
- *   LSM6DSTX:
+ *   LSM6DSTX/LSM6DSO16IS:
  *   - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416,
  *     833
  *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
@@ -1375,6 +1375,132 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
 			.wakeup_src_x_mask = BIT(2),
 		},
 	},
+	{
+		.reset = {
+			.addr = 0x12,
+			.mask = BIT(0),
+		},
+		.boot = {
+			.addr = 0x12,
+			.mask = BIT(7),
+		},
+		.bdu = {
+			.addr = 0x12,
+			.mask = BIT(6),
+		},
+		.id = {
+			{
+				.hw_id = ST_LSM6DSO16IS_ID,
+				.name = ST_LSM6DSO16IS_DEV_NAME,
+				.wai = 0x22,
+			},
+		},
+		.channels = {
+			[ST_LSM6DSX_ID_ACC] = {
+				.chan = st_lsm6dsx_acc_channels,
+				.len = ARRAY_SIZE(st_lsm6dsx_acc_channels),
+			},
+			[ST_LSM6DSX_ID_GYRO] = {
+				.chan = st_lsm6dsx_gyro_channels,
+				.len = ARRAY_SIZE(st_lsm6dsx_gyro_channels),
+			},
+		},
+		.odr_table = {
+			[ST_LSM6DSX_ID_ACC] = {
+				.reg = {
+					.addr = 0x10,
+					.mask = GENMASK(7, 4),
+				},
+				.odr_avl[0] = {  12500, 0x01 },
+				.odr_avl[1] = {  26000, 0x02 },
+				.odr_avl[2] = {  52000, 0x03 },
+				.odr_avl[3] = { 104000, 0x04 },
+				.odr_avl[4] = { 208000, 0x05 },
+				.odr_avl[5] = { 416000, 0x06 },
+				.odr_avl[6] = { 833000, 0x07 },
+				.odr_len = 7,
+			},
+			[ST_LSM6DSX_ID_GYRO] = {
+				.reg = {
+					.addr = 0x11,
+					.mask = GENMASK(7, 4),
+				},
+				.odr_avl[0] = {  12500, 0x01 },
+				.odr_avl[1] = {  26000, 0x02 },
+				.odr_avl[2] = {  52000, 0x03 },
+				.odr_avl[3] = { 104000, 0x04 },
+				.odr_avl[4] = { 208000, 0x05 },
+				.odr_avl[5] = { 416000, 0x06 },
+				.odr_avl[6] = { 833000, 0x07 },
+				.odr_len = 7,
+			},
+		},
+		.fs_table = {
+			[ST_LSM6DSX_ID_ACC] = {
+				.reg = {
+					.addr = 0x10,
+					.mask = GENMASK(3, 2),
+				},
+				.fs_avl[0] = {  IIO_G_TO_M_S_2(61000), 0x0 },
+				.fs_avl[1] = { IIO_G_TO_M_S_2(122000), 0x2 },
+				.fs_avl[2] = { IIO_G_TO_M_S_2(244000), 0x3 },
+				.fs_avl[3] = { IIO_G_TO_M_S_2(488000), 0x1 },
+				.fs_len = 4,
+			},
+			[ST_LSM6DSX_ID_GYRO] = {
+				.reg = {
+					.addr = 0x11,
+					.mask = GENMASK(3, 2),
+				},
+				.fs_avl[0] = {  IIO_DEGREE_TO_RAD(8750000), 0x0 },
+				.fs_avl[1] = { IIO_DEGREE_TO_RAD(17500000), 0x1 },
+				.fs_avl[2] = { IIO_DEGREE_TO_RAD(35000000), 0x2 },
+				.fs_avl[3] = { IIO_DEGREE_TO_RAD(70000000), 0x3 },
+				.fs_len = 4,
+			},
+		},
+		.irq_config = {
+			.hla = {
+				.addr = 0x12,
+				.mask = BIT(5),
+			},
+			.od = {
+				.addr = 0x12,
+				.mask = BIT(4),
+			},
+		},
+		.shub_settings = {
+			.page_mux = {
+				.addr = 0x01,
+				.mask = BIT(6),
+			},
+			.master_en = {
+				.sec_page = true,
+				.addr = 0x14,
+				.mask = BIT(2),
+			},
+			.pullup_en = {
+				.sec_page = true,
+				.addr = 0x14,
+				.mask = BIT(3),
+			},
+			.aux_sens = {
+				.addr = 0x14,
+				.mask = GENMASK(1, 0),
+			},
+			.wr_once = {
+				.addr = 0x14,
+				.mask = BIT(6),
+			},
+			.num_ext_dev = 3,
+			.shub_out = {
+				.sec_page = true,
+				.addr = 0x02,
+			},
+			.slv0_addr = 0x15,
+			.dw_slv0_addr = 0x21,
+		},
+	},
 };
 
 int st_lsm6dsx_set_page(struct st_lsm6dsx_hw *hw, bool enable)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
index 0faf1b4c11af..d5929c6e4c5f 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
@@ -117,6 +117,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
 		.compatible = "st,lsm6dsv16x",
 		.data = (void *)ST_LSM6DSV16X_ID,
 	},
+	{
+		.compatible = "st,lsm6dso16is",
+		.data = (void *)ST_LSM6DSO16IS_ID,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
@@ -142,6 +146,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
 	{ ST_LSM6DSTX_DEV_NAME, ST_LSM6DSTX_ID },
 	{ ST_LSM6DSV_DEV_NAME, ST_LSM6DSV_ID },
 	{ ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID },
+	{ ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table);
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
index 57597aaa2a92..24d5e51a8662 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
@@ -117,6 +117,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
 		.compatible = "st,lsm6dsv16x",
 		.data = (void *)ST_LSM6DSV16X_ID,
 	},
+	{
+		.compatible = "st,lsm6dso16is",
+		.data = (void *)ST_LSM6DSO16IS_ID,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
@@ -142,6 +146,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
 	{ ST_LSM6DSTX_DEV_NAME, ST_LSM6DSTX_ID },
 	{ ST_LSM6DSV_DEV_NAME, ST_LSM6DSV_ID },
 	{ ST_LSM6DSV16X_DEV_NAME, ST_LSM6DSV16X_ID },
+	{ ST_LSM6DSO16IS_DEV_NAME, ST_LSM6DSO16IS_ID },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is
  2022-11-16 13:40 [PATCH 0/2] add support for LSM6DSO16IS Lorenzo Bianconi
  2022-11-16 13:40 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add support to LSM6DSO16IS Lorenzo Bianconi
@ 2022-11-16 13:40 ` Lorenzo Bianconi
  2022-11-17 16:54   ` Rob Herring
  2022-11-23 20:51 ` [PATCH 0/2] add support for LSM6DSO16IS Jonathan Cameron
  2 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-11-16 13:40 UTC (permalink / raw)
  To: jic23
  Cc: mario.tesi, linux-iio, devicetree, lorenzo.bianconi, robh+dt,
	krzysztof.kozlowski+dt

Add device bindings for lsm6dso16is IMU sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
index 5933270799f5..07d5aee7e442 100644
--- a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
@@ -33,6 +33,7 @@ properties:
           - st,lsm6dst
           - st,lsm6dsop
           - st,lsm6dsv
+          - st,lsm6dso16is
       - items:
           - const: st,asm330lhhx
           - const: st,lsm6dsr
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is
  2022-11-16 13:40 ` [PATCH 2/2] dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is Lorenzo Bianconi
@ 2022-11-17 16:54   ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2022-11-17 16:54 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: krzysztof.kozlowski+dt, devicetree, robh+dt, lorenzo.bianconi,
	jic23, mario.tesi, linux-iio


On Wed, 16 Nov 2022 14:40:04 +0100, Lorenzo Bianconi wrote:
> Add device bindings for lsm6dso16is IMU sensor.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] add support for LSM6DSO16IS
  2022-11-16 13:40 [PATCH 0/2] add support for LSM6DSO16IS Lorenzo Bianconi
  2022-11-16 13:40 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add support to LSM6DSO16IS Lorenzo Bianconi
  2022-11-16 13:40 ` [PATCH 2/2] dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is Lorenzo Bianconi
@ 2022-11-23 20:51 ` Jonathan Cameron
  2 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2022-11-23 20:51 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: mario.tesi, linux-iio, devicetree, lorenzo.bianconi, robh+dt,
	krzysztof.kozlowski+dt

On Wed, 16 Nov 2022 14:40:02 +0100
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> Add support for LSM6DSO16IS IMU mems sensor
> https://www.st.com/resource/en/datasheet/lsm6dso16is.pdf
> 
> This series is based on the commit below:
Applied to the togreg branch of iio.git. I might push it briefly
out as testing, but need to get this into linux-next asap given where
we are in cycle so might skip that bit.

Thanks,

Jonathan

> 
> commit 1adcc208048826635bcdabb03d0f40744fea512e
> Author: Lorenzo Bianconi <lorenzo@kernel.org>
> Date:   Mon Nov 14 10:25:34 2022 +0100
> 
>     iio: imu: st_lsm6dsx: fix LSM6DSV sensor description
> 
> Lorenzo Bianconi (2):
>   iio: imu: st_lsm6dsx: add support to LSM6DSO16IS
>   dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is
> 
>  .../bindings/iio/imu/st,lsm6dsx.yaml          |   1 +
>  drivers/iio/imu/st_lsm6dsx/Kconfig            |   4 +-
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h       |   2 +
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c  | 128 +++++++++++++++++-
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c   |   5 +
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c   |   5 +
>  6 files changed, 142 insertions(+), 3 deletions(-)
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-23 20:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16 13:40 [PATCH 0/2] add support for LSM6DSO16IS Lorenzo Bianconi
2022-11-16 13:40 ` [PATCH 1/2] iio: imu: st_lsm6dsx: add support to LSM6DSO16IS Lorenzo Bianconi
2022-11-16 13:40 ` [PATCH 2/2] dt-bindings: iio: imu: st_lsm6dsx: add lsm6dso16is Lorenzo Bianconi
2022-11-17 16:54   ` Rob Herring
2022-11-23 20:51 ` [PATCH 0/2] add support for LSM6DSO16IS Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.