pub struct Config<T>{ /* private fields */ }
Expand description
OPP configurations.
Rust abstraction for the C struct dev_pm_opp_config
.
§Examples
The following example demonstrates how to set OPP property-name configuration for a Device
.
use kernel::device::Device;
use kernel::error::Result;
use kernel::opp::{Config, ConfigOps, ConfigToken};
use kernel::str::CString;
use kernel::types::ARef;
use kernel::macros::vtable;
#[derive(Default)]
struct Driver;
#[vtable]
impl ConfigOps for Driver {}
fn configure(dev: &ARef<Device>) -> Result<ConfigToken> {
let name = CString::try_from_fmt(fmt!("{}", "slow"))?;
// The OPP configuration is cleared once the [`ConfigToken`] goes out of scope.
Config::<Driver>::new()
.set_prop_name(name)?
.set(dev)
}
Implementations§
Source§impl<T: ConfigOps + Default> Config<T>
impl<T: ConfigOps + Default> Config<T>
Sourcepub fn set_clk_names(self, names: KVec<CString>) -> Result<Self>
pub fn set_clk_names(self, names: KVec<CString>) -> Result<Self>
Initializes clock names.
Sourcepub fn set_prop_name(self, name: CString) -> Result<Self>
pub fn set_prop_name(self, name: CString) -> Result<Self>
Initializes property name.
Sourcepub fn set_regulator_names(self, names: KVec<CString>) -> Result<Self>
pub fn set_regulator_names(self, names: KVec<CString>) -> Result<Self>
Initializes regulator names.
Sourcepub fn set_required_dev(self, dev: ARef<Device>, index: u32) -> Result<Self>
pub fn set_required_dev(self, dev: ARef<Device>, index: u32) -> Result<Self>
Initializes required devices.
Sourcepub fn set_supported_hw(self, hw: KVec<u32>) -> Result<Self>
pub fn set_supported_hw(self, hw: KVec<u32>) -> Result<Self>
Initializes supported hardware.
Sourcepub fn set(self, dev: &Device) -> Result<ConfigToken>
pub fn set(self, dev: &Device) -> Result<ConfigToken>
Sets the configuration with the OPP core.
The returned ConfigToken
will remove the configuration when dropped.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Config<T>
impl<T> !RefUnwindSafe for Config<T>
impl<T> Send for Config<T>where
T: Send,
impl<T> Sync for Config<T>where
T: Sync,
impl<T> !Unpin for Config<T>
impl<T> !UnwindSafe for Config<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more