Skip to contentSkip to conversation

iio: accel: add support for LIS2DE12

PATCH Applied Robert Jones 4 participants 17 messages Mar 5, 2019 – Apr 14, 2019

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

cover iio: accel: add support for LIS2DE12

- Document the LIS2DE12 device tree binding.
- Add device tree support for STM LIS2DE12 accelerometer sensors.
- Add new st_sensor_settings entry for .wai == 0x33 devices with 5376Hz capability.

Robert Jones (2):
dt-bindings: iio: accel: add LIS2DE12 sensor device binding
iio: accel: add support to LIS2DE12

 .../devicetree/bindings/iio/st-sensors.txt         |  1 +
 drivers/iio/accel/Kconfig                          |  2 +-
 drivers/iio/accel/st_accel.h                       |  2 +
 drivers/iio/accel/st_accel_core.c                  | 76 ++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c                   |  5 ++
 5 files changed, 85 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.2
#1 lore raw

PATCH 1/2 dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..7f24b33 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12-accel
 
 Gyroscopes:
 - st,l3g4200d-gyro
Signature · 1 line
2.9.2
Acked-by on v1 1/2
#2 lore raw

RE: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..7f24b33 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12-accel
 
 Gyroscopes:
 - st,l3g4200d-gyro
Signature · 1 line
2.9.2
maintainer Applied
#3 lore raw

Re: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Quoted 1 line · On Sat, 9 Mar 2019 01:14:14 +0000 Denis CIOCCA <[email protected]> wrote:

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks

Jonathan

Quoted 29 lines

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..7f24b33 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12-accel
 
 Gyroscopes:
 - st,l3g4200d-gyro
#4 lore raw

Re: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Quoted 10 lines · On Sat, 9 Mar 2019 18:20:26 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Sat, 9 Mar 2019 01:14:14 +0000 Denis CIOCCA <[email protected]> wrote:

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks

Jonathan

Actually, sorry too fast to click send!

Why the -accel postfix?

That is normally only done for devices with multiple separate sensors within them. That isn't true as far as I can see for this one.

Jonathan

Quoted 31 lines
Quoted 30 lines

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..7f24b33 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12-accel
 
 Gyroscopes:
 - st,l3g4200d-gyro  
#5 lore raw

Re: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Quoted 13 lines · Jonathan Cameron
Quoted 9 lines · On Sat, 9 Mar 2019 18:20:26 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Sat, 9 Mar 2019 01:14:14 +0000 Denis CIOCCA <[email protected]> wrote:

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks

Quoted 8 lines
Quoted 1 line

Jonathan

Actually, sorry too fast to click send!

Why the -accel postfix?

That is normally only done for devices with multiple separate sensors within them. That isn't true as far as I can see for this one.

To be completely honest, I simply mimicked the commit for the st,lis2dh12-accel which appeared to be the closest equivalent after comparing datasheets.
If this is incorrect I have no issues with removing the postfix.

Thanks,
Robert

Quoted 34 lines

Jonathan

Quoted 31 lines
Quoted 30 lines

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..7f24b33 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12-accel
 
 Gyroscopes:
 - st,l3g4200d-gyro
#6 lore raw

RE: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

In reply to Jonathan Cameron

Yes, you are right Jonathan.

I saw that before but since there are already 15 sensors that are not following my initial convention anymore, I decided to let it go...Not sure I'll be able to catch all of the patches. But your point is actually correct. I know it's a small thing but anyway what do you thing about?

Denis

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: Saturday, March 9, 2019 10:23 AM
To: Denis CIOCCA <[email protected]>
Cc: Robert Jones <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>
Subject: Re: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Quoted 10 lines · On Sat, 9 Mar 2019 18:20:26 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Sat, 9 Mar 2019 01:14:14 +0000 Denis CIOCCA <[email protected]> wrote:

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks

Jonathan

Actually, sorry too fast to click send!

Why the -accel postfix?

That is normally only done for devices with multiple separate sensors within them. That isn't true as far as I can see for this one.

Jonathan

Quoted 38 lines
Quoted 37 lines

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..7f24b33 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12-accel
 
 Gyroscopes:
 - st,l3g4200d-gyro
#7 lore raw

Re: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Quoted 4 lines · On Mon, 11 Mar 2019 23:02:16 +0000 Denis CIOCCA <[email protected]> wrote:

Yes, you are right Jonathan.

I saw that before but since there are already 15 sensors that are not following my initial convention anymore, I decided to let it go...Not sure I'll be able to catch all of the patches. But your point is actually correct. I know it's a small thing but anyway what do you thing about?

Let's do best effort on this and I'll try to be careful to catch them as well. We could look at deprecating the inappropriate -accel bindings and add the version with out as well. Lots of appropriate comments should stop people repeating this in future.

Anyhow, for now I've just fixed this one up to drop it.

Thanks,

Jonathan

Quoted 71 lines

Denis

-----Original Message-----
From: Jonathan Cameron <[email protected]>
Sent: Saturday, March 9, 2019 10:23 AM
To: Denis CIOCCA <[email protected]>
Cc: Robert Jones <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>
Subject: Re: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Quoted 10 lines · On Sat, 9 Mar 2019 18:20:26 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Sat, 9 Mar 2019 01:14:14 +0000 Denis CIOCCA <[email protected]> wrote:

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks

Jonathan

Actually, sorry too fast to click send!

Why the -accel postfix?

That is normally only done for devices with multiple separate sensors within them. That isn't true as far as I can see for this one.

Jonathan

Quoted 38 lines
Quoted 37 lines

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..7f24b33 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12-accel
 
 Gyroscopes:
 - st,l3g4200d-gyro  
#8 lore raw

PATCH 2/2 iio: accel: add support to LIS2DE12

In reply to Robert Jones

Add support to STMicroelectronics LIS2DE12 accelerometer in st_accel framework.

http://www.st.com/resource/en/datasheet/lis2de12.pdf

---
 drivers/iio/accel/Kconfig         |  2 +-
 drivers/iio/accel/st_accel.h      |  2 ++
 drivers/iio/accel/st_accel_core.c | 76 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 4 files changed, 84 insertions(+), 1 deletion(-)
drivers/iio/accel/Kconfig +1 -1
index 898839c..ffd0b4d 100644
@@ -223,7 +223,7 @@ config IIO_ST_ACCEL_3AXIS
 	  Say yes here to build support for STMicroelectronics accelerometers:
 	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
 	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
-	  LNG2DM, LIS3DE
+	  LNG2DM, LIS3DE, LIS2DE12
 
 	  This driver can also be built as a module. If so, these modules
 	  will be created:
drivers/iio/accel/st_accel.h +2 -0
index fd53258..753a5671 100644
@@ -34,6 +34,7 @@ enum st_accel_type {
 	LIS3LV02DL,
 	LIS2DW12,
 	LIS3DHH,
+	LIS2DE12,
 	ST_ACCEL_MAX,
 };
 
@@ -57,6 +58,7 @@ enum st_accel_type {
 #define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
+#define LIS2DE12_ACCEL_DEV_NAME		"lis2de12_accel"
 
 /**
 * struct st_sensors_platform_data - default accel platform data
drivers/iio/accel/st_accel_core.c +76 -0

82 lines not on this page · raw message

drivers/iio/accel/st_accel_i2c.c +5 -0
index de8ae43..cb6eb6f 100644
@@ -102,6 +102,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis3de",
 		.data = LIS3DE_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2de12-accel",
+		.data = LIS2DE12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -140,6 +144,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
 	{ LIS3LV02DL_ACCEL_DEV_NAME },
 	{ LIS2DW12_ACCEL_DEV_NAME },
 	{ LIS3DE_ACCEL_DEV_NAME },
+	{ LIS2DE12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
Signature · 1 line
2.9.2
Acked-by on v1 2/2
#9 lore raw

RE: [PATCH 2/2] iio: accel: add support to LIS2DE12

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 2/2] iio: accel: add support to LIS2DE12

Add support to STMicroelectronics LIS2DE12 accelerometer in st_accel framework.

http://www.st.com/resource/en/datasheet/lis2de12.pdf

---
 drivers/iio/accel/Kconfig         |  2 +-
 drivers/iio/accel/st_accel.h      |  2 ++
 drivers/iio/accel/st_accel_core.c | 76 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 4 files changed, 84 insertions(+), 1 deletion(-)
drivers/iio/accel/Kconfig +1 -1
@@ -223,7 +223,7 @@ config IIO_ST_ACCEL_3AXIS
 	  Say yes here to build support for STMicroelectronics accelerometers:
 	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
 	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
-	  LNG2DM, LIS3DE
+	  LNG2DM, LIS3DE, LIS2DE12
 
 	  This driver can also be built as a module. If so, these modules
 	  will be created:
drivers/iio/accel/st_accel.h +2 -0
@@ -34,6 +34,7 @@ enum st_accel_type {
 	LIS3LV02DL,
 	LIS2DW12,
 	LIS3DHH,
+	LIS2DE12,
 	ST_ACCEL_MAX,
 };
 
@@ -57,6 +58,7 @@ enum st_accel_type {
 #define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
+#define LIS2DE12_ACCEL_DEV_NAME		"lis2de12_accel"
 
 /**
 * struct st_sensors_platform_data - default accel platform data diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c

index 9930edf..aebd611 100644

drivers/iio/accel/st_accel_core.c +76 -0

82 lines not on this page · raw message

index de8ae43..cb6eb6f 100644

drivers/iio/accel/st_accel_i2c.c +4 -0
@@ -102,6 +102,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis3de",
 		.data = LIS3DE_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2de12-accel",
+		.data = LIS2DE12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match); @@ -140,6 +144,7 @@ static const struct i2c_device_id st_accel_id_table[] = {

{ LIS3LV02DL_ACCEL_DEV_NAME },
{ LIS2DW12_ACCEL_DEV_NAME },
{ LIS3DE_ACCEL_DEV_NAME },
+ { LIS2DE12_ACCEL_DEV_NAME },
{},
};
MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
--
2.9.2

maintainer
#10 lore raw

Re: [PATCH 2/2] iio: accel: add support to LIS2DE12

Quoted 1 line · On Sat, 9 Mar 2019 01:14:21 +0000 Denis CIOCCA <[email protected]> wrote:

Applied with the minor tweak to drop the -accel postfix.

Thanks,

Jonathan

Quoted 164 lines

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 2/2] iio: accel: add support to LIS2DE12

Add support to STMicroelectronics LIS2DE12 accelerometer in st_accel framework.

http://www.st.com/resource/en/datasheet/lis2de12.pdf

---
 drivers/iio/accel/Kconfig         |  2 +-
 drivers/iio/accel/st_accel.h      |  2 ++
 drivers/iio/accel/st_accel_core.c | 76 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 4 files changed, 84 insertions(+), 1 deletion(-)
drivers/iio/accel/Kconfig +1 -1
@@ -223,7 +223,7 @@ config IIO_ST_ACCEL_3AXIS
 	  Say yes here to build support for STMicroelectronics accelerometers:
 	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
 	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
-	  LNG2DM, LIS3DE
+	  LNG2DM, LIS3DE, LIS2DE12
 
 	  This driver can also be built as a module. If so, these modules
 	  will be created:
drivers/iio/accel/st_accel.h +2 -0
@@ -34,6 +34,7 @@ enum st_accel_type {
 	LIS3LV02DL,
 	LIS2DW12,
 	LIS3DHH,
+	LIS2DE12,
 	ST_ACCEL_MAX,
 };
 
@@ -57,6 +58,7 @@ enum st_accel_type {
 #define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
+#define LIS2DE12_ACCEL_DEV_NAME		"lis2de12_accel"
 
 /**
 * struct st_sensors_platform_data - default accel platform data diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c

index 9930edf..aebd611 100644

drivers/iio/accel/st_accel_core.c +76 -0
@@ -831,6 +831,82 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.multi_read_bit = false,
 		.bootime = 2,
 	},
+	{
+	.wai = 0x33,
+	.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
+	.sensors_supported = {
+		[0] = LIS2DE12_ACCEL_DEV_NAME,
+	},
+	.ch = (struct iio_chan_spec *)st_accel_8bit_channels,
+	.odr = {
+		.addr = 0x20,
+		.mask = 0xf0,
+		.odr_avl = {
+			{ .hz = 1, .value = 0x01, },
+			{ .hz = 10, .value = 0x02, },
+			{ .hz = 25, .value = 0x03, },
+			{ .hz = 50, .value = 0x04, },
+			{ .hz = 100, .value = 0x05, },
+			{ .hz = 200, .value = 0x06, },
+			{ .hz = 400, .value = 0x07, },
+			{ .hz = 1600, .value = 0x08, },
+			{ .hz = 5376, .value = 0x09, },
+		},
+	},
+	.pw = {
+		.addr = 0x20,
+		.mask = 0xf0,
+		.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+	},
+	.enable_axis = {
+		.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
+		.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
+	},
+	.fs = {
+		.addr = 0x23,
+		.mask = 0x30,
+		.fs_avl = {
+			[0] = {
+				.num = ST_ACCEL_FS_AVL_2G,
+				.value = 0x00,
+				.gain = IIO_G_TO_M_S_2(15600),
+			},
+			[1] = {
+				.num = ST_ACCEL_FS_AVL_4G,
+				.value = 0x01,
+				.gain = IIO_G_TO_M_S_2(31200),
+			},
+			[2] = {
+				.num = ST_ACCEL_FS_AVL_8G,
+				.value = 0x02,
+				.gain = IIO_G_TO_M_S_2(62500),
+			},
+			[3] = {
+				.num = ST_ACCEL_FS_AVL_16G,
+				.value = 0x03,
+				.gain = IIO_G_TO_M_S_2(187500),
+			},
+			},
+	},
+	.bdu = {
+		.addr = 0x23,
+		.mask = 0x80,
+	},
+	.drdy_irq = {
+		.addr = 0x22,
+		.mask_int1 = 0x10,
+		.mask_int2 = 0x00,
+		.addr_ihl = 0x25,
+		.mask_ihl = 0x02,
+		.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
+	},
+	.sim = {
+		.addr = 0x23,
+		.value = BIT(0),
+	},
+	.multi_read_bit = true,
+	.bootime = 2,
+	},
 };
 
 static int st_accel_read_raw(struct iio_dev *indio_dev, diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c

index de8ae43..cb6eb6f 100644

drivers/iio/accel/st_accel_i2c.c +4 -0
@@ -102,6 +102,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis3de",
 		.data = LIS3DE_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2de12-accel",
+		.data = LIS2DE12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match); @@ -140,6 +144,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
drivers/iio/accel/st_accel_i2c.c +1 -1
 	{ LIS3LV02DL_ACCEL_DEV_NAME },
 	{ LIS2DW12_ACCEL_DEV_NAME },
 	{ LIS3DE_ACCEL_DEV_NAME },
+	{ LIS2DE12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
--

2.9.2

#11 lore raw

Re: [PATCH 2/2] iio: accel: add support to LIS2DE12

Quoted 5 lines · On Sat, 16 Mar 2019 15:06:32 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 1 line · On Sat, 9 Mar 2019 01:14:21 +0000 Denis CIOCCA <[email protected]> wrote:

Applied with the minor tweak to drop the -accel postfix.

I clicked too quick as my build test was running slow.

This doesn't build. See below. For now I've backed out both patches.

Jonathan

Quoted 126 lines

Thanks,

Jonathan

Quoted 121 lines

Thanks,
Denis

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Jones
Sent: Tuesday, March 5, 2019 12:33 PM
To: Jonathan Cameron <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: [email protected]; [email protected]; Hartmut Knaack <[email protected]>; Lars-Peter Clausen <[email protected]>; Peter Meerwald-Stadler <[email protected]>; Robert Jones <[email protected]>
Subject: [PATCH 2/2] iio: accel: add support to LIS2DE12

Add support to STMicroelectronics LIS2DE12 accelerometer in st_accel framework.

http://www.st.com/resource/en/datasheet/lis2de12.pdf

---
 drivers/iio/accel/Kconfig         |  2 +-
 drivers/iio/accel/st_accel.h      |  2 ++
 drivers/iio/accel/st_accel_core.c | 76 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 4 files changed, 84 insertions(+), 1 deletion(-)
drivers/iio/accel/Kconfig +1 -1
@@ -223,7 +223,7 @@ config IIO_ST_ACCEL_3AXIS
 	  Say yes here to build support for STMicroelectronics accelerometers:
 	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
 	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
-	  LNG2DM, LIS3DE
+	  LNG2DM, LIS3DE, LIS2DE12
 
 	  This driver can also be built as a module. If so, these modules
 	  will be created:
drivers/iio/accel/st_accel.h +2 -0
@@ -34,6 +34,7 @@ enum st_accel_type {
 	LIS3LV02DL,
 	LIS2DW12,
 	LIS3DHH,
+	LIS2DE12,
 	ST_ACCEL_MAX,
 };
 
@@ -57,6 +58,7 @@ enum st_accel_type {
 #define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
+#define LIS2DE12_ACCEL_DEV_NAME		"lis2de12_accel"
 
 /**
 * struct st_sensors_platform_data - default accel platform data diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c

index 9930edf..aebd611 100644

drivers/iio/accel/st_accel_core.c +60 -0
@@ -831,6 +831,82 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.multi_read_bit = false,
 		.bootime = 2,
 	},
+	{
+	.wai = 0x33,
+	.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
+	.sensors_supported = {
+		[0] = LIS2DE12_ACCEL_DEV_NAME,
+	},
+	.ch = (struct iio_chan_spec *)st_accel_8bit_channels,
+	.odr = {
+		.addr = 0x20,
+		.mask = 0xf0,
+		.odr_avl = {
+			{ .hz = 1, .value = 0x01, },
+			{ .hz = 10, .value = 0x02, },
+			{ .hz = 25, .value = 0x03, },
+			{ .hz = 50, .value = 0x04, },
+			{ .hz = 100, .value = 0x05, },
+			{ .hz = 200, .value = 0x06, },
+			{ .hz = 400, .value = 0x07, },
+			{ .hz = 1600, .value = 0x08, },
+			{ .hz = 5376, .value = 0x09, },
+		},
+	},
+	.pw = {
+		.addr = 0x20,
+		.mask = 0xf0,
+		.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+	},
+	.enable_axis = {
+		.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
+		.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
+	},
+	.fs = {
+		.addr = 0x23,
+		.mask = 0x30,
+		.fs_avl = {
+			[0] = {
+				.num = ST_ACCEL_FS_AVL_2G,
+				.value = 0x00,
+				.gain = IIO_G_TO_M_S_2(15600),
+			},
+			[1] = {
+				.num = ST_ACCEL_FS_AVL_4G,
+				.value = 0x01,
+				.gain = IIO_G_TO_M_S_2(31200),
+			},
+			[2] = {
+				.num = ST_ACCEL_FS_AVL_8G,
+				.value = 0x02,
+				.gain = IIO_G_TO_M_S_2(62500),
+			},
+			[3] = {
+				.num = ST_ACCEL_FS_AVL_16G,
+				.value = 0x03,
+				.gain = IIO_G_TO_M_S_2(187500),
+			},
+			},
+	},
+	.bdu = {
+		.addr = 0x23,
+		.mask = 0x80,
Quoted 8 lines

drivers/iio/accel/st_accel_core.c static const struct st_sensor_settings st_accel_sensors_settings[] = { · line 901

Quoted 8 lines
drivers/iio/accel/st_accel_core.c +8 -0
+	},
+	.drdy_irq = {
+		.addr = 0x22,
+		.mask_int1 = 0x10,
+		.mask_int2 = 0x00,
+		.addr_ihl = 0x25,
+		.mask_ihl = 0x02,
+		.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,

This has changed completely since.

75d4c6d2e15d iio: st_sensors: decouple irq1 configuration parameters from the irq2 ones

I'm going to guess you are working with a kernel predating that. You'll need to update this to work with the current kernel.

Quoted 36 lines
Quoted 35 lines
drivers/iio/accel/st_accel_core.c +8 -0
+	},
+	.sim = {
+		.addr = 0x23,
+		.value = BIT(0),
+	},
+	.multi_read_bit = true,
+	.bootime = 2,
+	},
 };
 
 static int st_accel_read_raw(struct iio_dev *indio_dev, diff --git a/drivers/iio/accel/st_accel_i2c.c b/drivers/iio/accel/st_accel_i2c.c

index de8ae43..cb6eb6f 100644

drivers/iio/accel/st_accel_i2c.c +4 -0
@@ -102,6 +102,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis3de",
 		.data = LIS3DE_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2de12-accel",
+		.data = LIS2DE12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match); @@ -140,6 +144,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
drivers/iio/accel/st_accel_i2c.c +1 -1
 	{ LIS3LV02DL_ACCEL_DEV_NAME },
 	{ LIS2DW12_ACCEL_DEV_NAME },
 	{ LIS3DE_ACCEL_DEV_NAME },
+	{ LIS2DE12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
--

2.9.2

#12 lore raw

v2 cover iio: accel: add support for LIS2DE12

In reply to Robert Jones

- Document the LIS2DE12 device tree binding.
- Add device tree support for STM LIS2DE12 accelerometer sensors.
- Add new st_sensor_settings entry for .wai == 0x33 devices with 5376Hz capability.

Changelog:

v2: - Removed "-accel" postfix to device tree bindings and compatible string
- Updated .drdy_irq field to follow updated structure format

Robert Jones (2):
dt-bindings: iio: accel: add LIS2DE12 sensor device binding
iio: accel: add support to LIS2DE12

 .../devicetree/bindings/iio/st-sensors.txt         |  1 +
 drivers/iio/accel/Kconfig                          |  2 +-
 drivers/iio/accel/st_accel.h                       |  2 +
 drivers/iio/accel/st_accel_core.c                  | 76 ++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c                   |  5 ++
 5 files changed, 85 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.2
#13 lore raw

PATCH v2 1/2 dt-bindings: iio: accel: add LIS2DE12 sensor device binding

---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..0ef64a4 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12
 
 Gyroscopes:
 - st,l3g4200d-gyro
Signature · 1 line
2.9.2
maintainer
#14 lore raw

Re: [PATCH v2 1/2] dt-bindings: iio: accel: add LIS2DE12 sensor device binding

Quoted 1 line · On Wed, 10 Apr 2019 17:12:08 -0700 Robert Jones <[email protected]> wrote:

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 16 lines
---
 Documentation/devicetree/bindings/iio/st-sensors.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/st-sensors.txt +1 -0
index 52ee4ba..0ef64a4 100644
@@ -49,6 +49,7 @@ Accelerometers:
 - st,lis2dw12
 - st,lis3dhh
 - st,lis3de
+- st,lis2de12
 
 Gyroscopes:
 - st,l3g4200d-gyro
#15 lore raw

PATCH v2 2/2 iio: accel: add support to LIS2DE12

In reply to Robert Jones

Add support to STMicroelectronics LIS2DE12 accelerometer in st_accel framework.

http://www.st.com/resource/en/datasheet/lis2de12.pdf

---
 drivers/iio/accel/Kconfig         |  2 +-
 drivers/iio/accel/st_accel.h      |  2 ++
 drivers/iio/accel/st_accel_core.c | 76 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 4 files changed, 84 insertions(+), 1 deletion(-)
drivers/iio/accel/Kconfig +1 -1
index 4a1f133..62a970a 100644
@@ -223,7 +223,7 @@ config IIO_ST_ACCEL_3AXIS
 	  Say yes here to build support for STMicroelectronics accelerometers:
 	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
 	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
-	  LNG2DM, LIS3DE
+	  LNG2DM, LIS3DE, LIS2DE12
 
 	  This driver can also be built as a module. If so, these modules
 	  will be created:
drivers/iio/accel/st_accel.h +2 -0
index fd53258..9d25955 100644
@@ -34,6 +34,7 @@ enum st_accel_type {
 	LIS3LV02DL,
 	LIS2DW12,
 	LIS3DHH,
+	LIS2DE12,
 	ST_ACCEL_MAX,
 };
 
@@ -57,6 +58,7 @@ enum st_accel_type {
 #define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
+#define LIS2DE12_ACCEL_DEV_NAME		"lis2de12"
 
 /**
 * struct st_sensors_platform_data - default accel platform data
drivers/iio/accel/st_accel_core.c +76 -0

82 lines not on this page · raw message

drivers/iio/accel/st_accel_i2c.c +5 -0
index de8ae43..4e54477 100644
@@ -102,6 +102,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis3de",
 		.data = LIS3DE_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2de12",
+		.data = LIS2DE12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -140,6 +144,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
 	{ LIS3LV02DL_ACCEL_DEV_NAME },
 	{ LIS2DW12_ACCEL_DEV_NAME },
 	{ LIS3DE_ACCEL_DEV_NAME },
+	{ LIS2DE12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
Signature · 1 line
2.9.2
maintainer
#16 lore raw

Re: [PATCH v2 2/2] iio: accel: add support to LIS2DE12

Quoted 6 lines · On Wed, 10 Apr 2019 17:12:09 -0700 Robert Jones <[email protected]> wrote:

Add support to STMicroelectronics LIS2DE12 accelerometer in st_accel framework.

http://www.st.com/resource/en/datasheet/lis2de12.pdf

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 150 lines
---
 drivers/iio/accel/Kconfig         |  2 +-
 drivers/iio/accel/st_accel.h      |  2 ++
 drivers/iio/accel/st_accel_core.c | 76 +++++++++++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 +++
 4 files changed, 84 insertions(+), 1 deletion(-)
drivers/iio/accel/Kconfig +1 -1
index 4a1f133..62a970a 100644
@@ -223,7 +223,7 @@ config IIO_ST_ACCEL_3AXIS
 	  Say yes here to build support for STMicroelectronics accelerometers:
 	  LSM303DLH, LSM303DLHC, LIS3DH, LSM330D, LSM330DL, LSM330DLC,
 	  LIS331DLH, LSM303DL, LSM303DLM, LSM330, LIS2DH12, H3LIS331DL,
-	  LNG2DM, LIS3DE
+	  LNG2DM, LIS3DE, LIS2DE12
 
 	  This driver can also be built as a module. If so, these modules
 	  will be created:
drivers/iio/accel/st_accel.h +2 -0
index fd53258..9d25955 100644
@@ -34,6 +34,7 @@ enum st_accel_type {
 	LIS3LV02DL,
 	LIS2DW12,
 	LIS3DHH,
+	LIS2DE12,
 	ST_ACCEL_MAX,
 };
 
@@ -57,6 +58,7 @@ enum st_accel_type {
 #define LIS2DW12_ACCEL_DEV_NAME		"lis2dw12"
 #define LIS3DHH_ACCEL_DEV_NAME		"lis3dhh"
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
+#define LIS2DE12_ACCEL_DEV_NAME		"lis2de12"
 
 /**
 * struct st_sensors_platform_data - default accel platform data
drivers/iio/accel/st_accel_core.c +76 -0
index 9930edf..5ff04d9 100644
@@ -831,6 +831,82 @@ static const struct st_sensor_settings st_accel_sensors_settings[] = {
 		.multi_read_bit = false,
 		.bootime = 2,
 	},
+	{
+		.wai = 0x33,
+		.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
+		.sensors_supported = {
+			[0] = LIS2DE12_ACCEL_DEV_NAME,
+		},
+		.ch = (struct iio_chan_spec *)st_accel_8bit_channels,
+		.odr = {
+			.addr = 0x20,
+			.mask = 0xf0,
+			.odr_avl = {
+				{ .hz = 1, .value = 0x01, },
+				{ .hz = 10, .value = 0x02, },
+				{ .hz = 25, .value = 0x03, },
+				{ .hz = 50, .value = 0x04, },
+				{ .hz = 100, .value = 0x05, },
+				{ .hz = 200, .value = 0x06, },
+				{ .hz = 400, .value = 0x07, },
+				{ .hz = 1620, .value = 0x08, },
+				{ .hz = 5376, .value = 0x09, },
+			},
+		},
+		.pw = {
+			.addr = 0x20,
+			.mask = 0xf0,
+			.value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
+		},
+		.enable_axis = {
+			.addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
+			.mask = ST_SENSORS_DEFAULT_AXIS_MASK,
+		},
+		.fs = {
+			.addr = 0x23,
+			.mask = 0x30,
+			.fs_avl = {
+				[0] = {
+					.num = ST_ACCEL_FS_AVL_2G,
+					.value = 0x00,
+					.gain = IIO_G_TO_M_S_2(15600),
+				},
+				[1] = {
+					.num = ST_ACCEL_FS_AVL_4G,
+					.value = 0x01,
+					.gain = IIO_G_TO_M_S_2(31200),
+				},
+				[2] = {
+					.num = ST_ACCEL_FS_AVL_8G,
+					.value = 0x02,
+					.gain = IIO_G_TO_M_S_2(62500),
+				},
+				[3] = {
+					.num = ST_ACCEL_FS_AVL_16G,
+					.value = 0x03,
+					.gain = IIO_G_TO_M_S_2(187500),
+				},
+			},
+		},
+		.drdy_irq = {
+			.int1 = {
+				.addr = 0x22,
+				.mask = 0x10,
+			},
+			.addr_ihl = 0x25,
+			.mask_ihl = 0x02,
+			.stat_drdy = {
+				.addr = ST_SENSORS_DEFAULT_STAT_ADDR,
+				.mask = 0x07,
+			},
+		},
+		.sim = {
+			.addr = 0x23,
+			.value = BIT(0),
+		},
+		.multi_read_bit = true,
+		.bootime = 2,
+	},
 };
 
 static int st_accel_read_raw(struct iio_dev *indio_dev,
drivers/iio/accel/st_accel_i2c.c +5 -0
index de8ae43..4e54477 100644
@@ -102,6 +102,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis3de",
 		.data = LIS3DE_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "st,lis2de12",
+		.data = LIS2DE12_ACCEL_DEV_NAME,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, st_accel_of_match);
@@ -140,6 +144,7 @@ static const struct i2c_device_id st_accel_id_table[] = {
 	{ LIS3LV02DL_ACCEL_DEV_NAME },
 	{ LIS2DW12_ACCEL_DEV_NAME },
 	{ LIS3DE_ACCEL_DEV_NAME },
+	{ LIS2DE12_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);