From: Jonathan Cameron <jic23@kernel.org>
To: Mehdi Djait <mehdi.djait.k@gmail.com>
Cc: mazziesaccount@gmail.com, krzysztof.kozlowski+dt@linaro.org,
andriy.shevchenko@linux.intel.com, robh+dt@kernel.org,
lars@metafoo.de, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 7/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer
Date: Sun, 28 May 2023 17:59:09 +0100 [thread overview]
Message-ID: <20230528175909.245d5bfc@jic23-huawei> (raw)
In-Reply-To: <d776c1dd5beef6ef812a4f7e4958eb6cb0f5e58e.1685111274.git.mehdi.djait.k@gmail.com>
On Fri, 26 May 2023 16:30:48 +0200
Mehdi Djait <mehdi.djait.k@gmail.com> wrote:
> Kionix KX132-1211 is a tri-axis 16-bit accelerometer that can support
> ranges from ±2G to ±16G, digital output through I²C/SPI.
> Add support for basic accelerometer features such as reading acceleration
> via IIO using raw reads, triggered buffer (data-ready), or the WMI IRQ.
>
> Datasheet: https://kionixfs.azureedge.net/en/document/KX132-1211-Technical-Reference-Manual-Rev-5.0.pdf
> Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
Hi Mehdi,
Comment is a follow on from the earlier one about buf_smp_lvl_mask.
Jonathan
> /*
> * The sensor HW can support ODR up to 1600 Hz, which is beyond what most of the
> * Linux CPUs can handle without dropping samples. Also, the low power mode is
> @@ -613,6 +731,24 @@ static int kx022a_get_fifo_bytes(struct kx022a_data *data)
> return fifo_bytes;
> }
>
> +static int kx132_get_fifo_bytes(struct kx022a_data *data)
> +{
> + __le16 buf_status;
> + int ret, fifo_bytes;
> +
> + ret = regmap_bulk_read(data->regmap, data->chip_info->buf_status1,
> + &buf_status, sizeof(buf_status));
> + if (ret) {
> + dev_err(data->dev, "Error reading buffer status\n");
> + return ret;
> + }
> +
> + fifo_bytes = le16_to_cpu(buf_status);
> + fifo_bytes &= data->chip_info->buf_smp_lvl_mask;
See below.
> +
> + return fifo_bytes;
> +}
> +
> static int __kx022a_fifo_flush(struct iio_dev *idev, unsigned int samples,
> bool irq)
> {
> @@ -1036,6 +1172,32 @@ const struct kx022a_chip_info kx022a_chip_info = {
> };
> EXPORT_SYMBOL_NS_GPL(kx022a_chip_info, IIO_KX022A);
>
> +const struct kx022a_chip_info kx132_chip_info = {
> + .name = "kx132-1211",
> + .regmap_config = &kx132_regmap_config,
> + .channels = kx132_channels,
> + .num_channels = ARRAY_SIZE(kx132_channels),
> + .fifo_length = KX132_FIFO_LENGTH,
> + .who = KX132_REG_WHO,
> + .id = KX132_ID,
> + .cntl = KX132_REG_CNTL,
> + .cntl2 = KX132_REG_CNTL2,
> + .odcntl = KX132_REG_ODCNTL,
> + .buf_cntl1 = KX132_REG_BUF_CNTL1,
> + .buf_cntl2 = KX132_REG_BUF_CNTL2,
> + .buf_clear = KX132_REG_BUF_CLEAR,
> + .buf_status1 = KX132_REG_BUF_STATUS_1,
> + .buf_smp_lvl_mask = KX132_MASK_BUF_SMP_LVL,
As per earlier comment I think this is only set for this device...
> + .buf_read = KX132_REG_BUF_READ,
> + .inc1 = KX132_REG_INC1,
> + .inc4 = KX132_REG_INC4,
> + .inc5 = KX132_REG_INC5,
> + .inc6 = KX132_REG_INC6,
> + .xout_l = KX132_REG_XOUT_L,
> + .get_fifo_bytes = kx132_get_fifo_bytes,
and only used in this device specific callback.
Probably can just use it directly in the callback.
> +};
> +EXPORT_SYMBOL_NS_GPL(kx132_chip_info, IIO_KX022A);
> +
next prev parent reply other threads:[~2023-05-28 16:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1685111274.git.mehdi.djait.k@gmail.com>
2023-05-26 14:30 ` [PATCH v4 7/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-05-26 14:42 ` Mehdi Djait
2023-05-26 17:13 ` Matti Vaittinen
2023-05-27 8:24 ` Andy Shevchenko
2023-05-28 16:59 ` Jonathan Cameron [this message]
2023-05-26 14:30 [PATCH v4 0/7] " Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 1/7] dt-bindings: iio: Add " Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 2/7] iio: accel: kionix-kx022a: Remove blank lines Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 3/7] iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 4/7] iio: accel: kionix-kx022a: Add an i2c_device_id table Mehdi Djait
2023-05-26 16:35 ` Matti Vaittinen
2023-05-26 14:30 ` [PATCH v4 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Mehdi Djait
2023-05-26 17:04 ` Matti Vaittinen
2023-05-28 16:49 ` Jonathan Cameron
2023-05-27 13:39 ` Andy Shevchenko
2023-05-28 16:55 ` Jonathan Cameron
2023-05-26 14:30 ` [PATCH v4 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer Mehdi Djait
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=20230528175909.245d5bfc@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=mehdi.djait.k@gmail.com \
--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 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).