[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DDDS2V0V2NVJ.16ZKXCKUA1HUV@kernel.org>
Date: Thu, 09 Oct 2025 14:08:24 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Markus Probst" <markus.probst@...teo.de>
Cc: "Lee Jones" <lee@...nel.org>, "Pavel Machek" <pavel@...nel.org>, "Miguel
Ojeda" <ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Igor
Korotin" <igor.korotin.linux@...il.com>, "Lorenzo Stoakes"
<lorenzo.stoakes@...cle.com>, "Vlastimil Babka" <vbabka@...e.cz>, "Liam R.
Howlett" <Liam.Howlett@...cle.com>, "Uladzislau Rezki" <urezki@...il.com>,
"Boqun Feng" <boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
<bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Andreas
Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Daniel Almeida"
<daniel.almeida@...labora.com>, <linux-leds@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/4] rust: i2c: add read and write byte data
abstractions
On Wed Oct 8, 2025 at 8:10 PM CEST, Markus Probst wrote:
> In addition to the core abstractions, implement
>
> * `i2c::I2cClient::read_byte` - read a byte from the i2c client
> * `i2c::I2cClient::write_byte` - write a byte to the i2c client
>
> * `i2c::I2cClient::read_byte_data` - read byte data from the i2c client
> * `i2c::I2cClient::write_byte_data` - write byte data to the i2c client
>
> * `i2c::I2cClient::read_word_data` - read word data from the i2c client
> * `i2c::I2cClient::write_word_data` - write word data to the i2c client
I don't think those should be implemented to be used by drivers directly.
Instead we should generalize the Io type [1] and allow for arbitrary backends,
such that we can use the register!() macro [2] to define register types for I2C
devices.
Ideally, an I2C / SMBus backend should use regmap right away.
The register!() macro is currently moved into the generic infrastructure [3].
[1] https://rust.docs.kernel.org/kernel/io/struct.Io.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/nova-core/regs/macros.rs
[3] https://lore.kernel.org/all/20251003154748.1687160-1-joelagnelf@nvidia.com/
Powered by blists - more mailing lists