pub struct RockchipPM { /* private fields */ }Expand description
Rockchip Power Management Unit driver
This structure provides control over power domains for Rockchip SoCs, allowing dynamic power gating of various IP blocks like GPU, NPU, VCODEC, etc.
Implementations§
Source§impl RockchipPM
impl RockchipPM
Sourcepub fn new(base: NonNull<u8>, board: RkBoard) -> Self
pub fn new(base: NonNull<u8>, board: RkBoard) -> Self
Create a new RockchipPM driver instance
§Arguments
base- Base address of the PMU registersboard- The specific board type (RK3588 or RK3568)
§Example
use rockchip_pm::{RockchipPM, RkBoard};
use core::ptr::NonNull;
let base = unsafe { NonNull::new_unchecked(0xfd5d8000 as *mut u8) };
let pm = RockchipPM::new(base, RkBoard::Rk3588);Sourcepub fn new_with_compatible(base: NonNull<u8>, compatible: &str) -> Self
pub fn new_with_compatible(base: NonNull<u8>, compatible: &str) -> Self
Create a new RockchipPM driver instance using device tree compatible string
§Arguments
base- Base address of the PMU registerscompatible- Device tree compatible string (e.g., “rockchip,rk3588-power-controller”)
§Panics
Panics if the compatible string is not supported
§Example
use rockchip_pm::RockchipPM;
use core::ptr::NonNull;
let base = unsafe { NonNull::new_unchecked(0xfd5d8000 as *mut u8) };
let pm = RockchipPM::new_with_compatible(base, "rockchip,rk3588-power-controller");Sourcepub fn get_power_dowain_by_name(&self, name: &str) -> Option<PowerDomain>
pub fn get_power_dowain_by_name(&self, name: &str) -> Option<PowerDomain>
Sourcepub fn power_domain_on(&mut self, domain: PowerDomain) -> PmResult<()>
pub fn power_domain_on(&mut self, domain: PowerDomain) -> PmResult<()>
Turn on the specified power domain
This function enables power to the specified domain, initializing the associated hardware blocks.
§Arguments
domain- The power domain to turn on
§Errors
Returns PmError::DomainNotFound if the domain does not exist
Returns PmError::Timeout if the power domain fails to turn on within the timeout period
§Example
pm.power_domain_on(PowerDomain::NPU).unwrap();Sourcepub fn power_domain_off(&mut self, domain: PowerDomain) -> PmResult<()>
pub fn power_domain_off(&mut self, domain: PowerDomain) -> PmResult<()>
Turn off the specified power domain
This function cuts power to the specified domain, putting the associated hardware blocks into a low-power state.
§Arguments
domain- The power domain to turn off
§Errors
Returns PmError::DomainNotFound if the domain does not exist
Returns PmError::Timeout if the power domain fails to turn off within the timeout period
§Example
pm.power_domain_off(PowerDomain::NPU).unwrap();Trait Implementations§
Source§impl DriverGeneric for RockchipPM
impl DriverGeneric for RockchipPM
fn open(&mut self) -> Result<(), KError>
fn close(&mut self) -> Result<(), KError>
Source§fn raw_any(&self) -> Option<&(dyn Any + 'static)>
fn raw_any(&self) -> Option<&(dyn Any + 'static)>
&dyn AnySource§fn raw_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)>
fn raw_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)>
&mut dyn Any