Re: [v3 1/2] iio: gyro: Add driver support for ADXRS290

2020-07-26 Thread Nishant Malpani



On 26/07/20 5:45 pm, Jonathan Cameron wrote:

On Fri, 24 Jul 2020 16:31:59 +0530
Nishant Malpani  wrote:


ADXRS290 is a high performance MEMS pitch and roll (dual-axis in-plane)
angular rate sensor (gyroscope) designed for use in stabilization
applications. It also features an internal temperature sensor and
programmable high-pass and low-pass filters.

Add support for ADXRS290 in direct-access mode for now.

Datasheet: 
https://www.analog.com/media/en/technical-documentation/data-sheets/ADXRS290.pdf
Signed-off-by: Nishant Malpani 


Looks pretty good to me.  A few minor comments seeing as you'll be doing
a v4 anyway to tidy up the bits Andy pointed out.

I've pointed out the locking is probably in excess of what is needed, but
I have no problem with you leaving it as it stands, in the interests of
having less fragile code as you extend the driver futher.

Thanks,

Jonathan


---

Changes in v3:
   - drop "Link" tag & extra line in commit message
   - rename cut-off frequencies tables to
 'adxrs290_{lpf, hpf}_3db_freq_hz_table' to be more descriptive
   - fix unsigned type errors
   - add comments on how to scale raw angular velocity and temperature
 values to appropriate units mentioned in the ABI
   - re-order declarations in reversed spruce tree order
   - remove 'indio_dev->dev.parent = >dev' as the iio core handles it
 during iio_device_alloc()
   - use plain msleep() instead of the interruptible variant
   - remove extra terminal comma

Changes in v2:
   - append copyright tag with author's info
   - remove asm/unaligned.h header
   - remove unnecessary comments about the registers' description
   - rephrase comment on the usage of mutex_lock
   - discard the usage of local tx, rx buffers; use DMA-safe buffers
 provided by the SPI core instead
   - utilize spi_w8r16 provided by the SPI core instead of writing a
 wrapper over spi_sync_transfer which semantically does the same
   - equip spi_write_then_read instead of plain spi_write since the
 latter requires a DMA-safe buffer
   - implement exact matching of filter 3db frequencies instead of
 finding the "closest" match; rounding complexity is left to the
 userspace
   - include 'info_mask_shared_by_type_available' when initialising
 iio_chan_spec instead of explicitly exposing attributes
 signifying available filter 3db frequencies; with this we can
 utilize read_avail core callback
---
  MAINTAINERS |   6 +
  drivers/iio/gyro/Kconfig|  10 +
  drivers/iio/gyro/Makefile   |   1 +
  drivers/iio/gyro/adxrs290.c | 446 
  4 files changed, 463 insertions(+)
  create mode 100644 drivers/iio/gyro/adxrs290.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 9077411c9890..71ae9b184179 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1098,6 +1098,12 @@ L:   linux-me...@vger.kernel.org
  S:Maintained
  F:drivers/media/i2c/adv7842*
  
+ANALOG DEVICES INC ADXRS290 DRIVER

+M: Nishant Malpani 
+L: linux-...@vger.kernel.org
+S: Supported
+F: drivers/iio/gyro/adxrs290.c
+
  ANALOG DEVICES INC ASOC CODEC DRIVERS
  M:Lars-Peter Clausen 
  M:Nuno Sá 
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
index 6daeddf37f60..024a34139875 100644
--- a/drivers/iio/gyro/Kconfig
+++ b/drivers/iio/gyro/Kconfig
@@ -41,6 +41,16 @@ config ADIS16260
  This driver can also be built as a module.  If so, the module
  will be called adis16260.
  
+config ADXRS290

+   tristate "Analog Devices ADXRS290 Dual-Axis MEMS Gyroscope SPI driver"
+   depends on SPI
+   help
+ Say yes here to build support for Analog Devices ADXRS290 programmable
+ digital output gyroscope.
+
+ This driver can also be built as a module. If so, the module will be
+ called adxrs290.
+
  config ADXRS450
tristate "Analog Devices ADXRS450/3 Digital Output Gyroscope SPI driver"
depends on SPI
diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile
index 45cbd5dc644e..0319b397dc3f 100644
--- a/drivers/iio/gyro/Makefile
+++ b/drivers/iio/gyro/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_ADIS16080) += adis16080.o
  obj-$(CONFIG_ADIS16130) += adis16130.o
  obj-$(CONFIG_ADIS16136) += adis16136.o
  obj-$(CONFIG_ADIS16260) += adis16260.o
+obj-$(CONFIG_ADXRS290) += adxrs290.o
  obj-$(CONFIG_ADXRS450) += adxrs450.o
  obj-$(CONFIG_BMG160) += bmg160_core.o
  obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o
diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
new file mode 100644
index ..cff1af9211bc
--- /dev/null
+++ b/drivers/iio/gyro/adxrs290.c
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * ADXRS290 SPI Gyroscope Driver
+ *
+ * Copyright (C) 2020 Nishant Malpani 
+ * Copyright (C) 2020 Analog Devices, Inc.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define ADXRS290_ADI_ID0xAD
+#define 

Re: [v3 1/2] iio: gyro: Add driver support for ADXRS290

2020-07-26 Thread Nishant Malpani



On 26/07/20 1:33 pm, Andy Shevchenko wrote:

On Fri, Jul 24, 2020 at 2:02 PM Nishant Malpani
 wrote:


ADXRS290 is a high performance MEMS pitch and roll (dual-axis in-plane)
angular rate sensor (gyroscope) designed for use in stabilization
applications. It also features an internal temperature sensor and
programmable high-pass and low-pass filters.

Add support for ADXRS290 in direct-access mode for now.


Thanks for an update!
My nits below, after addressing them



Reviewed-by: Andy Shevchenko 


Thanks!


Datasheet: 
https://www.analog.com/media/en/technical-documentation/data-sheets/ADXRS290.pdf
Signed-off-by: Nishant Malpani 
---

Changes in v3:
   - drop "Link" tag & extra line in commit message
   - rename cut-off frequencies tables to
 'adxrs290_{lpf, hpf}_3db_freq_hz_table' to be more descriptive
   - fix unsigned type errors
   - add comments on how to scale raw angular velocity and temperature
 values to appropriate units mentioned in the ABI
   - re-order declarations in reversed spruce tree order
   - remove 'indio_dev->dev.parent = >dev' as the iio core handles it
 during iio_device_alloc()
   - use plain msleep() instead of the interruptible variant
   - remove extra terminal comma

Changes in v2:
   - append copyright tag with author's info
   - remove asm/unaligned.h header
   - remove unnecessary comments about the registers' description
   - rephrase comment on the usage of mutex_lock
   - discard the usage of local tx, rx buffers; use DMA-safe buffers
 provided by the SPI core instead
   - utilize spi_w8r16 provided by the SPI core instead of writing a
 wrapper over spi_sync_transfer which semantically does the same
   - equip spi_write_then_read instead of plain spi_write since the
 latter requires a DMA-safe buffer
   - implement exact matching of filter 3db frequencies instead of
 finding the "closest" match; rounding complexity is left to the
 userspace
   - include 'info_mask_shared_by_type_available' when initialising
 iio_chan_spec instead of explicitly exposing attributes
 signifying available filter 3db frequencies; with this we can
 utilize read_avail core callback
---
  MAINTAINERS |   6 +
  drivers/iio/gyro/Kconfig|  10 +
  drivers/iio/gyro/Makefile   |   1 +
  drivers/iio/gyro/adxrs290.c | 446 
  4 files changed, 463 insertions(+)
  create mode 100644 drivers/iio/gyro/adxrs290.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 9077411c9890..71ae9b184179 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1098,6 +1098,12 @@ L:   linux-me...@vger.kernel.org
  S: Maintained
  F: drivers/media/i2c/adv7842*

+ANALOG DEVICES INC ADXRS290 DRIVER
+M: Nishant Malpani 
+L: linux-...@vger.kernel.org
+S: Supported
+F: drivers/iio/gyro/adxrs290.c
+
  ANALOG DEVICES INC ASOC CODEC DRIVERS
  M: Lars-Peter Clausen 
  M: Nuno Sá 
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
index 6daeddf37f60..024a34139875 100644
--- a/drivers/iio/gyro/Kconfig
+++ b/drivers/iio/gyro/Kconfig
@@ -41,6 +41,16 @@ config ADIS16260
   This driver can also be built as a module.  If so, the module
   will be called adis16260.

+config ADXRS290
+   tristate "Analog Devices ADXRS290 Dual-Axis MEMS Gyroscope SPI driver"
+   depends on SPI
+   help
+ Say yes here to build support for Analog Devices ADXRS290 programmable
+ digital output gyroscope.
+
+ This driver can also be built as a module. If so, the module will be
+ called adxrs290.
+
  config ADXRS450
 tristate "Analog Devices ADXRS450/3 Digital Output Gyroscope SPI 
driver"
 depends on SPI
diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile
index 45cbd5dc644e..0319b397dc3f 100644
--- a/drivers/iio/gyro/Makefile
+++ b/drivers/iio/gyro/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_ADIS16080) += adis16080.o
  obj-$(CONFIG_ADIS16130) += adis16130.o
  obj-$(CONFIG_ADIS16136) += adis16136.o
  obj-$(CONFIG_ADIS16260) += adis16260.o
+obj-$(CONFIG_ADXRS290) += adxrs290.o
  obj-$(CONFIG_ADXRS450) += adxrs450.o
  obj-$(CONFIG_BMG160) += bmg160_core.o
  obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o
diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
new file mode 100644
index ..cff1af9211bc
--- /dev/null
+++ b/drivers/iio/gyro/adxrs290.c
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * ADXRS290 SPI Gyroscope Driver
+ *
+ * Copyright (C) 2020 Nishant Malpani 
+ * Copyright (C) 2020 Analog Devices, Inc.
+ */
+
+#include 



+#include 
+#include 


Keep it ordered?


Ah, missed it somehow. Will reorder in v4.


+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define ADXRS290_ADI_ID0xAD
+#define ADXRS290_MEMS_ID   0x1D
+#define ADXRS290_DEV_ID0x92
+
+#define ADXRS290_REG_ADI_ID0x00
+#define ADXRS290_REG_MEMS_ID   0x01
+#define ADXRS290_REG_DEV_ID  

Re: [v3 1/2] iio: gyro: Add driver support for ADXRS290

2020-07-26 Thread Jonathan Cameron
On Fri, 24 Jul 2020 16:31:59 +0530
Nishant Malpani  wrote:

> ADXRS290 is a high performance MEMS pitch and roll (dual-axis in-plane)
> angular rate sensor (gyroscope) designed for use in stabilization
> applications. It also features an internal temperature sensor and
> programmable high-pass and low-pass filters.
> 
> Add support for ADXRS290 in direct-access mode for now.
> 
> Datasheet: 
> https://www.analog.com/media/en/technical-documentation/data-sheets/ADXRS290.pdf
> Signed-off-by: Nishant Malpani 

Looks pretty good to me.  A few minor comments seeing as you'll be doing
a v4 anyway to tidy up the bits Andy pointed out.

I've pointed out the locking is probably in excess of what is needed, but
I have no problem with you leaving it as it stands, in the interests of
having less fragile code as you extend the driver futher.

Thanks,

Jonathan

> ---
> 
> Changes in v3:
>   - drop "Link" tag & extra line in commit message
>   - rename cut-off frequencies tables to
> 'adxrs290_{lpf, hpf}_3db_freq_hz_table' to be more descriptive
>   - fix unsigned type errors
>   - add comments on how to scale raw angular velocity and temperature
> values to appropriate units mentioned in the ABI
>   - re-order declarations in reversed spruce tree order
>   - remove 'indio_dev->dev.parent = >dev' as the iio core handles it
> during iio_device_alloc()
>   - use plain msleep() instead of the interruptible variant
>   - remove extra terminal comma
> 
> Changes in v2:
>   - append copyright tag with author's info
>   - remove asm/unaligned.h header
>   - remove unnecessary comments about the registers' description
>   - rephrase comment on the usage of mutex_lock
>   - discard the usage of local tx, rx buffers; use DMA-safe buffers
> provided by the SPI core instead
>   - utilize spi_w8r16 provided by the SPI core instead of writing a
> wrapper over spi_sync_transfer which semantically does the same
>   - equip spi_write_then_read instead of plain spi_write since the
> latter requires a DMA-safe buffer
>   - implement exact matching of filter 3db frequencies instead of
> finding the "closest" match; rounding complexity is left to the
> userspace
>   - include 'info_mask_shared_by_type_available' when initialising
> iio_chan_spec instead of explicitly exposing attributes
> signifying available filter 3db frequencies; with this we can
> utilize read_avail core callback
> ---
>  MAINTAINERS |   6 +
>  drivers/iio/gyro/Kconfig|  10 +
>  drivers/iio/gyro/Makefile   |   1 +
>  drivers/iio/gyro/adxrs290.c | 446 
>  4 files changed, 463 insertions(+)
>  create mode 100644 drivers/iio/gyro/adxrs290.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9077411c9890..71ae9b184179 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1098,6 +1098,12 @@ L: linux-me...@vger.kernel.org
>  S:   Maintained
>  F:   drivers/media/i2c/adv7842*
>  
> +ANALOG DEVICES INC ADXRS290 DRIVER
> +M:   Nishant Malpani 
> +L:   linux-...@vger.kernel.org
> +S:   Supported
> +F:   drivers/iio/gyro/adxrs290.c
> +
>  ANALOG DEVICES INC ASOC CODEC DRIVERS
>  M:   Lars-Peter Clausen 
>  M:   Nuno Sá 
> diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
> index 6daeddf37f60..024a34139875 100644
> --- a/drivers/iio/gyro/Kconfig
> +++ b/drivers/iio/gyro/Kconfig
> @@ -41,6 +41,16 @@ config ADIS16260
> This driver can also be built as a module.  If so, the module
> will be called adis16260.
>  
> +config ADXRS290
> + tristate "Analog Devices ADXRS290 Dual-Axis MEMS Gyroscope SPI driver"
> + depends on SPI
> + help
> +   Say yes here to build support for Analog Devices ADXRS290 programmable
> +   digital output gyroscope.
> +
> +   This driver can also be built as a module. If so, the module will be
> +   called adxrs290.
> +
>  config ADXRS450
>   tristate "Analog Devices ADXRS450/3 Digital Output Gyroscope SPI driver"
>   depends on SPI
> diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile
> index 45cbd5dc644e..0319b397dc3f 100644
> --- a/drivers/iio/gyro/Makefile
> +++ b/drivers/iio/gyro/Makefile
> @@ -8,6 +8,7 @@ obj-$(CONFIG_ADIS16080) += adis16080.o
>  obj-$(CONFIG_ADIS16130) += adis16130.o
>  obj-$(CONFIG_ADIS16136) += adis16136.o
>  obj-$(CONFIG_ADIS16260) += adis16260.o
> +obj-$(CONFIG_ADXRS290) += adxrs290.o
>  obj-$(CONFIG_ADXRS450) += adxrs450.o
>  obj-$(CONFIG_BMG160) += bmg160_core.o
>  obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o
> diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
> new file mode 100644
> index ..cff1af9211bc
> --- /dev/null
> +++ b/drivers/iio/gyro/adxrs290.c
> @@ -0,0 +1,446 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * ADXRS290 SPI Gyroscope Driver
> + *
> + * Copyright (C) 2020 Nishant Malpani 
> + * Copyright (C) 2020 Analog Devices, Inc.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> 

Re: [v3 1/2] iio: gyro: Add driver support for ADXRS290

2020-07-26 Thread Andy Shevchenko
On Fri, Jul 24, 2020 at 2:02 PM Nishant Malpani
 wrote:
>
> ADXRS290 is a high performance MEMS pitch and roll (dual-axis in-plane)
> angular rate sensor (gyroscope) designed for use in stabilization
> applications. It also features an internal temperature sensor and
> programmable high-pass and low-pass filters.
>
> Add support for ADXRS290 in direct-access mode for now.

Thanks for an update!
My nits below, after addressing them
Reviewed-by: Andy Shevchenko 

> Datasheet: 
> https://www.analog.com/media/en/technical-documentation/data-sheets/ADXRS290.pdf
> Signed-off-by: Nishant Malpani 
> ---
>
> Changes in v3:
>   - drop "Link" tag & extra line in commit message
>   - rename cut-off frequencies tables to
> 'adxrs290_{lpf, hpf}_3db_freq_hz_table' to be more descriptive
>   - fix unsigned type errors
>   - add comments on how to scale raw angular velocity and temperature
> values to appropriate units mentioned in the ABI
>   - re-order declarations in reversed spruce tree order
>   - remove 'indio_dev->dev.parent = >dev' as the iio core handles it
> during iio_device_alloc()
>   - use plain msleep() instead of the interruptible variant
>   - remove extra terminal comma
>
> Changes in v2:
>   - append copyright tag with author's info
>   - remove asm/unaligned.h header
>   - remove unnecessary comments about the registers' description
>   - rephrase comment on the usage of mutex_lock
>   - discard the usage of local tx, rx buffers; use DMA-safe buffers
> provided by the SPI core instead
>   - utilize spi_w8r16 provided by the SPI core instead of writing a
> wrapper over spi_sync_transfer which semantically does the same
>   - equip spi_write_then_read instead of plain spi_write since the
> latter requires a DMA-safe buffer
>   - implement exact matching of filter 3db frequencies instead of
> finding the "closest" match; rounding complexity is left to the
> userspace
>   - include 'info_mask_shared_by_type_available' when initialising
> iio_chan_spec instead of explicitly exposing attributes
> signifying available filter 3db frequencies; with this we can
> utilize read_avail core callback
> ---
>  MAINTAINERS |   6 +
>  drivers/iio/gyro/Kconfig|  10 +
>  drivers/iio/gyro/Makefile   |   1 +
>  drivers/iio/gyro/adxrs290.c | 446 
>  4 files changed, 463 insertions(+)
>  create mode 100644 drivers/iio/gyro/adxrs290.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9077411c9890..71ae9b184179 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1098,6 +1098,12 @@ L:   linux-me...@vger.kernel.org
>  S: Maintained
>  F: drivers/media/i2c/adv7842*
>
> +ANALOG DEVICES INC ADXRS290 DRIVER
> +M: Nishant Malpani 
> +L: linux-...@vger.kernel.org
> +S: Supported
> +F: drivers/iio/gyro/adxrs290.c
> +
>  ANALOG DEVICES INC ASOC CODEC DRIVERS
>  M: Lars-Peter Clausen 
>  M: Nuno Sá 
> diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
> index 6daeddf37f60..024a34139875 100644
> --- a/drivers/iio/gyro/Kconfig
> +++ b/drivers/iio/gyro/Kconfig
> @@ -41,6 +41,16 @@ config ADIS16260
>   This driver can also be built as a module.  If so, the module
>   will be called adis16260.
>
> +config ADXRS290
> +   tristate "Analog Devices ADXRS290 Dual-Axis MEMS Gyroscope SPI driver"
> +   depends on SPI
> +   help
> + Say yes here to build support for Analog Devices ADXRS290 
> programmable
> + digital output gyroscope.
> +
> + This driver can also be built as a module. If so, the module will be
> + called adxrs290.
> +
>  config ADXRS450
> tristate "Analog Devices ADXRS450/3 Digital Output Gyroscope SPI 
> driver"
> depends on SPI
> diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile
> index 45cbd5dc644e..0319b397dc3f 100644
> --- a/drivers/iio/gyro/Makefile
> +++ b/drivers/iio/gyro/Makefile
> @@ -8,6 +8,7 @@ obj-$(CONFIG_ADIS16080) += adis16080.o
>  obj-$(CONFIG_ADIS16130) += adis16130.o
>  obj-$(CONFIG_ADIS16136) += adis16136.o
>  obj-$(CONFIG_ADIS16260) += adis16260.o
> +obj-$(CONFIG_ADXRS290) += adxrs290.o
>  obj-$(CONFIG_ADXRS450) += adxrs450.o
>  obj-$(CONFIG_BMG160) += bmg160_core.o
>  obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o
> diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
> new file mode 100644
> index ..cff1af9211bc
> --- /dev/null
> +++ b/drivers/iio/gyro/adxrs290.c
> @@ -0,0 +1,446 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * ADXRS290 SPI Gyroscope Driver
> + *
> + * Copyright (C) 2020 Nishant Malpani 
> + * Copyright (C) 2020 Analog Devices, Inc.
> + */
> +
> +#include 

> +#include 
> +#include 

Keep it ordered?

> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +#define ADXRS290_ADI_ID0xAD
> +#define ADXRS290_MEMS_ID   0x1D
> +#define ADXRS290_DEV_ID0x92
> +
> +#define 

[v3 1/2] iio: gyro: Add driver support for ADXRS290

2020-07-24 Thread Nishant Malpani
ADXRS290 is a high performance MEMS pitch and roll (dual-axis in-plane)
angular rate sensor (gyroscope) designed for use in stabilization
applications. It also features an internal temperature sensor and
programmable high-pass and low-pass filters.

Add support for ADXRS290 in direct-access mode for now.

Datasheet: 
https://www.analog.com/media/en/technical-documentation/data-sheets/ADXRS290.pdf
Signed-off-by: Nishant Malpani 
---

Changes in v3:
  - drop "Link" tag & extra line in commit message
  - rename cut-off frequencies tables to
'adxrs290_{lpf, hpf}_3db_freq_hz_table' to be more descriptive
  - fix unsigned type errors
  - add comments on how to scale raw angular velocity and temperature
values to appropriate units mentioned in the ABI
  - re-order declarations in reversed spruce tree order
  - remove 'indio_dev->dev.parent = >dev' as the iio core handles it
during iio_device_alloc()
  - use plain msleep() instead of the interruptible variant
  - remove extra terminal comma

Changes in v2:
  - append copyright tag with author's info
  - remove asm/unaligned.h header
  - remove unnecessary comments about the registers' description
  - rephrase comment on the usage of mutex_lock
  - discard the usage of local tx, rx buffers; use DMA-safe buffers
provided by the SPI core instead
  - utilize spi_w8r16 provided by the SPI core instead of writing a
wrapper over spi_sync_transfer which semantically does the same
  - equip spi_write_then_read instead of plain spi_write since the
latter requires a DMA-safe buffer
  - implement exact matching of filter 3db frequencies instead of
finding the "closest" match; rounding complexity is left to the
userspace
  - include 'info_mask_shared_by_type_available' when initialising
iio_chan_spec instead of explicitly exposing attributes
signifying available filter 3db frequencies; with this we can
utilize read_avail core callback
---
 MAINTAINERS |   6 +
 drivers/iio/gyro/Kconfig|  10 +
 drivers/iio/gyro/Makefile   |   1 +
 drivers/iio/gyro/adxrs290.c | 446 
 4 files changed, 463 insertions(+)
 create mode 100644 drivers/iio/gyro/adxrs290.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 9077411c9890..71ae9b184179 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1098,6 +1098,12 @@ L:   linux-me...@vger.kernel.org
 S: Maintained
 F: drivers/media/i2c/adv7842*
 
+ANALOG DEVICES INC ADXRS290 DRIVER
+M: Nishant Malpani 
+L: linux-...@vger.kernel.org
+S: Supported
+F: drivers/iio/gyro/adxrs290.c
+
 ANALOG DEVICES INC ASOC CODEC DRIVERS
 M: Lars-Peter Clausen 
 M: Nuno Sá 
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
index 6daeddf37f60..024a34139875 100644
--- a/drivers/iio/gyro/Kconfig
+++ b/drivers/iio/gyro/Kconfig
@@ -41,6 +41,16 @@ config ADIS16260
  This driver can also be built as a module.  If so, the module
  will be called adis16260.
 
+config ADXRS290
+   tristate "Analog Devices ADXRS290 Dual-Axis MEMS Gyroscope SPI driver"
+   depends on SPI
+   help
+ Say yes here to build support for Analog Devices ADXRS290 programmable
+ digital output gyroscope.
+
+ This driver can also be built as a module. If so, the module will be
+ called adxrs290.
+
 config ADXRS450
tristate "Analog Devices ADXRS450/3 Digital Output Gyroscope SPI driver"
depends on SPI
diff --git a/drivers/iio/gyro/Makefile b/drivers/iio/gyro/Makefile
index 45cbd5dc644e..0319b397dc3f 100644
--- a/drivers/iio/gyro/Makefile
+++ b/drivers/iio/gyro/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_ADIS16080) += adis16080.o
 obj-$(CONFIG_ADIS16130) += adis16130.o
 obj-$(CONFIG_ADIS16136) += adis16136.o
 obj-$(CONFIG_ADIS16260) += adis16260.o
+obj-$(CONFIG_ADXRS290) += adxrs290.o
 obj-$(CONFIG_ADXRS450) += adxrs450.o
 obj-$(CONFIG_BMG160) += bmg160_core.o
 obj-$(CONFIG_BMG160_I2C) += bmg160_i2c.o
diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
new file mode 100644
index ..cff1af9211bc
--- /dev/null
+++ b/drivers/iio/gyro/adxrs290.c
@@ -0,0 +1,446 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * ADXRS290 SPI Gyroscope Driver
+ *
+ * Copyright (C) 2020 Nishant Malpani 
+ * Copyright (C) 2020 Analog Devices, Inc.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define ADXRS290_ADI_ID0xAD
+#define ADXRS290_MEMS_ID   0x1D
+#define ADXRS290_DEV_ID0x92
+
+#define ADXRS290_REG_ADI_ID0x00
+#define ADXRS290_REG_MEMS_ID   0x01
+#define ADXRS290_REG_DEV_ID0x02
+#define ADXRS290_REG_REV_ID0x03
+#define ADXRS290_REG_SN0   0x04 /* Serial Number Registers, 4 bytes */
+#define ADXRS290_REG_DATAX00x08 /* Roll Rate o/p Data Regs, 2 bytes */
+#define ADXRS290_REG_DATAY00x0A /* Pitch Rate o/p Data Regs, 2 bytes */
+#define ADXRS290_REG_TEMP0 0x0C
+#define