Linux I2C development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Muchamad Coirul Anwar <muchamadcoirulanwar@gmail.com>
Cc: lars@metafoo.de, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	rust-for-linux@vger.kernel.org, andi.shyti@kernel.org,
	wsa+renesas@sang-engineering.com, ojeda@kernel.org,
	dakr@kernel.org, igor.korotin@linux.dev, branstj@gmail.com,
	brucer42@gmail.com
Subject: Re: [RFC PATCH v5 3/3] iio: position: add Rust driver for ams AS5600
Date: Mon, 24 Aug 2026 01:17:49 +0100	[thread overview]
Message-ID: <20260824011749.62322d99@jic23-huawei> (raw)
In-Reply-To: <20260822062725.60519-4-muchamadcoirulanwar@gmail.com>

On Sat, 22 Aug 2026 14:26:58 +0800
Muchamad Coirul Anwar <muchamadcoirulanwar@gmail.com> wrote:

> Add a Rust driver for the ams AS5600 12-bit magnetic rotary position
> sensor. The driver exposes in_angl_raw and in_angl_scale via the IIO
> sysfs interface.
> 
> Features:
> - ARef<I2cClient<Bound>> for safe refcounted I2C client access
> - Mutex-serialized status + angle read sequence
> - Static channel spec (module-level const)
> - No magnet validation at probe (deferred to read_raw per IIO convention)
> - Error propagation via ? operator (no recovery state machine)
> - Type-safe IioChanInfo enum dispatch in read_raw
> 
> The AS5600 stores the 12-bit raw angle big-endian across registers
> 0x0C-0x0D. smbus_read_word_swapped() handles the byte swap: SMBus
> always transmits the low byte first (little-endian wire), so an
> unconditional byte swap recovers the correct value regardless of CPU
> endianness. The long-term solution is regmap-rs where endianness is
> configured once at the transport level.
> 
> This driver uses INDIO_DIRECT_MODE without buffer or trigger support.

I'd only talk about what you do support.  There are always many things
that aren't in an initial driver so listing that bit doesn't provide much
value.

> All userspace access is through sysfs attributes, which ensures safe
> cleanup via kernfs_drain() synchronization in the IIO abstraction's
> PinnedDrop. See the module-level doc comment for details.


> 
> Tested on BeagleBone Black (AM335x) with AS5600 on i2c-2 (0x36).

Generally put things like testing info in the cover letter or below
the ---

> 
> Signed-off-by: Muchamad Coirul Anwar <muchamadcoirulanwar@gmail.com>


The code itself looks fine to me - but as with earlier I'm looking
for rust expert review.

Thanks

Jonathan

      reply	other threads:[~2026-08-24  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22  6:26 [RFC PATCH v5 0/3] iio: position: add Rust driver for ams AS5600 Muchamad Coirul Anwar
2026-08-22  6:26 ` [RFC PATCH v5 1/3] i2c: rust: implement SMBus access via IoBackend and FallibleIoCapable Muchamad Coirul Anwar
2026-08-23 23:41   ` Jonathan Cameron
2026-08-22  6:26 ` [RFC PATCH v5 2/3] rust: add minimal IIO subsystem abstractions Muchamad Coirul Anwar
2026-08-24  0:07   ` Jonathan Cameron
2026-08-22  6:26 ` [RFC PATCH v5 3/3] iio: position: add Rust driver for ams AS5600 Muchamad Coirul Anwar
2026-08-24  0:17   ` Jonathan Cameron [this message]

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=20260824011749.62322d99@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andi.shyti@kernel.org \
    --cc=branstj@gmail.com \
    --cc=brucer42@gmail.com \
    --cc=dakr@kernel.org \
    --cc=igor.korotin@linux.dev \
    --cc=lars@metafoo.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muchamadcoirulanwar@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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