rust: add hwmon, rtc, leds, watchdog, and nvmem abstractions and drivers - #1250
Open
ZonaTell wants to merge 6 commits into
Open
rust: add hwmon, rtc, leds, watchdog, and nvmem abstractions and drivers#1250ZonaTell wants to merge 6 commits into
ZonaTell wants to merge 6 commits into
Conversation
Add helper functions on I2cClient for common SMBus operations: smbus_read_byte_data, smbus_write_byte_data, smbus_read_word_data, and smbus_write_word_data. These helpers provide direct, safe access to standard SMBus register transactions for I2C device drivers written in Rust. Signed-off-by: Vladyslav Pobigun <vladyslav.pobigun@gmail.com>
Add safe Rust abstractions for the Hardware Monitoring (HWMON) subsystem. This allows writing hardware monitoring and temperature sensor drivers in pure, safe Rust. Also implement the in-tree LM75 digital temperature sensor driver utilizing these abstractions, supporting LM75, TMP75, TMP102, and MCP980x chips with two's complement fixed-point arithmetic and KUnit tests. Signed-off-by: Vladyslav Pobigun <vladyslav.pobigun@gmail.com>
Add safe Rust abstractions for the Real-Time Clock (RTC) subsystem, including RtcTime representation, BCD conversion utilities, and registration within rtc_class. Implement the PCF8563/RTC8564 I2C RTC driver in Rust supporting date and time read/write and low-voltage battery status detection. Signed-off-by: Vladyslav Pobigun <vladyslav.pobigun@gmail.com>
Add safe Rust abstractions for the LED Class subsystem supporting brightness control, blocking set callbacks, and hardware blinking. Implement the NXP PCA9530..PCA9533 LED driver in Rust with PWM dimming and prescaler-based blinking support. Signed-off-by: Vladyslav Pobigun <vladyslav.pobigun@gmail.com>
Add safe Rust abstractions for the Watchdog Timer subsystem, supporting start, stop, ping, and set_timeout operations. Implement the Zodiac Aerospace RAVE I2C watchdog driver in Rust. Signed-off-by: Vladyslav Pobigun <vladyslav.pobigun@gmail.com>
Add safe Rust abstractions for the Non-Volatile Memory (NVMEM) subsystem, supporting read and write operations across memory devices. Implement the Atmel/Microchip AT24 I2C EEPROM driver in Rust supporting 24C02 through 24C512 chips with 8-bit and 16-bit word addressing. Signed-off-by: Vladyslav Pobigun <vladyslav.pobigun@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This series introduces new safe Rust kernel subsystem abstractions and corresponding in-tree driver implementations across five major subsystems:
I2C & SMBus Helpers (
rust/kernel/i2c.rs):smbus_read_byte_data,smbus_write_byte_data,smbus_read_word_data,smbus_write_word_data).Hardware Monitoring (HWMON) (
rust/kernel/hwmon.rs):SensorType,TempAttribute,Operationstrait,ChipInfo/ChannelInfothread-safe wrappers, and RAIIRegistration.drivers/hwmon/lm75_rust.rs) with KUnit arithmetic tests.Real-Time Clock (RTC) (
rust/kernel/rtc.rs):RtcTimerepresentation, BCD conversion routines (bcd_to_bin,bin_to_bcd),Operationstrait, and class registration.drivers/rtc/rtc_pcf8563_rust.rs) with low-voltage detection.LED Class & PWM Dimming (
rust/kernel/leds.rs):Brightnesslevels,Operationstrait (brightness control, blocking callbacks, hardware blinking), and RAII registration.drivers/leds/leds_pca9532_rust.rs) with hardware prescaler and PWM blinking.Watchdog Timer (
rust/kernel/watchdog.rs):WatchdogFlags,Operationstrait (start,stop,ping,set_timeout), anddevm_watchdog_register_devicewrapper.drivers/watchdog/ziirave_wdt_rust.rs).Non-Volatile Memory (NVMEM) (
rust/kernel/nvmem.rs):NvmemType,Operationstrait for byte-level memory reads/writes, and registration.drivers/misc/eeprom/at24_rust.rs) supporting 24C02 through 24C512 chips with 8-bit and 16-bit word addressing.Verification
-D warningsand-D missing-docs.modinfo.Signed-off-by: Vladyslav Pobigun vladyslav.pobigun@gmail.com