Commit d0b7fea5 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Jonathan Cameron

iio: magnetometer: add support to LIS2MDL

add support to STMicroelectronics LIS2MDL magnetometer in
st_magn framework

http://www.st.com/resource/en/datasheet/lis2mdl.pdfSigned-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 3f09b8d2
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define LSM303DLM_MAGN_DEV_NAME "lsm303dlm_magn" #define LSM303DLM_MAGN_DEV_NAME "lsm303dlm_magn"
#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"
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);
......
...@@ -323,6 +323,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = { ...@@ -323,6 +323,7 @@ static const struct st_sensor_settings st_magn_sensors_settings[] = {
.wai_addr = 0x4f, .wai_addr = 0x4f,
.sensors_supported = { .sensors_supported = {
[0] = LSM303AGR_MAGN_DEV_NAME, [0] = LSM303AGR_MAGN_DEV_NAME,
[1] = LIS2MDL_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 = {
......
...@@ -40,6 +40,10 @@ static const struct of_device_id st_magn_of_match[] = { ...@@ -40,6 +40,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,lsm303agr-magn", .compatible = "st,lsm303agr-magn",
.data = LSM303AGR_MAGN_DEV_NAME, .data = LSM303AGR_MAGN_DEV_NAME,
}, },
{
.compatible = "st,lis2mdl",
.data = LIS2MDL_MAGN_DEV_NAME,
},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, st_magn_of_match); MODULE_DEVICE_TABLE(of, st_magn_of_match);
...@@ -85,6 +89,7 @@ static const struct i2c_device_id st_magn_id_table[] = { ...@@ -85,6 +89,7 @@ static const struct i2c_device_id st_magn_id_table[] = {
{ LSM303DLM_MAGN_DEV_NAME }, { LSM303DLM_MAGN_DEV_NAME },
{ LIS3MDL_MAGN_DEV_NAME }, { LIS3MDL_MAGN_DEV_NAME },
{ LSM303AGR_MAGN_DEV_NAME }, { LSM303AGR_MAGN_DEV_NAME },
{ LIS2MDL_MAGN_DEV_NAME },
{}, {},
}; };
MODULE_DEVICE_TABLE(i2c, st_magn_id_table); MODULE_DEVICE_TABLE(i2c, st_magn_id_table);
......
...@@ -33,6 +33,10 @@ static const struct of_device_id st_magn_of_match[] = { ...@@ -33,6 +33,10 @@ static const struct of_device_id st_magn_of_match[] = {
.compatible = "st,lsm303agr-magn", .compatible = "st,lsm303agr-magn",
.data = LSM303AGR_MAGN_DEV_NAME, .data = LSM303AGR_MAGN_DEV_NAME,
}, },
{
.compatible = "st,lis2mdl",
.data = LIS2MDL_MAGN_DEV_NAME,
},
{} {}
}; };
MODULE_DEVICE_TABLE(of, st_magn_of_match); MODULE_DEVICE_TABLE(of, st_magn_of_match);
...@@ -74,6 +78,7 @@ static int st_magn_spi_remove(struct spi_device *spi) ...@@ -74,6 +78,7 @@ static int st_magn_spi_remove(struct spi_device *spi)
static const struct spi_device_id st_magn_id_table[] = { 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 },
{}, {},
}; };
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