]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iio: gyro: st_gyro: fix L3GD20H support
authorLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Mon, 19 Jun 2017 20:04:30 +0000 (22:04 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sat, 1 Jul 2017 09:16:37 +0000 (10:16 +0100)
Add proper support for L3GD20H gyroscope sensor. In particular:
- use L3GD20H as device name instead of L3GD20
- fix available full scales
- fix available sample frequencies

Note that the original patch listed first below introduced broken support for
this part.  The second patch drops the support as it didn't work.

This new patch brings in working support.

Fixes: 9444a300c2be (IIO: Add support for L3GD20H gyroscope)
Fixes: a0657716416f ("iio:gyro: bug on L3GD20H gyroscope support")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/gyro/st_gyro.h
drivers/iio/gyro/st_gyro_core.c
drivers/iio/gyro/st_gyro_i2c.c
drivers/iio/gyro/st_gyro_spi.c

index a5c5c4e29addc38a94c4a5683f64904550ed32d2..48923ae6ac3bd04051e1640f31c65302bf38bf8a 100644 (file)
@@ -19,6 +19,7 @@
 #define LSM330DL_GYRO_DEV_NAME         "lsm330dl_gyro"
 #define LSM330DLC_GYRO_DEV_NAME                "lsm330dlc_gyro"
 #define L3GD20_GYRO_DEV_NAME           "l3gd20"
+#define L3GD20H_GYRO_DEV_NAME          "l3gd20h"
 #define L3G4IS_GYRO_DEV_NAME           "l3g4is_ui"
 #define LSM330_GYRO_DEV_NAME           "lsm330_gyro"
 #define LSM9DS0_GYRO_DEV_NAME          "lsm9ds0_gyro"
index 2a42b3d583e85b45d9f93c9b1400e8551eac034a..e366422e85127f27f2ab1df6a47019755af8d52d 100644 (file)
@@ -35,6 +35,7 @@
 #define ST_GYRO_DEFAULT_OUT_Z_L_ADDR           0x2c
 
 /* FULLSCALE */
+#define ST_GYRO_FS_AVL_245DPS                  245
 #define ST_GYRO_FS_AVL_250DPS                  250
 #define ST_GYRO_FS_AVL_500DPS                  500
 #define ST_GYRO_FS_AVL_2000DPS                 2000
@@ -196,17 +197,17 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
                .wai = 0xd7,
                .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
                .sensors_supported = {
-                       [0] = L3GD20_GYRO_DEV_NAME,
+                       [0] = L3GD20H_GYRO_DEV_NAME,
                },
                .ch = (struct iio_chan_spec *)st_gyro_16bit_channels,
                .odr = {
                        .addr = 0x20,
                        .mask = 0xc0,
                        .odr_avl = {
-                               { .hz = 95, .value = 0x00, },
-                               { .hz = 190, .value = 0x01, },
-                               { .hz = 380, .value = 0x02, },
-                               { .hz = 760, .value = 0x03, },
+                               { .hz = 100, .value = 0x00, },
+                               { .hz = 200, .value = 0x01, },
+                               { .hz = 400, .value = 0x02, },
+                               { .hz = 800, .value = 0x03, },
                        },
                },
                .pw = {
@@ -224,7 +225,7 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
                        .mask = 0x30,
                        .fs_avl = {
                                [0] = {
-                                       .num = ST_GYRO_FS_AVL_250DPS,
+                                       .num = ST_GYRO_FS_AVL_245DPS,
                                        .value = 0x00,
                                        .gain = IIO_DEGREE_TO_RAD(8750),
                                },
index 40056b82103640b467db0c10733555476928aaec..3f628746cb93e411685140056c44f55d9ba28eee 100644 (file)
@@ -40,6 +40,10 @@ static const struct of_device_id st_gyro_of_match[] = {
                .compatible = "st,l3gd20-gyro",
                .data = L3GD20_GYRO_DEV_NAME,
        },
+       {
+               .compatible = "st,l3gd20h-gyro",
+               .data = L3GD20H_GYRO_DEV_NAME,
+       },
        {
                .compatible = "st,l3g4is-gyro",
                .data = L3G4IS_GYRO_DEV_NAME,
@@ -95,6 +99,7 @@ static const struct i2c_device_id st_gyro_id_table[] = {
        { LSM330DL_GYRO_DEV_NAME },
        { LSM330DLC_GYRO_DEV_NAME },
        { L3GD20_GYRO_DEV_NAME },
+       { L3GD20H_GYRO_DEV_NAME },
        { L3G4IS_GYRO_DEV_NAME },
        { LSM330_GYRO_DEV_NAME },
        { LSM9DS0_GYRO_DEV_NAME },
index fbf2faed501c8628ed23d0ff0fa7590f6e091c01..fa14d8f2170d71018ab47e6ae7bfcaad303b3486 100644 (file)
@@ -52,6 +52,7 @@ static const struct spi_device_id st_gyro_id_table[] = {
        { LSM330DL_GYRO_DEV_NAME },
        { LSM330DLC_GYRO_DEV_NAME },
        { L3GD20_GYRO_DEV_NAME },
+       { L3GD20H_GYRO_DEV_NAME },
        { L3G4IS_GYRO_DEV_NAME },
        { LSM330_GYRO_DEV_NAME },
        { LSM9DS0_GYRO_DEV_NAME },