From: Jonathan Cameron <jic23@kernel.org>
To: Radu Sabau via B4 Relay <devnull+radu.sabau.analog.com@kernel.org>
Cc: radu.sabau@analog.com, "Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Robert Budai" <robert.budai@analog.com>,
"Ramona Gradinariu" <ramona.gradinariu@analog.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, linux@analog.com,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v7 5/7] iio: imu: Add driver for the ADI ADIS16607
Date: Thu, 19 Nov 2026 03:24:46 +0000 [thread overview]
Message-ID: <20261119032446.65d0eeba@jic23-hlaptop> (raw)
In-Reply-To: <20261118-adis16607-v7-5-707609737691@analog.com>
On Wed, 18 Nov 2026 15:17:47 +0200
Radu Sabau via B4 Relay <devnull+radu.sabau.analog.com@kernel.org> wrote:
> From: Radu Sabau <radu.sabau@analog.com>
>
> The ADIS16607 is a Precision MEMS IMU from Analog Devices with
> triaxial gyroscope and accelerometer, delta angle/velocity, and
> temperature channels, communicating over a custom SPI Half-Duplex
> protocol. ADIS16607-2 has a ±450°/s gyroscope range, ADIS16607-3
> ±2000°/s; both share a ±40g accelerometer range and an 8 kHz internal
> clock.
>
> This is the base driver: probe, raw channel reads, sampling-frequency
> control, startup/self-test via adislib, and debugfs identity entries.
>
> Self-test leaves the device's SELF_TEST register cleared on every exit
> path, not just on success, so a read failure or a failed delta check
> doesn't leave the sensor stuck in its self-test/force state until the
> next reset.
>
> Signed-off-by: Radu Sabau <radu.sabau@analog.com>
One really minor thing inline. If that's all that comes up
it isn't worth a respin.
> diff --git a/drivers/iio/imu/adis16607.c b/drivers/iio/imu/adis16607.c
> new file mode 100644
> index 000000000000..c53f3e62d3fc
> --- /dev/null
> +++ b/drivers/iio/imu/adis16607.c
> +
> +static int adis16607_set_freq(struct adis16607 *st, u32 freq)
> +{
> + u32 dec;
> + int ret;
> +
> + if (!freq)
> + return -EINVAL;
> +
> + dec = DIV_ROUND_CLOSEST(st->clk_freq_mHz, freq);
> + if (dec)
> + dec--;
> +
> + dec = min(dec, st->info->max_dec);
> +
> + adis_dev_auto_scoped_lock(&st->adis) {
Why not just
adis_dev_auto_lock() ?
Seems like that would be fine through this series.
> + /* Reset the decimation accumulator before the new value */
> + ret = __adis_write_reg_16(&st->adis, ADIS16607_REG_DEC_RATE, 0);
> + if (ret)
> + return ret;
> +
> + st->dec = 0;
> +
> + if (dec) {
> + ret = __adis_write_reg_16(&st->adis,
> + ADIS16607_REG_DEC_RATE, dec);
> + if (ret)
> + return ret;
> +
> + st->dec = dec;
> + }
> + }
> +
> + return 0;
> +}
> +
> +/*
> + * .address is an index into adis16607_chan_regs[] for this driver, not a
> + * literal register like adis_single_conversion() expects, and the channel
> + * spec carries no scan_type for it to take the register width and sign
> + * extension from. Resolve both on a local copy rather than reimplementing
> + * the helper's locking logic ourselves.
> + */
> +static int adis16607_raw_read(struct iio_dev *indio_dev,
> + const struct iio_chan_spec *chan, int *val)
> +{
> + struct iio_chan_spec raw_chan = *chan;
> + bool is_temp = chan->type == IIO_TEMP;
> +
> + raw_chan.address = adis16607_chan_regs[chan->address].raw_reg;
> + raw_chan.scan_type.sign = 's';
> + raw_chan.scan_type.realbits = is_temp ? 16 : 24;
> + raw_chan.scan_type.storagebits = is_temp ? 16 : 32;
> +
> + return adis_single_conversion(indio_dev, &raw_chan, 0, val);
> +}
next prev parent reply other threads:[~2026-11-19 3:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 13:17 [PATCH v7 0/7] iio: imu: Add support " Radu Sabau via B4 Relay
2026-11-18 13:17 ` [PATCH v7 1/7] iio: imu: adis: Fix custom reset dispatch in adislib Radu Sabau via B4 Relay
2026-11-18 13:17 ` [PATCH v7 2/7] iio: imu: adis: Add optional self_test callback Radu Sabau via B4 Relay
2026-11-18 13:17 ` [PATCH v7 3/7] iio: imu: adis: Add optional init callback Radu Sabau via B4 Relay
2026-11-18 13:17 ` [PATCH v7 4/7] dt-bindings: iio: imu: Add bindings for ADI ADIS16607 Radu Sabau via B4 Relay
2026-11-18 13:17 ` [PATCH v7 5/7] iio: imu: Add driver for the " Radu Sabau via B4 Relay
2026-11-19 3:24 ` Jonathan Cameron [this message]
2026-11-18 13:17 ` [PATCH v7 6/7] iio: imu: adis16607: Add external clock sync support Radu Sabau via B4 Relay
2026-11-18 13:17 ` [PATCH v7 7/7] iio: imu: adis16607: Add calibration bias support for gyro/accel Radu Sabau via B4 Relay
2026-11-19 3:26 ` [PATCH v7 0/7] iio: imu: Add support for the ADI ADIS16607 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=20261119032446.65d0eeba@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+radu.sabau.analog.com@kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=nuno.sa@analog.com \
--cc=radu.sabau@analog.com \
--cc=ramona.gradinariu@analog.com \
--cc=robert.budai@analog.com \
--cc=robh@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
all inboxes | Powered by JetHome®