Lines Matching full:policy

55     /// Supports multiple clock domains with per-policy governors in `cpu/cpuN/cpufreq/`.
120 /// Policy data.
210 /// use kernel::cpufreq::{Policy, TableIndex};
212 /// fn show_freq(policy: &Policy) -> Result {
213 /// let table = policy.freq_table()?;
387 /// CPU frequency policy.
393 /// A [`Policy`] instance always corresponds to a valid C `struct cpufreq_policy`.
403 /// use kernel::cpufreq::{ETERNAL_LATENCY_NS, Policy};
405 /// fn update_policy(policy: &mut Policy) {
406 /// policy
411 /// pr_info!("The policy details are: {:?}\n", (policy.cpu(), policy.cur()));
415 pub struct Policy(Opaque<bindings::cpufreq_policy>);
417 impl Policy {
467 /// Returns the primary CPU for the [`Policy`].
474 /// Returns the minimum frequency for the [`Policy`].
480 /// Set the minimum frequency for the [`Policy`].
487 /// Returns the maximum frequency for the [`Policy`].
493 /// Set the maximum frequency for the [`Policy`].
500 /// Returns the current frequency for the [`Policy`].
506 /// Returns the suspend frequency for the [`Policy`].
512 /// Sets the suspend frequency for the [`Policy`].
541 /// Gets [`cpumask::Cpumask`] for a cpufreq [`Policy`].
549 /// Sets clock for the [`Policy`].
582 /// Sets transition latency (in nanoseconds) for the [`Policy`].
611 /// Returns reference to the CPU frequency [`Table`] for the [`Policy`].
622 /// Sets the CPU frequency [`Table`] for the [`Policy`].
634 /// Returns the [`Policy`]'s private data.
644 /// Sets the private data of the [`Policy`] using a foreign-ownable wrapper.
675 /// CPU frequency policy created from a CPU number.
677 /// This struct represents the CPU frequency policy obtained for a specific CPU, providing safe
680 struct PolicyCpu<'a>(&'a mut Policy);
690 unsafe { Policy::from_raw_mut(ptr) },
696 type Target = Policy;
704 fn deref_mut(&mut self) -> &mut Policy {
732 /// Policy specific data.
739 fn init(policy: &mut Policy) -> Result<Self::PData>;
742 fn exit(_policy: &mut Policy, _data: Option<Self::PData>) -> Result {
747 fn online(_policy: &mut Policy) -> Result {
752 fn offline(_policy: &mut Policy) -> Result {
757 fn suspend(_policy: &mut Policy) -> Result {
762 fn resume(_policy: &mut Policy) -> Result {
767 fn ready(_policy: &mut Policy) {
775 fn setpolicy(_policy: &mut Policy) -> Result {
780 fn target(_policy: &mut Policy, _target_freq: u32, _relation: Relation) -> Result {
785 fn target_index(_policy: &mut Policy, _index: TableIndex) -> Result {
790 fn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32 {
795 fn adjust_perf(_policy: &mut Policy, _min_perf: usize, _target_perf: usize, _capacity: usize) {
800 fn get_intermediate(_policy: &mut Policy, _index: TableIndex) -> u32 {
805 fn target_intermediate(_policy: &mut Policy, _index: TableIndex) -> Result {
810 fn get(_policy: &mut Policy) -> Result<u32> {
815 fn update_limits(_policy: &mut Policy) {
820 fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result {
825 fn set_boost(_policy: &mut Policy, _state: i32) -> Result {
830 fn register_em(_policy: &mut Policy) {
863 /// fn init(policy: &mut cpufreq::Policy) -> Result<Self::PData> {
868 /// fn exit(_policy: &mut cpufreq::Policy, _data: Option<Self::PData>) -> Result {
872 /// fn suspend(policy: &mut cpufreq::Policy) -> Result {
873 /// policy.generic_suspend()
880 /// fn target_index(policy: &mut cpufreq::Policy, index: cpufreq::TableIndex) -> Result {
885 /// fn get(policy: &mut cpufreq::Policy) -> Result<u32> {
886 /// policy.generic_get()
1070 // lifetime of `policy`.
1071 let policy = unsafe { Policy::from_raw_mut(ptr) };
1073 let data = T::init(policy)?;
1074 policy.set_data(data)?;
1087 // lifetime of `policy`.
1088 let policy = unsafe { Policy::from_raw_mut(ptr) };
1090 let data = policy.clear_data();
1091 let _ = T::exit(policy, data);
1103 // lifetime of `policy`.
1104 let policy = unsafe { Policy::from_raw_mut(ptr) };
1105 T::online(policy).map(|()| 0)
1118 // lifetime of `policy`.
1119 let policy = unsafe { Policy::from_raw_mut(ptr) };
1120 T::offline(policy).map(|()| 0)
1133 // lifetime of `policy`.
1134 let policy = unsafe { Policy::from_raw_mut(ptr) };
1135 T::suspend(policy).map(|()| 0)
1148 // lifetime of `policy`.
1149 let policy = unsafe { Policy::from_raw_mut(ptr) };
1150 T::resume(policy).map(|()| 0)
1162 // lifetime of `policy`.
1163 let policy = unsafe { Policy::from_raw_mut(ptr) };
1164 T::ready(policy);
1176 // lifetime of `policy`.
1191 // lifetime of `policy`.
1192 let policy = unsafe { Policy::from_raw_mut(ptr) };
1193 T::setpolicy(policy).map(|()| 0)
1210 // lifetime of `policy`.
1211 let policy = unsafe { Policy::from_raw_mut(ptr) };
1212 T::target(policy, target_freq, Relation::new(relation)?).map(|()| 0)
1228 // lifetime of `policy`.
1229 let policy = unsafe { Policy::from_raw_mut(ptr) };
1235 T::target_index(policy, index).map(|()| 0)
1250 // lifetime of `policy`.
1251 let policy = unsafe { Policy::from_raw_mut(ptr) };
1252 T::fast_switch(policy, target_freq)
1269 if let Ok(mut policy) = PolicyCpu::from_cpu(cpu_id) {
1270 T::adjust_perf(&mut policy, min_perf, target_perf, capacity);
1285 // lifetime of `policy`.
1286 let policy = unsafe { Policy::from_raw_mut(ptr) };
1292 T::get_intermediate(policy, index)
1307 // lifetime of `policy`.
1308 let policy = unsafe { Policy::from_raw_mut(ptr) };
1314 T::target_intermediate(policy, index).map(|()| 0)
1327 PolicyCpu::from_cpu(cpu_id).map_or(0, |mut policy| T::get(&mut policy).map_or(0, |f| f))
1338 // lifetime of `policy`.
1339 let policy = unsafe { Policy::from_raw_mut(ptr) };
1340 T::update_limits(policy);
1354 let mut policy = PolicyCpu::from_cpu(cpu_id)?;
1357 T::bios_limit(&mut policy, &mut (unsafe { *limit })).map(|()| 0)
1373 // lifetime of `policy`.
1374 let policy = unsafe { Policy::from_raw_mut(ptr) };
1375 T::set_boost(policy, state).map(|()| 0)
1387 // lifetime of `policy`.
1388 let policy = unsafe { Policy::from_raw_mut(ptr) };
1389 T::register_em(policy);