summaryrefslogtreecommitdiff
path: root/rust/kernel/lib.rs
diff options
context:
space:
mode:
authorIgor Korotin <igor.korotin.linux@gmail.com>2025-11-16 16:21:44 +0000
committerDanilo Krummrich <dakr@kernel.org>2025-11-18 10:26:42 +1300
commit57c5bd9aee944b0f5c2ab314e10a86fae51f7bf2 (patch)
tree75731058140a29f5ec4639f9cd252575c80b8acb /rust/kernel/lib.rs
parentdd6ff5cf56fb183fce605ca6a5bfce228cd8888b (diff)
rust: i2c: add basic I2C device and driver abstractions
Implement the core abstractions needed for I2C drivers, including: * `i2c::Driver` — the trait drivers must implement, including `probe` * `i2c::I2cClient` — a safe wrapper around `struct i2c_client` * `i2c::Adapter` — implements `driver::RegistrationOps` to hook into the generic `driver::Registration` machinery * `i2c::DeviceId` — a `RawDeviceIdIndex` implementation for I2C device IDs Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Igor Korotin <igor.korotin.linux@gmail.com> Link: https://patch.msgid.link/20251116162144.171469-1-igor.korotin.linux@gmail.com [ Remove unnecessary safety comment; fix rustdoc `Device` -> `I2cClient`. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/lib.rs')
-rw-r--r--rust/kernel/lib.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 3dd7bebe7888..8c0070a8029e 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -94,6 +94,8 @@ pub mod faux;
pub mod firmware;
pub mod fmt;
pub mod fs;
+#[cfg(CONFIG_I2C = "y")]
+pub mod i2c;
pub mod id_pool;
pub mod init;
pub mod io;