Skip to contentSkip to conversation

Support LIS302DL in st_accel

PATCH Applied Sicelo A. Mhlongo 3 participants 6 messages Mar 7, 2022 – Mar 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 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 ++++
 drivers/iio/accel/st_accel_spi.c              |  5 ++++
 5 files changed, 13 insertions(+), 25 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH v3 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
#2 lore raw

PATCH v3 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
#3 lore raw

PATCH v3 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.

Datasheet: 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 +++++
 drivers/iio/accel/st_accel_spi.c  | 5 +++++
 4 files changed, 12 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);
drivers/iio/accel/st_accel_spi.c +5 -0
index b74a1c6d03de..5d77521a8d1e 100644
@@ -92,6 +92,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis3de",
 		.data = LIS3DE_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis302dl",
+		.data = LIS302DL_ACCEL_DEV_NAME,
+	},
 	{}
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -147,6 +151,7 @@ static const struct spi_device_id st_accel_id_table[] = {
 	{ LIS2DW12_ACCEL_DEV_NAME },
 	{ LIS3DHH_ACCEL_DEV_NAME },
 	{ LIS3DE_ACCEL_DEV_NAME },
+	{ LIS302DL_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, st_accel_id_table);
Signature · 1 line
2.35.1
Reviewed-by on the v3 series
#4 lore raw
In reply to Sicelo A. Mhlongo
Quoted 5 lines · Sicelo A. Mhlongo

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.

The entire series is fine to me

Quoted 20 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 ++++
 drivers/iio/accel/st_accel_spi.c              |  5 ++++
 5 files changed, 13 insertions(+), 25 deletions(-)
Signature · 1 line
2.35.1
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#5 lore raw
Quoted 9 lines · On Mon, 7 Mar 2022 15:58:33 +0200 Andy Shevchenko…
Quoted 5 lines · Sicelo A. Mhlongo

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.

The entire series is fine to me

This crossed with another series adding the sc7a20 so I hand tweaked it whilst applying.

Applied to the togreg branch of iio.git but I'll be rebasing that on rc1 once available so in meantime just pushed out as testing.

Thanks,

Jonathan

Quoted 22 lines
Quoted 21 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 ++++
 drivers/iio/accel/st_accel_spi.c              |  5 ++++
 5 files changed, 13 insertions(+), 25 deletions(-)
Signature · 1 line
2.35.1