Skip to contentSkip to conversation

Support LIS302DL in st_accel

PATCH Superseded Sicelo A. Mhlongo 5 participants 10 messages Mar 1, 2022 – Mar 7, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support LIS302DL in st_accel

Hi,

The ST Microelectronics LIS302DL is currently only supported in the evdev framework driver in drivers/misc/lis3lv02d. This series enables support for it in the iio framework.

Regards,
Sicelo

Sicelo A. Mhlongo (3):
dt-bindings: iio: st,st-sensors add LIS302DL
iio: accel: Remove unused enum in st_accel
iio: accel: add support for LIS302DL variant

 .../bindings/iio/st,st-sensors.yaml           |  1 +
 drivers/iio/accel/st_accel.h                  | 26 +------------------
 drivers/iio/accel/st_accel_core.c             |  1 +
 drivers/iio/accel/st_accel_i2c.c              |  5 ++++
 4 files changed, 8 insertions(+), 25 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 1/3 dt-bindings: iio: st,st-sensors add LIS302DL

Update st,st-sensors bindings for STMicroelectronics LIS302DL variant

---
 Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st,st-sensors.yaml +1 -0
index 71de5631ebae..321fd16b6ea7 100644
@@ -29,6 +29,7 @@ properties:
           - st,lis2dw12
           - st,lis2hh12
           - st,lis2dh12-accel
+          - st,lis302dl
           - st,lis331dl-accel
           - st,lis331dlh-accel
           - st,lis3de
Signature · 1 line
2.35.1
#3 lore raw

PATCH v2 2/3 iio: accel: Remove unused enum in st_accel

In reply to Sicelo A. Mhlongo

The st_accel_type enum is not used anywhere else in the code, and can be removed

---
 drivers/iio/accel/st_accel.h | 25 -------------------------
 1 file changed, 25 deletions(-)
drivers/iio/accel/st_accel.h +0 -25
index 8750dea56fcb..969cc7faca07 100644
@@ -14,31 +14,6 @@
 #include <linux/types.h>
 #include <linux/iio/common/st_sensors.h>
 
-enum st_accel_type {
-	LSM303DLH,
-	LSM303DLHC,
-	LIS3DH,
-	LSM330D,
-	LSM330DL,
-	LSM330DLC,
-	LIS331DLH,
-	LSM303DL,
-	LSM303DLM,
-	LSM330,
-	LSM303AGR,
-	LIS2DH12,
-	LIS3L02DQ,
-	LNG2DM,
-	H3LIS331DL,
-	LIS331DL,
-	LIS3LV02DL,
-	LIS2DW12,
-	LIS3DHH,
-	LIS2DE12,
-	LIS2HH12,
-	ST_ACCEL_MAX,
-};
-
 #define H3LIS331DL_ACCEL_DEV_NAME	"h3lis331dl_accel"
 #define LIS3LV02DL_ACCEL_DEV_NAME	"lis3lv02dl_accel"
 #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
Signature · 1 line
2.35.1
#5 lore raw

PATCH v2 3/3 iio: accel: add support for LIS302DL variant

In reply to Sicelo A. Mhlongo

Add support for STMicroelectronics LIS302DL accelerometer to the st_accel framework.

https://www.st.com/resource/en/datasheet/lis302dl.pdf

---
 drivers/iio/accel/st_accel.h      | 1 +
 drivers/iio/accel/st_accel_core.c | 1 +
 drivers/iio/accel/st_accel_i2c.c  | 5 +++++
 3 files changed, 7 insertions(+)
drivers/iio/accel/st_accel.h +1 -0
index 969cc7faca07..0e79dc100ce5 100644
@@ -36,6 +36,7 @@
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
 #define LIS2DE12_ACCEL_DEV_NAME		"lis2de12"
 #define LIS2HH12_ACCEL_DEV_NAME		"lis2hh12"
+#define LIS302DL_ACCEL_DEV_NAME		"lis302dl"
 
 #ifdef CONFIG_IIO_BUFFER
 int st_accel_allocate_ring(struct iio_dev *indio_dev);
drivers/iio/accel/st_accel_core.c +1 -0
index 31ea19d0ba71..2a353c51c84a 100644
@@ -444,6 +444,7 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
 		.sensors_supported = {
 			[0] = LIS331DL_ACCEL_DEV_NAME,
+			[1] = LIS302DL_ACCEL_DEV_NAME,
 		},
 		.ch = (struct iio_chan_spec *)st_accel_8bit_channels,
 		.odr = {
drivers/iio/accel/st_accel_i2c.c +5 -0
index c0ce78eebad9..086e8af89e18 100644
@@ -107,6 +107,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis2hh12",
 		.data = LIS2HH12_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis302dl",
+		.data = LIS302DL_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -142,6 +146,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
 	{ LIS3DE_ACCEL_DEV_NAME },
 	{ LIS2DE12_ACCEL_DEV_NAME },
 	{ LIS2HH12_ACCEL_DEV_NAME },
+	{ LIS302DL_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
Signature · 1 line
2.35.1
Reviewed-by on v2 3/3
#6 lore raw

Re: [PATCH v2 3/3] iio: accel: add support for LIS302DL variant

Quoted 6 lines · Sicelo A. Mhlongo

Add support for STMicroelectronics LIS302DL accelerometer to the st_accel framework.

https://www.st.com/resource/en/datasheet/lis302dl.pdf

As discussed on chat this sensor has the nice freefall-detection feature which we should implement as an event in IIO one of these days :)

Yours,
Linus Walleij

#7 lore raw

Re: [PATCH v2 3/3] iio: accel: add support for LIS302DL variant

In reply to Sicelo A. Mhlongo
Quoted 4 lines · Sicelo A. Mhlongo

Add support for STMicroelectronics LIS302DL accelerometer to the st_accel framework.

https://www.st.com/resource/en/datasheet/lis302dl.pdf

Can this be converted to Datasheet: tag, please?

Quoted 1 line

...

Quoted 1 line
 drivers/iio/accel/st_accel_i2c.c  | 5 +++++

Doesn't SPI also need to be updated? I believe those sensors are capable of both interfaces, but correct me, if I'm wrong.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw
In reply to Sicelo A. Mhlongo
Quoted 6 lines · On Wed, 2 Mar 2022 00:54:29 +0200 "Sicelo A. Mhlongo" <[email protected]>…

Hi,

The ST Microelectronics LIS302DL is currently only supported in the evdev framework driver in drivers/misc/lis3lv02d. This series enables support for it in the iio framework.

Other the the issues Andy raised around the tag and also adding SPI support this looks good to me.

We are very late in this cycle, so it is now material for 5.19. Plenty of time to make those final little tidy ups and get this queued early in the next cycle.

Thanks,

Jonathan

Quoted 15 lines

Regards,
Sicelo

Sicelo A. Mhlongo (3):
dt-bindings: iio: st,st-sensors add LIS302DL
iio: accel: Remove unused enum in st_accel
iio: accel: add support for LIS302DL variant

 .../bindings/iio/st,st-sensors.yaml           |  1 +
 drivers/iio/accel/st_accel.h                  | 26 +------------------
 drivers/iio/accel/st_accel_core.c             |  1 +
 drivers/iio/accel/st_accel_i2c.c              |  5 ++++
 4 files changed, 8 insertions(+), 25 deletions(-)
author
#9 lore raw
Quoted 7 lines · Jonathan Cameron

Other the the issues Andy raised around the tag and also adding SPI support this looks good to me.

We are very late in this cycle, so it is now material for 5.19. Plenty of time to make those final little tidy ups and get this queued early in the next cycle.

Thank you so much. I will prepare next version of patches soon.

Sincerely
Sicelo