iio: accel: add support for LIS302DL variant
authorSicelo A. Mhlongo <absicsz@gmail.com>
Mon, 7 Mar 2022 13:25:02 +0000 (15:25 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 4 Apr 2022 08:11:23 +0000 (09:11 +0100)
Add support for STMicroelectronics LIS302DL accelerometer to the st_accel
framework.

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

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220307132502.73854-4-absicsz@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/st_accel.h
drivers/iio/accel/st_accel_core.c
drivers/iio/accel/st_accel_i2c.c
drivers/iio/accel/st_accel_spi.c

index 96e66b2f4cd9ed1c04c5cb5d22da872cb93175a4..5b0f54e33d9ef249df546be9fa48fb92678fb0c1 100644 (file)
 #define LIS3DE_ACCEL_DEV_NAME          "lis3de"
 #define LIS2DE12_ACCEL_DEV_NAME                "lis2de12"
 #define LIS2HH12_ACCEL_DEV_NAME                "lis2hh12"
+#define LIS302DL_ACCEL_DEV_NAME                "lis302dl"
 #define SC7A20_ACCEL_DEV_NAME          "sc7a20"
 
+
 #ifdef CONFIG_IIO_BUFFER
 int st_accel_allocate_ring(struct iio_dev *indio_dev);
 int st_accel_trig_set_state(struct iio_trigger *trig, bool state);
index 5c5da6fdb49029b0f1b34d0b4f9f54cd056f093e..673f3807f001c8c5a51a5e0b3f681d35c2cb528d 100644 (file)
@@ -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 = {
index 96adc4344f4a555ac162e6da02eb7a2235f3208a..45ee0ddc133c9fa82a9b0ab8251250a02cf77f57 100644 (file)
@@ -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,
+       },
        {
                .compatible = "silan,sc7a20",
                .data = SC7A20_ACCEL_DEV_NAME,
@@ -146,6 +150,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 },
        { SC7A20_ACCEL_DEV_NAME },
        {},
 };
index 108b63d0146c5501cc4cfbab6b84b8375b6eff6d..6c0917750288c4fce8709474db705c264eeca840 100644 (file)
@@ -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);