Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:magnetometer: st_magn: add LSM9DS1 support

Update the sensor settings to support the LSM9DS1 sensor. Although the
LSM9DS1 accelerometer and gyroscope are coupled together to use the same
FIFO, the magnetometer is separate and can be cleanly supported without
refactoring the existing driver.

Signed-off-by: Martin Kelly <martin@martingkelly.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Martin Kelly and committed by
Jonathan Cameron
0d92aa2c 53759e25

+12
+1
drivers/iio/magnetometer/st_magn.h
··· 20 20 #define LIS3MDL_MAGN_DEV_NAME "lis3mdl" 21 21 #define LSM303AGR_MAGN_DEV_NAME "lsm303agr_magn" 22 22 #define LIS2MDL_MAGN_DEV_NAME "lis2mdl" 23 + #define LSM9DS1_MAGN_DEV_NAME "lsm9ds1_magn" 23 24 24 25 int st_magn_common_probe(struct iio_dev *indio_dev); 25 26 void st_magn_common_remove(struct iio_dev *indio_dev);
+1
drivers/iio/magnetometer/st_magn_core.c
··· 267 267 .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, 268 268 .sensors_supported = { 269 269 [0] = LIS3MDL_MAGN_DEV_NAME, 270 + [1] = LSM9DS1_MAGN_DEV_NAME, 270 271 }, 271 272 .ch = (struct iio_chan_spec *)st_magn_2_16bit_channels, 272 273 .odr = {
+5
drivers/iio/magnetometer/st_magn_i2c.c
··· 44 44 .compatible = "st,lis2mdl", 45 45 .data = LIS2MDL_MAGN_DEV_NAME, 46 46 }, 47 + { 48 + .compatible = "st,lsm9ds1-magn", 49 + .data = LSM9DS1_MAGN_DEV_NAME, 50 + }, 47 51 {}, 48 52 }; 49 53 MODULE_DEVICE_TABLE(of, st_magn_of_match); ··· 94 90 { LIS3MDL_MAGN_DEV_NAME }, 95 91 { LSM303AGR_MAGN_DEV_NAME }, 96 92 { LIS2MDL_MAGN_DEV_NAME }, 93 + { LSM9DS1_MAGN_DEV_NAME }, 97 94 {}, 98 95 }; 99 96 MODULE_DEVICE_TABLE(i2c, st_magn_id_table);
+5
drivers/iio/magnetometer/st_magn_spi.c
··· 39 39 .compatible = "st,lis2mdl", 40 40 .data = LIS2MDL_MAGN_DEV_NAME, 41 41 }, 42 + { 43 + .compatible = "st,lsm9ds1-magn", 44 + .data = LSM9DS1_MAGN_DEV_NAME, 45 + }, 42 46 {} 43 47 }; 44 48 MODULE_DEVICE_TABLE(of, st_magn_of_match); ··· 85 81 { LIS3MDL_MAGN_DEV_NAME }, 86 82 { LSM303AGR_MAGN_DEV_NAME }, 87 83 { LIS2MDL_MAGN_DEV_NAME }, 84 + { LSM9DS1_MAGN_DEV_NAME }, 88 85 {}, 89 86 }; 90 87 MODULE_DEVICE_TABLE(spi, st_magn_id_table);