All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] add support for ASM330LHHX
@ 2022-04-04 19:24 Lorenzo Bianconi
  2022-04-04 19:24 ` [PATCH v2 1/2] iio: imu: st_lsm6dsx: add support to ASM330LHHX Lorenzo Bianconi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-04-04 19:24 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi, robh

Add support for ASM330LHHX IMU automotive mems sensor
https://www.st.com/resource/en/datasheet/asm330lhhx.pdf

Changes since v1:
- use lsm6dsr as fallback device for asm330lhhx

Lorenzo Bianconi (2):
  iio: imu: st_lsm6dsx: add support to ASM330LHHX
  dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings

 .../bindings/iio/imu/st,lsm6dsx.yaml          | 38 ++++++++++---------
 drivers/iio/imu/st_lsm6dsx/Kconfig            |  6 +--
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h       |  2 +
 .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c    |  3 +-
 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   |  5 +++
 7 files changed, 43 insertions(+), 22 deletions(-)

-- 
2.35.1


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

* [PATCH v2 1/2] iio: imu: st_lsm6dsx: add support to ASM330LHHX
  2022-04-04 19:24 [PATCH v2 0/2] add support for ASM330LHHX Lorenzo Bianconi
@ 2022-04-04 19:24 ` Lorenzo Bianconi
  2022-04-04 19:24 ` [PATCH v2 2/2] dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings Lorenzo Bianconi
  2022-04-10 17:01 ` [PATCH v2 0/2] add support for ASM330LHHX Jonathan Cameron
  2 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-04-04 19:24 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi, robh

Add support to STM ASM330LHHX (acc + gyro) automotive Mems sensor.
The ASM330LHHX sensor can use LSM6DSR as fallback device since it
implements all the ASM330LHHX features currently implemented in
st_lsm6dsx.

Datasheet: https://www.st.com/resource/en/datasheet/asm330lhhx.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/iio/imu/st_lsm6dsx/Kconfig             | 6 +++---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h        | 2 ++
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 ++-
 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    | 5 +++++
 6 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/Kconfig b/drivers/iio/imu/st_lsm6dsx/Kconfig
index 85860217aaf3..fefd0b939100 100644
--- a/drivers/iio/imu/st_lsm6dsx/Kconfig
+++ b/drivers/iio/imu/st_lsm6dsx/Kconfig
@@ -11,9 +11,9 @@ 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, lsm6dsr, lsm6ds3tr-c,
-	  ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop, the accelerometer/gyroscope
-	  of lsm9ds1 and lsm6dst.
+	  ism330dlc, lsm6dso, lsm6dsox, asm330lhh, asm330lhhx, lsm6dsr,
+	  lsm6ds3tr-c, ism330dhcx, lsm6dsrx, lsm6ds0, lsm6dsop,
+	  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 6ac4eac36458..a86dd29a4738 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
@@ -31,6 +31,7 @@
 #define ST_LSM6DSRX_DEV_NAME	"lsm6dsrx"
 #define ST_LSM6DST_DEV_NAME	"lsm6dst"
 #define ST_LSM6DSOP_DEV_NAME	"lsm6dsop"
+#define ST_ASM330LHHX_DEV_NAME	"asm330lhhx"
 
 enum st_lsm6dsx_hw_id {
 	ST_LSM6DS3_ID,
@@ -49,6 +50,7 @@ enum st_lsm6dsx_hw_id {
 	ST_LSM6DSRX_ID,
 	ST_LSM6DST_ID,
 	ST_LSM6DSOP_ID,
+	ST_ASM330LHHX_ID,
 	ST_LSM6DSX_MAX_ID,
 };
 
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index 16730a780964..38bb5f645ebd 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -14,7 +14,8 @@
  * (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.
  *
- * LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/LSM6DSRX/ISM330DHCX/LSM6DST/LSM6DSOP:
+ * LSM6DSO/LSM6DSOX/ASM330LHH/ASM330LHHX/LSM6DSR/LSM6DSRX/ISM330DHCX/
+ * LSM6DST/LSM6DSOP:
  * The FIFO buffer can be configured to store data from gyroscope and
  * accelerometer. Each sample is queued with a tag (1B) indicating data
  * source (gyroscope, accelerometer, hw timer).
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index b1d8d5a66f01..910397716833 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -26,7 +26,7 @@
  *   - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000
  *   - FIFO size: 4KB
  *
- * - LSM6DSO/LSM6DSOX/ASM330LHH/LSM6DSR/ISM330DHCX/LSM6DST/LSM6DSOP:
+ * - LSM6DSO/LSM6DSOX/ASM330LHH/ASM330LHHX/LSM6DSR/ISM330DHCX/LSM6DST/LSM6DSOP:
  *   - Accelerometer/Gyroscope supported ODR [Hz]: 12.5, 26, 52, 104, 208, 416,
  *     833
  *   - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16
@@ -786,6 +786,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
 				.hw_id = ST_LSM6DST_ID,
 				.name = ST_LSM6DST_DEV_NAME,
 				.wai = 0x6d,
+			}, {
+				.hw_id = ST_ASM330LHHX_ID,
+				.name = ST_ASM330LHHX_DEV_NAME,
+				.wai = 0x6b,
 			},
 		},
 		.channels = {
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
index 8b4fc2c15622..715fbdc8190e 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c
@@ -101,6 +101,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = {
 		.compatible = "st,lsm6dsop",
 		.data = (void *)ST_LSM6DSOP_ID,
 	},
+	{
+		.compatible = "st,asm330lhhx",
+		.data = (void *)ST_ASM330LHHX_ID,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match);
@@ -122,6 +126,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = {
 	{ ST_LSM6DSRX_DEV_NAME, ST_LSM6DSRX_ID },
 	{ ST_LSM6DST_DEV_NAME, ST_LSM6DST_ID },
 	{ ST_LSM6DSOP_DEV_NAME, ST_LSM6DSOP_ID },
+	{ ST_ASM330LHHX_DEV_NAME, ST_ASM330LHHX_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 e80110b6b280..f5767cf76c1d 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c
@@ -101,6 +101,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = {
 		.compatible = "st,lsm6dsop",
 		.data = (void *)ST_LSM6DSOP_ID,
 	},
+	{
+		.compatible = "st,asm330lhhx",
+		.data = (void *)ST_ASM330LHHX_ID,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match);
@@ -122,6 +126,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = {
 	{ ST_LSM6DSRX_DEV_NAME, ST_LSM6DSRX_ID },
 	{ ST_LSM6DST_DEV_NAME, ST_LSM6DST_ID },
 	{ ST_LSM6DSOP_DEV_NAME, ST_LSM6DSOP_ID },
+	{ ST_ASM330LHHX_DEV_NAME, ST_ASM330LHHX_ID },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table);
-- 
2.35.1


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

* [PATCH v2 2/2] dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings
  2022-04-04 19:24 [PATCH v2 0/2] add support for ASM330LHHX Lorenzo Bianconi
  2022-04-04 19:24 ` [PATCH v2 1/2] iio: imu: st_lsm6dsx: add support to ASM330LHHX Lorenzo Bianconi
@ 2022-04-04 19:24 ` Lorenzo Bianconi
  2022-04-05 11:22   ` Krzysztof Kozlowski
  2022-04-10 17:01 ` [PATCH v2 0/2] add support for ASM330LHHX Jonathan Cameron
  2 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-04-04 19:24 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi, robh

Add device bindings for asm330lhhx IMU sensor.
Use lsm6dsr as fallback device for asm330lhhx since it implements all
the features currently supported by asm330lhhx.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../bindings/iio/imu/st,lsm6dsx.yaml          | 38 ++++++++++---------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
index 0750f700a143..5d4839f00898 100644
--- a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml
@@ -14,23 +14,27 @@ description:
 
 properties:
   compatible:
-    enum:
-      - st,lsm6ds3
-      - st,lsm6ds3h
-      - st,lsm6dsl
-      - st,lsm6dsm
-      - st,ism330dlc
-      - st,lsm6dso
-      - st,asm330lhh
-      - st,lsm6dsox
-      - st,lsm6dsr
-      - st,lsm6ds3tr-c
-      - st,ism330dhcx
-      - st,lsm9ds1-imu
-      - st,lsm6ds0
-      - st,lsm6dsrx
-      - st,lsm6dst
-      - st,lsm6dsop
+    oneOf:
+      - enum:
+          - st,lsm6ds3
+          - st,lsm6ds3h
+          - st,lsm6dsl
+          - st,lsm6dsm
+          - st,ism330dlc
+          - st,lsm6dso
+          - st,asm330lhh
+          - st,lsm6dsox
+          - st,lsm6dsr
+          - st,lsm6ds3tr-c
+          - st,ism330dhcx
+          - st,lsm9ds1-imu
+          - st,lsm6ds0
+          - st,lsm6dsrx
+          - st,lsm6dst
+          - st,lsm6dsop
+      - items:
+          - const: st,asm330lhhx
+          - const: st,lsm6dsr
 
   reg:
     maxItems: 1
-- 
2.35.1


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

* Re: [PATCH v2 2/2] dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings
  2022-04-04 19:24 ` [PATCH v2 2/2] dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings Lorenzo Bianconi
@ 2022-04-05 11:22   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-05 11:22 UTC (permalink / raw)
  To: Lorenzo Bianconi, jic23; +Cc: linux-iio, devicetree, lorenzo.bianconi, robh

On 04/04/2022 21:24, Lorenzo Bianconi wrote:
> Add device bindings for asm330lhhx IMU sensor.
> Use lsm6dsr as fallback device for asm330lhhx since it implements all
> the features currently supported by asm330lhhx.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  .../bindings/iio/imu/st,lsm6dsx.yaml          | 38 ++++++++++---------
>  1 file changed, 21 insertions(+), 17 deletions(-)
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

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

* Re: [PATCH v2 0/2] add support for ASM330LHHX
  2022-04-04 19:24 [PATCH v2 0/2] add support for ASM330LHHX Lorenzo Bianconi
  2022-04-04 19:24 ` [PATCH v2 1/2] iio: imu: st_lsm6dsx: add support to ASM330LHHX Lorenzo Bianconi
  2022-04-04 19:24 ` [PATCH v2 2/2] dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings Lorenzo Bianconi
@ 2022-04-10 17:01 ` Jonathan Cameron
  2 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2022-04-10 17:01 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-iio, devicetree, lorenzo.bianconi, robh

On Mon,  4 Apr 2022 21:24:42 +0200
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> Add support for ASM330LHHX IMU automotive mems sensor
> https://www.st.com/resource/en/datasheet/asm330lhhx.pdf
> 
> Changes since v1:
> - use lsm6dsr as fallback device for asm330lhhx

Series applied to the togreg branch of iio.git and initially
pushed out as testing for 0-day to take a first look at it.

Thanks,

Jonathan

> 
> Lorenzo Bianconi (2):
>   iio: imu: st_lsm6dsx: add support to ASM330LHHX
>   dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings
> 
>  .../bindings/iio/imu/st,lsm6dsx.yaml          | 38 ++++++++++---------
>  drivers/iio/imu/st_lsm6dsx/Kconfig            |  6 +--
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h       |  2 +
>  .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c    |  3 +-
>  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   |  5 +++
>  7 files changed, 43 insertions(+), 22 deletions(-)
> 


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

end of thread, other threads:[~2022-04-10 16:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 19:24 [PATCH v2 0/2] add support for ASM330LHHX Lorenzo Bianconi
2022-04-04 19:24 ` [PATCH v2 1/2] iio: imu: st_lsm6dsx: add support to ASM330LHHX Lorenzo Bianconi
2022-04-04 19:24 ` [PATCH v2 2/2] dt-bindings: iio: imu: st_lsm6dsx: add asm330lhhx device bindings Lorenzo Bianconi
2022-04-05 11:22   ` Krzysztof Kozlowski
2022-04-10 17:01 ` [PATCH v2 0/2] add support for ASM330LHHX 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.