From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Cosmin Tanislav <demonsingur@gmail.com>
Cc: <cosmin.tanislav@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Rob Herring <robh+dt@kernel.org>, <linux-iio@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 5/5] iio: accel: add ADXL367 driver
Date: Fri, 11 Feb 2022 14:32:29 +0000 [thread overview]
Message-ID: <20220211143229.00000aad@Huawei.com> (raw)
In-Reply-To: <20220206211307.1564647-6-cosmin.tanislav@analog.com>
On Sun, 6 Feb 2022 23:13:07 +0200
Cosmin Tanislav <demonsingur@gmail.com> wrote:
> The ADXL367 is an ultralow power, 3-axis MEMS accelerometer.
>
> The ADXL367 does not alias input signals to achieve ultralow power
> consumption, it samples the full bandwidth of the sensor at all
> data rates. Measurement ranges of +-2g, +-4g, and +-8g are available,
> with a resolution of 0.25mg/LSB on the +-2 g range.
>
> In addition to its ultralow power consumption, the ADXL367
> has many features to enable true system level power reduction.
> It includes a deep multimode output FIFO, a built-in micropower
> temperature sensor, and an internal ADC for synchronous conversion
> of an additional analog input.
>
> Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
I missed the issue below with the use of available_scan_masks
in v3. Other than that and a few trivial things below, the series
looks good to me.
Thanks,
Jonathan
> ---
> MAINTAINERS | 8 +
> drivers/iio/accel/Kconfig | 27 +
> drivers/iio/accel/Makefile | 3 +
> drivers/iio/accel/adxl367.c | 1585 +++++++++++++++++++++++++++++++
> drivers/iio/accel/adxl367.h | 23 +
> drivers/iio/accel/adxl367_i2c.c | 90 ++
> drivers/iio/accel/adxl367_spi.c | 164 ++++
> 7 files changed, 1900 insertions(+)
> create mode 100644 drivers/iio/accel/adxl367.c
> create mode 100644 drivers/iio/accel/adxl367.h
> create mode 100644 drivers/iio/accel/adxl367_i2c.c
> create mode 100644 drivers/iio/accel/adxl367_spi.c
>
> new file mode 100644
> index 000000000000..cac47db7d89c
> --- /dev/null
> +++ b/drivers/iio/accel/adxl367.c
> @@ -0,0 +1,1585 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2021 Analog Devices, Inc.
> + * Author: Cosmin Tanislav <cosmin.tanislav@analog.com>
> + */
> +
> +#include <linux/bitfield.h>
> +#include <linux/bitops.h>
> +#include <linux/iio/buffer.h>
> +#include <linux/iio/events.h>
> +#include <linux/iio/iio.h>
> +#include <linux/iio/kfifo_buf.h>
> +#include <linux/iio/sysfs.h>
> +#include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/module.h>
#include <linux/mod_devicetable.h>
for the id tables.
> +#include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> +#include <asm/unaligned.h>
> +
> +#include "adxl367.h"
> +
> +static const unsigned long adxl367_channel_masks[] = {
> + [ADXL367_FIFO_FORMAT_XYZ] = ADXL367_X_CHANNEL_MASK
> + | ADXL367_Y_CHANNEL_MASK
> + | ADXL367_Z_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_X] = ADXL367_X_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_Y] = ADXL367_Y_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_Z] = ADXL367_Z_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_XYZT] = ADXL367_X_CHANNEL_MASK
> + | ADXL367_Y_CHANNEL_MASK
> + | ADXL367_Z_CHANNEL_MASK
> + | ADXL367_TEMP_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_XT] = ADXL367_X_CHANNEL_MASK
> + | ADXL367_TEMP_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_YT] = ADXL367_Y_CHANNEL_MASK
> + | ADXL367_TEMP_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_ZT] = ADXL367_Z_CHANNEL_MASK
> + | ADXL367_TEMP_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_XYZA] = ADXL367_X_CHANNEL_MASK
> + | ADXL367_Y_CHANNEL_MASK
> + | ADXL367_Z_CHANNEL_MASK
> + | ADXL367_EX_ADC_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_XA] = ADXL367_X_CHANNEL_MASK
> + | ADXL367_EX_ADC_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_YA] = ADXL367_Y_CHANNEL_MASK
> + | ADXL367_EX_ADC_CHANNEL_MASK,
> + [ADXL367_FIFO_FORMAT_ZA] = ADXL367_Z_CHANNEL_MASK
> + | ADXL367_EX_ADC_CHANNEL_MASK,
> + 0,
> +};
The way available scan_masks works is to search for an entry
for which the desired mask is a subset.
That means to get the minimal mode IIRC you need to order them from
smallest to largest. e.g.
https://elixir.bootlin.com/linux/latest/source/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c#L1122
> +
> +EXPORT_SYMBOL_NS_GPL(adxl367_probe, ADXL367);
Trivial but we decided to prefix IIO namespaces with IIO_ so this should
be IIO_ADXL367.
> +
> +MODULE_AUTHOR("Cosmin Tanislav <cosmin.tanislav@analog.com>");
> +MODULE_DESCRIPTION("Analog Devices ADXL367 3-axis accelerometer driver");
> +MODULE_LICENSE("GPL");
next prev parent reply other threads:[~2022-02-11 14:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-06 21:13 [PATCH v4 0/5] Add ADXL367 driver Cosmin Tanislav
2022-02-06 21:13 ` [PATCH v4 1/5] iio: introduce mag_referenced Cosmin Tanislav
2022-02-06 21:13 ` [PATCH v4 2/5] iio: ABI: document mag_referenced Cosmin Tanislav
2022-02-06 21:13 ` [PATCH v4 3/5] iio: ABI: add note about configuring other attributes during buffer capture Cosmin Tanislav
2022-02-06 21:13 ` [PATCH v4 4/5] dt-bindings: iio: accel: add ADXL367 Cosmin Tanislav
2022-02-06 21:13 ` [PATCH v4 5/5] iio: accel: add ADXL367 driver Cosmin Tanislav
2022-02-11 14:32 ` Jonathan Cameron [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-02-11 19:42 kernel test robot
2022-02-14 3:07 kernel test robot
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=20220211143229.00000aad@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=cosmin.tanislav@analog.com \
--cc=demonsingur@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.