linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jimmy Assarsson <jimmyassarsson@gmail.com>
To: linux-iio@vger.kernel.org
Cc: Lorenzo Bianconi <lorenzo@kernel.org>
Subject: [PATCH 2/2] iio: imu: st_lsm6dsx: Add sensor hub device LIS3MDL
Date: Tue, 24 Mar 2020 22:52:26 +0100	[thread overview]
Message-ID: <20200324215226.1711659-2-jimmyassarsson@gmail.com> (raw)
In-Reply-To: <20200324215226.1711659-1-jimmyassarsson@gmail.com>

Add LIS3MDL register map to sensor hub device table.
Tested with LSM6DSM.

Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 63 ++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
index 95ddd19d1aa7..20fdef7a6ea2 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c
@@ -88,6 +88,69 @@ static const struct st_lsm6dsx_ext_dev_settings st_lsm6dsx_ext_dev_table[] = {
 			.len = 6,
 		},
 	},
+	/* LIS3MDL */
+	{
+		.i2c_addr = { 0x1e },
+		.wai = {
+			.addr = 0x0f,
+			.val = 0x3d,
+		},
+		.id = ST_LSM6DSX_ID_MAGN,
+		.odr_table = {
+			.reg = {
+				.addr = 0x20,
+				.mask = GENMASK(4, 2),
+			},
+			.odr_avl[0] = {  1000, 0x0 },
+			.odr_avl[1] = {  2000, 0x1 },
+			.odr_avl[2] = {  3000, 0x2 },
+			.odr_avl[3] = {  5000, 0x3 },
+			.odr_avl[4] = { 10000, 0x4 },
+			.odr_avl[5] = { 20000, 0x5 },
+			.odr_avl[6] = { 40000, 0x6 },
+			.odr_avl[7] = { 80000, 0x7 },
+			.odr_len = 8,
+		},
+		.fs_table = {
+			.reg = {
+				.addr = 0x21,
+				.mask = GENMASK(6, 5),
+			},
+			.fs_avl[0] = {
+				.gain = 146,
+				.val = 0x00,
+			}, /* 4000 uG/LSB */
+			.fs_avl[1] = {
+				.gain = 292,
+				.val = 0x01,
+			}, /* 8000 uG/LSB */
+			.fs_avl[2] = {
+				.gain = 438,
+				.val = 0x02,
+			}, /* 12000 uG/LSB */
+			.fs_avl[3] = {
+				.gain = 584,
+				.val = 0x03,
+			}, /* 16000 uG/LSB */
+			.fs_len = 4,
+		},
+		.pwr_table = {
+			.reg = {
+				.addr = 0x22,
+				.mask = GENMASK(1, 0),
+			},
+			.off_val = 0x2,
+			.on_val = 0x0,
+		},
+		.bdu = {
+			.addr = 0x24,
+			.mask = BIT(6),
+		},
+		.out = {
+			.addr = 0x28,
+			.len = 6,
+		},
+	},
 };
 
 static void st_lsm6dsx_shub_wait_complete(struct st_lsm6dsx_hw *hw)
-- 
2.25.0


  reply	other threads:[~2020-03-24 21:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 21:52 [PATCH 1/2] iio: imu: st_lsm6dsx: Increase ODR_LIST_SIZE Jimmy Assarsson
2020-03-24 21:52 ` Jimmy Assarsson [this message]
2020-03-24 21:58   ` [PATCH 2/2] iio: imu: st_lsm6dsx: Add sensor hub device LIS3MDL Jimmy Assarsson
2020-03-25 11:02     ` Andy Shevchenko
2020-03-25 18:57       ` Jimmy Assarsson
2020-04-04 15:36 ` [PATCH 1/2] iio: imu: st_lsm6dsx: Increase ODR_LIST_SIZE Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200324215226.1711659-2-jimmyassarsson@gmail.com \
    --to=jimmyassarsson@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).