Skip to contentSkip to conversation

iio: Silan SC7A20 accelerometer support

PATCH Superseded Samuel Holland 4 participants 11 messages Feb 2, 2022 – Feb 13, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover iio: Silan SC7A20 accelerometer support

This chip is register-compatible with an ST part, so it works without any issues when added to the existing driver.

Previously I called it a clone, but it's not really a clone, because it's not a drop-in replacement for the other chips. The software interface matches the ST parts, but the pinout does not. Instead, the pinout matches the Kionix KX122 and KX132.

Changes in v2:
- Move the new compatible to its own section
- Add a comment about the WAI value
- Update commit messages

Samuel Holland (3):
dt-bindings: vendor-prefixes: Add silan vendor prefix
dt-bindings: iio: st: Add Silan SC7A20 accelerometer
iio: accel: st_accel: Add support for Silan SC7A20

 .../bindings/iio/st,st-sensors.yaml           |  3 +
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 drivers/iio/accel/st_accel.h                  |  2 +
 drivers/iio/accel/st_accel_core.c             | 83 +++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c              |  5 ++
 5 files changed, 95 insertions(+)
Signature · 1 line
2.33.1
#1 lore raw

PATCH v2 1/3 dt-bindings: vendor-prefixes: Add silan vendor prefix

Hangzhou Silan Microelectronics Co., Ltd. (http://www.silan.com.cn/) is a manufacturer of ICs, including MEMS sensors.

---

(no changes since v1)

 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 294093d45a23..b923be2c8172 100644
@@ -1082,6 +1082,8 @@ patternProperties:
     description: Silicon Image
   "^silabs,.*":
     description: Silicon Laboratories
+  "^silan,.*":
+    description: Hangzhou Silan Microelectronics Co., Ltd.
   "^silead,.*":
     description: Silead Inc.
   "^silergy,.*":
Signature · 1 line
2.33.1
maintainer Acked-by on v2 1/3
#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: vendor-prefixes: Add silan vendor prefix

In reply to Samuel Holland
Quoted 11 lines · Samuel Holland

Hangzhou Silan Microelectronics Co., Ltd. (http://www.silan.com.cn/) is a manufacturer of ICs, including MEMS sensors.

---

(no changes since v1)

 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
#4 lore raw

PATCH v2 2/3 dt-bindings: iio: st: Add Silan SC7A20 accelerometer

In reply to Samuel Holland

This chip is not an ST part, but it appears to be register-compatible with the LIS2DH, so it can use the same binding.

---

Changes in v2:
- Move the new compatible to its own section

 Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/iio/st,st-sensors.yaml +3 -0
index 71de5631ebae..9735a2048255 100644
@@ -46,6 +46,9 @@ properties:
           - st,lsm330d-accel
           - st,lsm330dl-accel
           - st,lsm330dlc-accel
+      - description: Silan Accelerometers
+        enum:
+          - silan,sc7a20
       - description: STMicroelectronics Gyroscopes
         enum:
           - st,l3g4200d-gyro
Signature · 1 line
2.33.1
maintainer Acked-by on v2 2/3
#6 lore raw

Re: [PATCH v2 2/3] dt-bindings: iio: st: Add Silan SC7A20 accelerometer

In reply to Samuel Holland
Quoted 12 lines · Samuel Holland

This chip is not an ST part, but it appears to be register-compatible with the LIS2DH, so it can use the same binding.

---

Changes in v2:
- Move the new compatible to its own section

 Documentation/devicetree/bindings/iio/st,st-sensors.yaml | 3 +++
 1 file changed, 3 insertions(+)
#7 lore raw

PATCH v2 3/3 iio: accel: st_accel: Add support for Silan SC7A20

In reply to Samuel Holland

This chip appears to be register-compatible with the LIS2DH. The new description is a copy of the LIS2DH's description with a different WAI value.

Datasheet: http://linux-chenxing.org/silan/SC7A20-SilanMicroelectronics.pdf
Datasheet: http://www.siitek.com.cn/Upfiles/down/SC7A20说明书_0.92(智能穿戴).pdf

---

Changes in v2:
- Add a comment about the WAI value
- Update commit messages

 drivers/iio/accel/st_accel.h      |  2 +
 drivers/iio/accel/st_accel_core.c | 83 +++++++++++++++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c  |  5 ++
 3 files changed, 90 insertions(+)
drivers/iio/accel/st_accel.h +2 -0
index 8750dea56fcb..00e056c21bfc 100644
@@ -36,6 +36,7 @@ enum st_accel_type {
 	LIS3DHH,
 	LIS2DE12,
 	LIS2HH12,
+	SC7A20,
 	ST_ACCEL_MAX,
 };
 
@@ -61,6 +62,7 @@ enum st_accel_type {
 #define LIS3DE_ACCEL_DEV_NAME		"lis3de"
 #define LIS2DE12_ACCEL_DEV_NAME		"lis2de12"
 #define LIS2HH12_ACCEL_DEV_NAME		"lis2hh12"
+#define SC7A20_ACCEL_DEV_NAME		"sc7a20"
 
 #ifdef CONFIG_IIO_BUFFER
 int st_accel_allocate_ring(struct iio_dev *indio_dev);
drivers/iio/accel/st_accel_core.c +83 -0

89 lines not on this page · raw message

drivers/iio/accel/st_accel_i2c.c +5 -0
index c0ce78eebad9..7f5888570e87 100644
@@ -107,6 +107,10 @@ static const struct of_device_id st_accel_of_match[] = {
 		.compatible = "st,lis2hh12",
 		.data = LIS2HH12_ACCEL_DEV_NAME,
 	},
+	{
+		.compatible = "silan,sc7a20",
+		.data = SC7A20_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 },
+	{ SC7A20_ACCEL_DEV_NAME },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, st_accel_id_table);
Signature · 1 line
2.33.1
Reviewed-by on v2 3/3
#8 lore raw

Re: [PATCH v2 3/3] iio: accel: st_accel: Add support for Silan SC7A20

Quoted 4 lines · Samuel Holland

This chip appears to be register-compatible with the LIS2DH. The new description is a copy of the LIS2DH's description with a different WAI value.

Quoted 8 lines

Datasheet: http://linux-chenxing.org/silan/SC7A20-SilanMicroelectronics.pdf
Datasheet: http://www.siitek.com.cn/Upfiles/down/SC7A20说明书_0.92(智能穿戴).pdf

---

Changes in v2:
- Add a comment about the WAI value
- Update commit messages

Yours,
Linus Walleij

maintainer
#9 lore raw
In reply to Samuel Holland
Quoted 7 lines · On Wed, 2 Feb 2022 17:50:45 -0600 Samuel Holland <[email protected]> wrote:

This chip is register-compatible with an ST part, so it works without any issues when added to the existing driver.

Previously I called it a clone, but it's not really a clone, because it's not a drop-in replacement for the other chips. The software interface matches the ST parts, but the pinout does not. Instead, the pinout matches the Kionix KX122 and KX132.

Weird :)

I'm fine with the series, but as it contains a new vendor ID and the dt-binding update I'll leave it on list for a bit longer to give Rob time to sanity check that.

Thanks,

Jonathan

Quoted 18 lines

Changes in v2:
- Move the new compatible to its own section
- Add a comment about the WAI value
- Update commit messages

Samuel Holland (3):
dt-bindings: vendor-prefixes: Add silan vendor prefix
dt-bindings: iio: st: Add Silan SC7A20 accelerometer
iio: accel: st_accel: Add support for Silan SC7A20

 .../bindings/iio/st,st-sensors.yaml           |  3 +
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 drivers/iio/accel/st_accel.h                  |  2 +
 drivers/iio/accel/st_accel_core.c             | 83 +++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c              |  5 ++
 5 files changed, 95 insertions(+)
maintainer
#10 lore raw
In reply to Samuel Holland
Quoted 7 lines · On Wed, 2 Feb 2022 17:50:45 -0600 Samuel Holland <[email protected]> wrote:

This chip is register-compatible with an ST part, so it works without any issues when added to the existing driver.

Previously I called it a clone, but it's not really a clone, because it's not a drop-in replacement for the other chips. The software interface matches the ST parts, but the pinout does not. Instead, the pinout matches the Kionix KX122 and KX132.

Series applied to the togreg branch of iio.git and pushed out as testing to see if 0-day can find anything we missed.

Thanks,

Jonathan

Quoted 18 lines

Changes in v2:
- Move the new compatible to its own section
- Add a comment about the WAI value
- Update commit messages

Samuel Holland (3):
dt-bindings: vendor-prefixes: Add silan vendor prefix
dt-bindings: iio: st: Add Silan SC7A20 accelerometer
iio: accel: st_accel: Add support for Silan SC7A20

 .../bindings/iio/st,st-sensors.yaml           |  3 +
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 drivers/iio/accel/st_accel.h                  |  2 +
 drivers/iio/accel/st_accel_core.c             | 83 +++++++++++++++++++
 drivers/iio/accel/st_accel_i2c.c              |  5 ++
 5 files changed, 95 insertions(+)