Skip to content

Commit 394dede

Browse files
jassarssonjic23
authored andcommitted
iio: imu: st_lsm6dsx: Add sensor hub device LIS3MDL
Add LIS3MDL register map to sensor hub device table. Tested with LSM6DSM. Signed-off-by: Jimmy Assarsson <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent a0e35e2 commit 394dede

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/iio/sysfs.h>
2929
#include <linux/bitfield.h>
3030

31+
#include <linux/iio/common/st_sensors.h>
3132
#include "st_lsm6dsx.h"
3233

3334
#define ST_LSM6DSX_SLV_ADDR(n, base) ((base) + (n) * 3)
@@ -88,6 +89,69 @@ static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = {
8889
.len = 6,
8990
},
9091
},
92+
/* LIS3MDL */
93+
{
94+
.i2c_addr = { 0x1e },
95+
.wai = {
96+
.addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
97+
.val = 0x3d,
98+
},
99+
.id = ST_LSM6DSX_ID_MAGN,
100+
.odr_table = {
101+
.reg = {
102+
.addr = 0x20,
103+
.mask = GENMASK(4, 2),
104+
},
105+
.odr_avl[0] = { 1000, 0x0 },
106+
.odr_avl[1] = { 2000, 0x1 },
107+
.odr_avl[2] = { 3000, 0x2 },
108+
.odr_avl[3] = { 5000, 0x3 },
109+
.odr_avl[4] = { 10000, 0x4 },
110+
.odr_avl[5] = { 20000, 0x5 },
111+
.odr_avl[6] = { 40000, 0x6 },
112+
.odr_avl[7] = { 80000, 0x7 },
113+
.odr_len = 8,
114+
},
115+
.fs_table = {
116+
.reg = {
117+
.addr = 0x21,
118+
.mask = GENMASK(6, 5),
119+
},
120+
.fs_avl[0] = {
121+
.gain = 146,
122+
.val = 0x00,
123+
}, /* 4000 uG/LSB */
124+
.fs_avl[1] = {
125+
.gain = 292,
126+
.val = 0x01,
127+
}, /* 8000 uG/LSB */
128+
.fs_avl[2] = {
129+
.gain = 438,
130+
.val = 0x02,
131+
}, /* 12000 uG/LSB */
132+
.fs_avl[3] = {
133+
.gain = 584,
134+
.val = 0x03,
135+
}, /* 16000 uG/LSB */
136+
.fs_len = 4,
137+
},
138+
.pwr_table = {
139+
.reg = {
140+
.addr = 0x22,
141+
.mask = GENMASK(1, 0),
142+
},
143+
.off_val = 0x2,
144+
.on_val = 0x0,
145+
},
146+
.bdu = {
147+
.addr = 0x24,
148+
.mask = BIT(6),
149+
},
150+
.out = {
151+
.addr = 0x28,
152+
.len = 6,
153+
},
154+
},
91155
};
92156

93157
static void st_lsm6dsx_shub_wait_complete(struct st_lsm6dsx_hw *hw)

0 commit comments

Comments
 (0)