Commit c71cfe55 authored by LI Qingwu's avatar LI Qingwu Committed by Jonathan Cameron

iio:magnetometer: Add Support for ST IIS2MDC

Add support for ST magnetometer IIS2MDC,
an I2C/SPI interface 3-axis magnetometer.
The patch was tested on the instrument with IIS2MDC via I2C interface.
Signed-off-by: default avatarLI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Link: https://lore.kernel.org/r/20210317063902.19300-3-Qing-wu.Li@leica-geosystems.com.cnSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent ac62f90c
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#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" #define LSM9DS1_MAGN_DEV_NAME "lsm9ds1_magn"
#define IIS2MDC_MAGN_DEV_NAME "iis2mdc"
const struct st_sensor_settings *st_magn_get_settings(const char *name); const struct st_sensor_settings *st_magn_get_settings(const char *name);
int st_magn_common_probe(struct iio_dev *indio_dev); int st_magn_common_probe(struct iio_dev *indio_dev);
......
...@@ -337,6 +337,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { ...@@ -337,6 +337,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
.sensors_supported = { .sensors_supported = {
[0] = LSM303AGR_MAGN_DEV_NAME, [0] = LSM303AGR_MAGN_DEV_NAME,
[1] = LIS2MDL_MAGN_DEV_NAME, [1] = LIS2MDL_MAGN_DEV_NAME,
[2] = IIS2MDC_MAGN_DEV_NAME,
}, },
.ch = (struct iio_chan_spec *)st_magn_3_16bit_channels, .ch = (struct iio_chan_spec *)st_magn_3_16bit_channels,
.odr = { .odr = {
......
...@@ -46,6 +46,10 @@ static const struct of_device_id st_magn_of_match[] = { ...@@ -46,6 +46,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,lsm9ds1-magn", .compatible = "st,lsm9ds1-magn",
.data = LSM9DS1_MAGN_DEV_NAME, .data = LSM9DS1_MAGN_DEV_NAME,
}, },
{
.compatible = "st,iis2mdc",
.data = IIS2MDC_MAGN_DEV_NAME,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_magn_of_match); MODULE_DEVICE_TABLE(of, st_magn_of_match);
...@@ -101,6 +105,7 @@ static const struct i2c_device_id st_magn_id_table[] = { ...@@ -101,6 +105,7 @@ static const struct i2c_device_id st_magn_id_table[] = {
{ LSM303AGR_MAGN_DEV_NAME }, { LSM303AGR_MAGN_DEV_NAME },
{ LIS2MDL_MAGN_DEV_NAME }, { LIS2MDL_MAGN_DEV_NAME },
{ LSM9DS1_MAGN_DEV_NAME }, { LSM9DS1_MAGN_DEV_NAME },
{ IIS2MDC_MAGN_DEV_NAME },
{}, {},
}; };
MODULE_DEVICE_TABLE(i2c, st_magn_id_table); MODULE_DEVICE_TABLE(i2c, st_magn_id_table);
......
...@@ -41,6 +41,10 @@ static const struct of_device_id st_magn_of_match[] = { ...@@ -41,6 +41,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,lsm9ds1-magn", .compatible = "st,lsm9ds1-magn",
.data = LSM9DS1_MAGN_DEV_NAME, .data = LSM9DS1_MAGN_DEV_NAME,
}, },
{
.compatible = "st,iis2mdc",
.data = IIS2MDC_MAGN_DEV_NAME,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, st_magn_of_match); MODULE_DEVICE_TABLE(of, st_magn_of_match);
...@@ -92,6 +96,7 @@ static const struct spi_device_id st_magn_id_table[] = { ...@@ -92,6 +96,7 @@ static const struct spi_device_id st_magn_id_table[] = {
{ LSM303AGR_MAGN_DEV_NAME }, { LSM303AGR_MAGN_DEV_NAME },
{ LIS2MDL_MAGN_DEV_NAME }, { LIS2MDL_MAGN_DEV_NAME },
{ LSM9DS1_MAGN_DEV_NAME }, { LSM9DS1_MAGN_DEV_NAME },
{ IIS2MDC_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