iio: accel: st_accel: handle deprecated bindings
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 5 Jan 2017 13:32:33 +0000 (14:32 +0100)
committerJonathan Cameron <jic23@kernel.org>
Tue, 10 Jan 2017 19:54:16 +0000 (19:54 +0000)
The earlier deployed LIS3LV02DL driver had already defined a few
DT bindings that need to be supported by the new more generic
driver and listed as compatible but deprecated bindings in the
documentation.

After this we can start to activate the new driver with the old
systems where applicable.

As part of this enablement: make us depend on the old drivers
not being in use so we don't get a kernel with two competing
drivers.

Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/devicetree/bindings/iio/accel/lis302.txt
Documentation/devicetree/bindings/iio/st-sensors.txt
drivers/iio/accel/Kconfig
drivers/iio/accel/st_accel_i2c.c
drivers/iio/accel/st_accel_spi.c

index 2a19bff9693fc55a7b61bb45dcf32963bc7f224a..dfdce67826bae50cf67d073c947a079628714368 100644 (file)
@@ -5,7 +5,7 @@ that apply in on the generic device (independent from the bus).
 
 
 Required properties for the SPI bindings:
- - compatible:                 should be set to "st,lis3lv02d_spi"
+ - compatible:                 should be set to "st,lis3lv02d-spi"
  - reg:                        the chipselect index
  - spi-max-frequency:  maximal bus speed, should be set to 1000000 unless
                        constrained by external circuitry
index c040c9ad18899e70f8c2fb24cd2d77289928acfc..eaa8fbba34e2eb89f971eae2fdf5af136db0f751 100644 (file)
@@ -27,6 +27,8 @@ standard bindings from pinctrl/pinctrl-bindings.txt.
 Valid compatible strings:
 
 Accelerometers:
+- st,lis3lv02d (deprecated, use st,lis3lv02dl-accel)
+- st,lis302dl-spi (deprecated, use st,lis3lv02dl-accel)
 - st,lis3lv02dl-accel
 - st,lsm303dlh-accel
 - st,lsm303dlhc-accel
index c68bdb649005e8a183f5868b2daf237f3d2631c6..ea295fe0f5613b64dbb55e8876239b364c9b70ba 100644 (file)
@@ -140,11 +140,13 @@ config IIO_ST_ACCEL_3AXIS
 
 config IIO_ST_ACCEL_I2C_3AXIS
        tristate
+       depends on !SENSORS_LIS3_I2C
        depends on IIO_ST_ACCEL_3AXIS
        depends on IIO_ST_SENSORS_I2C
 
 config IIO_ST_ACCEL_SPI_3AXIS
        tristate
+       depends on !SENSORS_LIS3_SPI
        depends on IIO_ST_ACCEL_3AXIS
        depends on IIO_ST_SENSORS_SPI
 
index 28406495e9d5e88dd71f1539a272e7a1d52ad829..543f0ad7fd7e383922201ab258ade3761c766f5a 100644 (file)
 
 #ifdef CONFIG_OF
 static const struct of_device_id st_accel_of_match[] = {
+       {
+               /* An older compatible */
+               .compatible = "st,lis3lv02d",
+               .data = LIS3LV02DL_ACCEL_DEV_NAME,
+       },
        {
                .compatible = "st,lis3lv02dl-accel",
                .data = LIS3LV02DL_ACCEL_DEV_NAME,
index c25ac50d4600663e3e52d02718dfb3141095e5ee..29a15f27a51bce94211ec15c8f30eabd3b631f6b 100644 (file)
@@ -65,9 +65,18 @@ static const struct spi_device_id st_accel_id_table[] = {
 };
 MODULE_DEVICE_TABLE(spi, st_accel_id_table);
 
+#ifdef CONFIG_OF
+static const struct of_device_id lis302dl_spi_dt_ids[] = {
+       { .compatible = "st,lis302dl-spi" },
+       {}
+};
+MODULE_DEVICE_TABLE(of, lis302dl_spi_dt_ids);
+#endif
+
 static struct spi_driver st_accel_driver = {
        .driver = {
                .name = "st-accel-spi",
+               .of_match_table = of_match_ptr(lis302dl_spi_dt_ids),
        },
        .probe = st_accel_spi_probe,
        .remove = st_accel_spi_remove,