Commit 0d92aa2c authored by Martin Kelly's avatar Martin Kelly Committed by Jonathan Cameron

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: default avatarMartin Kelly <martin@martingkelly.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 53759e25
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define LIS3MDL_MAGN_DEV_NAME "lis3mdl" #define LIS3MDL_MAGN_DEV_NAME "lis3mdl"
#define LSM303AGR_MAGN_DEV_NAME "lsm303agr_magn" #define LSM303AGR_MAGN_DEV_NAME "lsm303agr_magn"
#define LIS2MDL_MAGN_DEV_NAME "lis2mdl" #define LIS2MDL_MAGN_DEV_NAME "lis2mdl"
#define LSM9DS1_MAGN_DEV_NAME "lsm9ds1_magn"
int st_magn_common_probe(struct iio_dev *indio_dev); int st_magn_common_probe(struct iio_dev *indio_dev);
void st_magn_common_remove(struct iio_dev *indio_dev); void st_magn_common_remove(struct iio_dev *indio_dev);
......
...@@ -267,6 +267,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { ...@@ -267,6 +267,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
.wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
.sensors_supported = { .sensors_supported = {
[0] = LIS3MDL_MAGN_DEV_NAME, [0] = LIS3MDL_MAGN_DEV_NAME,
[1] = LSM9DS1_MAGN_DEV_NAME,
}, },
.ch = (struct iio_chan_spec *)st_magn_2_16bit_channels, .ch = (struct iio_chan_spec *)st_magn_2_16bit_channels,
.odr = { .odr = {
......
...@@ -44,6 +44,10 @@ static const struct of_device_id st_magn_of_match[] = { ...@@ -44,6 +44,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,lis2mdl", .compatible = "st,lis2mdl",
.data = LIS2MDL_MAGN_DEV_NAME, .data = LIS2MDL_MAGN_DEV_NAME,
}, },
{
.compatible = "st,lsm9ds1-magn",
.data = LSM9DS1_MAGN_DEV_NAME,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_magn_of_match); MODULE_DEVICE_TABLE(of, st_magn_of_match);
...@@ -90,6 +94,7 @@ static const struct i2c_device_id st_magn_id_table[] = { ...@@ -90,6 +94,7 @@ static const struct i2c_device_id st_magn_id_table[] = {
{ LIS3MDL_MAGN_DEV_NAME }, { LIS3MDL_MAGN_DEV_NAME },
{ LSM303AGR_MAGN_DEV_NAME }, { LSM303AGR_MAGN_DEV_NAME },
{ LIS2MDL_MAGN_DEV_NAME }, { LIS2MDL_MAGN_DEV_NAME },
{ LSM9DS1_MAGN_DEV_NAME },
{}, {},
}; };
MODULE_DEVICE_TABLE(i2c, st_magn_id_table); MODULE_DEVICE_TABLE(i2c, st_magn_id_table);
......
...@@ -39,6 +39,10 @@ static const struct of_device_id st_magn_of_match[] = { ...@@ -39,6 +39,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,lis2mdl", .compatible = "st,lis2mdl",
.data = LIS2MDL_MAGN_DEV_NAME, .data = LIS2MDL_MAGN_DEV_NAME,
}, },
{
.compatible = "st,lsm9ds1-magn",
.data = LSM9DS1_MAGN_DEV_NAME,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, st_magn_of_match); MODULE_DEVICE_TABLE(of, st_magn_of_match);
...@@ -81,6 +85,7 @@ static const struct spi_device_id st_magn_id_table[] = { ...@@ -81,6 +85,7 @@ static const struct spi_device_id st_magn_id_table[] = {
{ LIS3MDL_MAGN_DEV_NAME }, { LIS3MDL_MAGN_DEV_NAME },
{ LSM303AGR_MAGN_DEV_NAME }, { LSM303AGR_MAGN_DEV_NAME },
{ LIS2MDL_MAGN_DEV_NAME }, { LIS2MDL_MAGN_DEV_NAME },
{ LSM9DS1_MAGN_DEV_NAME },
{}, {},
}; };
MODULE_DEVICE_TABLE(spi, st_magn_id_table); MODULE_DEVICE_TABLE(spi, st_magn_id_table);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment