Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp413031ybi; Mon, 15 Jul 2019 23:11:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUMYBupaA/B6AHKeXfDq8SOZPlE0acDJxUMXx7aHaapTKbPAwZxLQPRIF6q/Xx448U89E+ X-Received: by 2002:a17:902:3081:: with SMTP id v1mr33757162plb.169.1563257470073; Mon, 15 Jul 2019 23:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563257470; cv=none; d=google.com; s=arc-20160816; b=tdOCLZdH0YIuJ/ZKC1Ht7OfpgsqCsebS3Yz9FSe4udb3EASFsr1IK5jLlqyDlFgzER IZrouxenJko8M5DjY8PKmQb0P3vKlUtb2CErADQO7Ot9aelhAIdoWX6/i0bd/sb5EDFw NWyTDscdr5PHubZbGaC2Woi7jMNPDW4V78+P5RwgJK+S9xzOOkER+9SJNmmFUbYeHdIA DEl+/fbc4OC2FOqXQcWVP/p+f/uQMgsYfzQOEf1XSp8Qbd5aEX1W+p4+ABH2VOsmP3Kp xWFrvuiR8HKo7C+/w+fFFgR328F+opUsobfGQS2WeJoC57VpN/KwBsWudorNyhP5U5wq ehvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:autocrypt :openpgp:from:references:cc:to:subject; bh=WCMxT5UWQePPzS8gzqfTp14H1al531TDlbi9TtYCaD4=; b=qBi7oYNLwl2TQbcNRnvn7OxG845tTvyjclKlTMSQQEwG+0frYC2DNA73XD9vq8rM5h tQZJDPGSHI/kK5kwkrLhF7njchVuRXiSHX0PB5mfrR2Ty8MXT1L9aAjx39IpOFFDnD3e PMvzJktWQDkpA0A7u0kuQFCA6NZ0UAY07yKK/L62rx+DHz8L+BgGFPMszjDo6KBS7+N1 UhgcS7kBpo2bOXHPXqhHEXVAj4kDU0wpa+q3QlzmR1gNATtd8issQV034VPyCgX6/OIw b55yLZSAM9P1MZRZsJy3wLAZ3CquyZVkC7DkTM1nJtEplTTyyd/BQitx1mAOW7EDwvaf 8Lsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si17847019plo.193.2019.07.15.23.10.53; Mon, 15 Jul 2019 23:11:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731702AbfGPGKe (ORCPT + 99 others); Tue, 16 Jul 2019 02:10:34 -0400 Received: from comms.puri.sm ([159.203.221.185]:39998 "EHLO comms.puri.sm" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726315AbfGPGKd (ORCPT ); Tue, 16 Jul 2019 02:10:33 -0400 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id E1050DFFDB; Mon, 15 Jul 2019 23:10:30 -0700 (PDT) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m51qG9iD3rqM; Mon, 15 Jul 2019 23:10:29 -0700 (PDT) Subject: Re: [PATCH 2/3] iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9sd1 To: Lorenzo Bianconi Cc: lorenzo.bianconi83@gmail.com, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190715131919.31938-1-martin.kepplinger@puri.sm> <20190715131919.31938-2-martin.kepplinger@puri.sm> <20190715214920.GB23126@localhost.localdomain> From: Martin Kepplinger Openpgp: preference=signencrypt Autocrypt: addr=martin.kepplinger@puri.sm; keydata= mQINBFULfZABEADRxJqDOYAHfrp1w8Egcv88qoru37k1x0Ugy8S6qYtKLAAt7boZW+q5gPv3 Sj2KjfkWA7gotXpASN21OIfE/puKGwhDLAySY1DGNMQ0gIVakUO0ji5GJPjeB9JlmN5hbA87 Si9k3yKQQfv7Cf9Lr1iZaV4A4yjLP/JQMImaCVdC5KyqJ98Luwci1GbsLIGX3EEjfg1+MceO dnJTKZpBAKd1J7S2Ib3dRwvALdiD7zqMGqkw5xrtwasatS7pc6o/BFgA9GxbeIzKmvW/hc3Q amS/sB12BojyzdUJ3TnIoAqvwKTGcv5VYo2Z+3FV+/MJVXPo8cj2vmfxQx1WG4n6X0pK4X8A BkCKw2N/evMZblNqAzzGVtoJvqQYkzQ20Fm+d3wFl6lS1db4MB+kU13G8kEIE22Q3i6kx4NA N49FLlPeDabGfJUyDaZp5pmKdcd7/FIGH/HjShjx7g+LKSwWNMkDygr4WARAP4h8zYDZuNqe ofPvMLqJxHeexBPIGF/+OwMyTvM7otP5ODuFmq6OqjNPf1irJmkiFv3yEa+Ip0vZzwl4XvrZ U0IKjSy2rbRLg22NsJT0XVZJbutIXYSvIHGqSxzzfiOOLnRjR++fbeEoVlRJ4NZHDKCh3pJv LNd+j03jXr4Rm058YLgO7164yr7FhMZniBJw6z648rk8/8gGPQARAQABtC1NYXJ0aW4gS2Vw cGxpbmdlciA8bWFydGluLmtlcHBsaW5nZXJAcHVyaS5zbT6JAk4EEwEIADgWIQTyCCuID55C OTRobj9QA5jfWrOH0wUCXPSlkwIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRBQA5jf W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RG8Nxma/hJwwu1zRNsFK55Q/8Nlukc1WI1U+iF+EmpjZVfjFl9P9X2ArrX6mZfOgUipiY 5VqX5Dys8s44RkFWa02WJygLuO9YUb/P+g8eSbmSYAwp2Gpzcdww63kTLv56uk32jnpDLcYD WG//KA68tPVBR2xhy7Fp+qAa Message-ID: <27b18ff1-6970-e473-d118-fd7878eda7a6@puri.sm> Date: Tue, 16 Jul 2019 08:10:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 In-Reply-To: <20190715214920.GB23126@localhost.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.07.19 23:49, Lorenzo Bianconi wrote: >> The LSM9DS1's accelerometer / gyroscope unit and it's magnetometer (separately >> supported in iio/magnetometer/st_magn*) are located on a separate i2c addresses >> on the bus. >> >> For the datasheet, see https://www.st.com/resource/en/datasheet/lsm9ds1.pdf >> >> Treat it just like the LSM6* devices and, despite it's name, hook it up >> to the st_lsm6dsx driver, using it's basic functionality. >> >> Signed-off-by: Martin Kepplinger >> --- >> >> What do you think about an addition like this? How confusing is it to support >> an LSM9 module by the lsm6 driver, despite it's name? It requires almost no >> code, so why not think about it, right? > > I am fine with (it was on my ToDo list, so thanks for working on this). > I have just posted the following series that will help you adding support for > LSM9DS1 > https://patchwork.kernel.org/cover/11045061/ > I think you just need to take care of gyro channels allocating iio devices (you > probably need to pass hw_id to st_lsm6dsx_alloc_iiodev()) yes. I'll look over allocation once more. > >> >> Oh, I'm not 100% convinced by my new "if" in probe(), but even that is >> not too confusing I guess. >> >> thanks, >> >> martin >> >> p.s.: todos: >> * hook up the fifo / buffer / trigger functionality, >> * (off-topic a bit) move the (currently strange) gyro-only support >> for lsm9ds0 to this driver as well. > > Regarding FIFO I guess it is enough to set decimator factor to 1 for both accel > and gyro. > > Regards, > Lorenzo > >> >> >> >> drivers/iio/imu/st_lsm6dsx/Kconfig | 3 +- >> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 4 + >> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 105 ++++++++++++++++++- >> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c | 5 + >> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c | 5 + >> 5 files changed, 117 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/iio/imu/st_lsm6dsx/Kconfig b/drivers/iio/imu/st_lsm6dsx/Kconfig >> index 002a423eae52..0b5a568e4c16 100644 >> --- a/drivers/iio/imu/st_lsm6dsx/Kconfig >> +++ b/drivers/iio/imu/st_lsm6dsx/Kconfig >> @@ -10,7 +10,8 @@ config IIO_ST_LSM6DSX >> help >> Say yes here to build support for STMicroelectronics LSM6DSx imu >> sensor. Supported devices: lsm6ds3, lsm6ds3h, lsm6dsl, lsm6dsm, >> - ism330dlc, lsm6dso, lsm6dsox, asm330lhh, lsm6dsr >> + ism330dlc, lsm6dso, lsm6dsox, asm330lhh, lsm6dsr and the >> + accelerometer/gyroscope of lsm9ds1. >> >> To compile this driver as a module, choose M here: the module >> will be called st_lsm6dsx. >> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h >> index f072ac14f213..8af9641260fa 100644 >> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h >> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h >> @@ -22,6 +22,7 @@ >> #define ST_ASM330LHH_DEV_NAME "asm330lhh" >> #define ST_LSM6DSOX_DEV_NAME "lsm6dsox" >> #define ST_LSM6DSR_DEV_NAME "lsm6dsr" >> +#define ST_LSM9DS1_DEV_NAME "lsm9ds1" >> >> enum st_lsm6dsx_hw_id { >> ST_LSM6DS3_ID, >> @@ -33,6 +34,7 @@ enum st_lsm6dsx_hw_id { >> ST_ASM330LHH_ID, >> ST_LSM6DSOX_ID, >> ST_LSM6DSR_ID, >> + ST_LSM9DS1_ID, >> ST_LSM6DSX_MAX_ID, >> }; >> >> @@ -230,6 +232,8 @@ enum st_lsm6dsx_sensor_id { >> ST_LSM6DSX_ID_EXT0, >> ST_LSM6DSX_ID_EXT1, >> ST_LSM6DSX_ID_EXT2, >> + ST_LSM9DSX_ID_GYRO, >> + ST_LSM9DSX_ID_ACC, >> ST_LSM6DSX_ID_MAX, >> }; >> >> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c >> index 7a4fe70a8f20..6acfe63073de 100644 >> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c >> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c >> @@ -10,6 +10,8 @@ >> * +-125/+-245/+-500/+-1000/+-2000 dps >> * LSM6DSx series has an integrated First-In-First-Out (FIFO) buffer >> * allowing dynamic batching of sensor data. >> + * LSM9DSx series is similar but includes an additional magnetometer, handled >> + * by a different driver. >> * >> * Supported sensors: >> * - LSM6DS3: >> @@ -30,6 +32,13 @@ >> * - Gyroscope supported full-scale [dps]: +-125/+-245/+-500/+-1000/+-2000 >> * - FIFO size: 3KB >> * >> + * - LSM9DS1: >> + * - Accelerometer supported ODR [Hz]: 10, 50, 119, 238, 476, 952 >> + * - Accelerometer supported full-scale [g]: +-2/+-4/+-8/+-16 >> + * - Gyroscope supported ODR [Hz]: 15, 60, 119, 238, 476, 952 >> + * - Gyroscope supported full-scale [dps]: +-245/+-500/+-2000 >> + * - FIFO size: 32 >> + * >> * Copyright 2016 STMicroelectronics Inc. >> * >> * Lorenzo Bianconi >> @@ -64,6 +73,10 @@ >> #define ST_LSM6DSX_REG_GYRO_OUT_Y_L_ADDR 0x24 >> #define ST_LSM6DSX_REG_GYRO_OUT_Z_L_ADDR 0x26 >> >> +#define ST_LSM9DSX_REG_GYRO_OUT_X_L_ADDR 0x18 >> +#define ST_LSM9DSX_REG_GYRO_OUT_Y_L_ADDR 0x1a >> +#define ST_LSM9DSX_REG_GYRO_OUT_Z_L_ADDR 0x1c >> + >> static const struct st_lsm6dsx_odr_table_entry st_lsm6dsx_odr_table[] = { >> [ST_LSM6DSX_ID_ACC] = { >> .reg = { >> @@ -88,6 +101,30 @@ static const struct st_lsm6dsx_odr_table_entry st_lsm6dsx_odr_table[] = { >> .odr_avl[3] = { 104, 0x04 }, >> .odr_avl[4] = { 208, 0x05 }, >> .odr_avl[5] = { 416, 0x06 }, >> + }, >> + [ST_LSM9DSX_ID_ACC] = { >> + .reg = { >> + .addr = 0x20, >> + .mask = GENMASK(7, 5), >> + }, >> + .odr_avl[0] = { 10, 0x01 }, >> + .odr_avl[1] = { 50, 0x02 }, >> + .odr_avl[2] = { 119, 0x03 }, >> + .odr_avl[3] = { 238, 0x04 }, >> + .odr_avl[4] = { 476, 0x05 }, >> + .odr_avl[5] = { 952, 0x06 }, >> + }, >> + [ST_LSM9DSX_ID_GYRO] = { >> + .reg = { >> + .addr = 0x10, >> + .mask = GENMASK(7, 5), >> + }, >> + .odr_avl[0] = { 15, 0x01 }, >> + .odr_avl[1] = { 60, 0x02 }, >> + .odr_avl[2] = { 119, 0x03 }, >> + .odr_avl[3] = { 238, 0x04 }, >> + .odr_avl[4] = { 476, 0x05 }, >> + .odr_avl[5] = { 952, 0x06 }, >> } >> }; >> >> @@ -111,10 +148,43 @@ static const struct st_lsm6dsx_fs_table_entry st_lsm6dsx_fs_table[] = { >> .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, >> .fs_avl[2] = { IIO_DEGREE_TO_RAD(35000), 0x2 }, >> .fs_avl[3] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, >> + }, >> + [ST_LSM9DSX_ID_ACC] = { >> + .reg = { >> + .addr = 0x20, >> + .mask = GENMASK(4, 3), >> + }, >> + .fs_avl[0] = { 599, 0x0 }, >> + .fs_avl[1] = { 1197, 0x2 }, >> + .fs_avl[2] = { 2394, 0x3 }, >> + .fs_avl[3] = { 4788, 0x1 }, >> + }, >> + [ST_LSM9DSX_ID_GYRO] = { >> + .reg = { >> + .addr = 0x10, >> + .mask = GENMASK(4, 3), >> + }, >> + .fs_avl[0] = { IIO_DEGREE_TO_RAD(245), 0x0 }, >> + .fs_avl[1] = { IIO_DEGREE_TO_RAD(500), 0x1 }, >> + .fs_avl[2] = { IIO_DEGREE_TO_RAD(0), 0x2 }, >> + .fs_avl[3] = { IIO_DEGREE_TO_RAD(2000), 0x3 }, >> } >> }; >> >> static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { >> + { >> + .wai = 0x68, >> + .reg_int1_addr = 0x0c, >> + .reg_int2_addr = 0x0d, >> + .reg_reset_addr = 0x22, >> + .max_fifo_size = 32, >> + .id = { >> + { >> + .hw_id = ST_LSM9DS1_ID, >> + .name = ST_LSM9DS1_DEV_NAME, >> + }, >> + }, >> + }, >> { >> .wai = 0x69, >> .reg_int1_addr = 0x0d, >> @@ -492,6 +562,16 @@ static const struct iio_chan_spec st_lsm6dsx_gyro_channels[] = { >> IIO_CHAN_SOFT_TIMESTAMP(3), >> }; >> >> +static const struct iio_chan_spec st_lsm9dsx_gyro_channels[] = { >> + ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, ST_LSM9DSX_REG_GYRO_OUT_X_L_ADDR, >> + IIO_MOD_X, 0), >> + ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, ST_LSM9DSX_REG_GYRO_OUT_Y_L_ADDR, >> + IIO_MOD_Y, 1), >> + ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, ST_LSM9DSX_REG_GYRO_OUT_Z_L_ADDR, >> + IIO_MOD_Z, 2), >> + IIO_CHAN_SOFT_TIMESTAMP(3), >> +}; >> + >> int st_lsm6dsx_set_page(struct st_lsm6dsx_hw *hw, bool enable) >> { >> const struct st_lsm6dsx_shub_settings *hub_settings; >> @@ -1056,6 +1136,7 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw, >> >> switch (id) { >> case ST_LSM6DSX_ID_ACC: >> + case ST_LSM9DSX_ID_ACC: >> iio_dev->channels = st_lsm6dsx_acc_channels; >> iio_dev->num_channels = ARRAY_SIZE(st_lsm6dsx_acc_channels); >> iio_dev->info = &st_lsm6dsx_acc_info; >> @@ -1068,6 +1149,14 @@ static struct iio_dev *st_lsm6dsx_alloc_iiodev(struct st_lsm6dsx_hw *hw, >> iio_dev->num_channels = ARRAY_SIZE(st_lsm6dsx_gyro_channels); >> iio_dev->info = &st_lsm6dsx_gyro_info; >> >> + scnprintf(sensor->name, sizeof(sensor->name), "%s_gyro", >> + name); >> + break; >> + case ST_LSM9DSX_ID_GYRO: >> + iio_dev->channels = st_lsm9dsx_gyro_channels; >> + iio_dev->num_channels = ARRAY_SIZE(st_lsm9dsx_gyro_channels); >> + iio_dev->info = &st_lsm6dsx_gyro_info; >> + >> scnprintf(sensor->name, sizeof(sensor->name), "%s_gyro", >> name); >> break; >> @@ -1109,10 +1198,18 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, >> if (err < 0) >> return err; >> >> - for (i = 0; i < ST_LSM6DSX_ID_EXT0; i++) { >> - hw->iio_devs[i] = st_lsm6dsx_alloc_iiodev(hw, i, name); >> - if (!hw->iio_devs[i]) >> - return -ENOMEM; >> + if (hw_id == ST_LSM9DS1_ID) { >> + for (i = ST_LSM9DSX_ID_GYRO; i <= ST_LSM9DSX_ID_ACC; i++) { >> + hw->iio_devs[i] = st_lsm6dsx_alloc_iiodev(hw, i, name); >> + if (!hw->iio_devs[i]) >> + return -ENOMEM; >> + } >> + } else { >> + for (i = 0; i < ST_LSM6DSX_ID_EXT0; i++) { >> + hw->iio_devs[i] = st_lsm6dsx_alloc_iiodev(hw, i, name); >> + if (!hw->iio_devs[i]) >> + return -ENOMEM; >> + } >> } >> >> err = st_lsm6dsx_init_device(hw); >> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c >> index b3211e0ac07b..a684e7db1299 100644 >> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c >> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c >> @@ -75,6 +75,10 @@ static const struct of_device_id st_lsm6dsx_i2c_of_match[] = { >> .compatible = "st,lsm6dsr", >> .data = (void *)ST_LSM6DSR_ID, >> }, >> + { >> + .compatible = "st,lsm9ds1", >> + .data = (void *)ST_LSM9DS1_ID, >> + }, >> {}, >> }; >> MODULE_DEVICE_TABLE(of, st_lsm6dsx_i2c_of_match); >> @@ -89,6 +93,7 @@ static const struct i2c_device_id st_lsm6dsx_i2c_id_table[] = { >> { ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID }, >> { ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID }, >> { ST_LSM6DSR_DEV_NAME, ST_LSM6DSR_ID }, >> + { ST_LSM9DS1_DEV_NAME, ST_LSM9DS1_ID }, >> {}, >> }; >> MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table); >> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c >> index c9d3c4711018..709769177e91 100644 >> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c >> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c >> @@ -75,6 +75,10 @@ static const struct of_device_id st_lsm6dsx_spi_of_match[] = { >> .compatible = "st,lsm6dsr", >> .data = (void *)ST_LSM6DSR_ID, >> }, >> + { >> + .compatible = "st,lsm9ds1", >> + .data = (void *)ST_LSM9DS1_ID, >> + }, >> {}, >> }; >> MODULE_DEVICE_TABLE(of, st_lsm6dsx_spi_of_match); >> @@ -89,6 +93,7 @@ static const struct spi_device_id st_lsm6dsx_spi_id_table[] = { >> { ST_ASM330LHH_DEV_NAME, ST_ASM330LHH_ID }, >> { ST_LSM6DSOX_DEV_NAME, ST_LSM6DSOX_ID }, >> { ST_LSM6DSR_DEV_NAME, ST_LSM6DSR_ID }, >> + { ST_LSM9DS1_DEV_NAME, ST_LSM9DS1_ID }, >> {}, >> }; >> MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table); >> -- >> 2.20.1 >>