Lines Matching full:policy

54     /// Supports multiple clock domains with per-policy governors in `cpu/cpuN/cpufreq/`.
119 /// Policy data.
209 /// use kernel::cpufreq::{Policy, TableIndex};
211 /// fn show_freq(policy: &Policy) -> Result {
212 /// let table = policy.freq_table()?;
386 /// CPU frequency policy.
392 /// A [`Policy`] instance always corresponds to a valid C `struct cpufreq_policy`.
402 /// use kernel::cpufreq::{DEFAULT_TRANSITION_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>); struct
417 impl Policy { impl
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) }, in from_cpu()
696 type Target = Policy;
704 fn deref_mut(&mut self) -> &mut Policy { in deref_mut() argument
732 /// Policy specific data.
739 fn init(policy: &mut Policy) -> Result<Self::PData>; in init()
742 fn exit(_policy: &mut Policy, _data: Option<Self::PData>) -> Result { in exit() argument
747 fn online(_policy: &mut Policy) -> Result { in online()
752 fn offline(_policy: &mut Policy) -> Result { in offline()
757 fn suspend(_policy: &mut Policy) -> Result { in suspend()
762 fn resume(_policy: &mut Policy) -> Result { in resume()
767 fn ready(_policy: &mut Policy) { in ready() argument
775 fn setpolicy(_policy: &mut Policy) -> Result { in setpolicy()
780 fn target(_policy: &mut Policy, _target_freq: u32, _relation: Relation) -> Result { in target() argument
785 fn target_index(_policy: &mut Policy, _index: TableIndex) -> Result { in target_index() argument
790 fn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32 { in fast_switch() argument
795 fn adjust_perf(_policy: &mut Policy, _min_perf: usize, _target_perf: usize, _capacity: usize) { in adjust_perf() argument
800 fn get_intermediate(_policy: &mut Policy, _index: TableIndex) -> u32 { in get_intermediate() argument
805 fn target_intermediate(_policy: &mut Policy, _index: TableIndex) -> Result { in target_intermediate() argument
810 fn get(_policy: &mut Policy) -> Result<u32> { in get()
815 fn update_limits(_policy: &mut Policy) { in update_limits() argument
820 fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result { in bios_limit() argument
825 fn set_boost(_policy: &mut Policy, _state: i32) -> Result { in set_boost() argument
830 fn register_em(_policy: &mut Policy) { in register_em() argument
862 /// fn init(policy: &mut cpufreq::Policy) -> Result<Self::PData> {
867 /// fn exit(_policy: &mut cpufreq::Policy, _data: Option<Self::PData>) -> Result {
871 /// fn suspend(policy: &mut cpufreq::Policy) -> Result {
872 /// policy.generic_suspend()
879 /// fn target_index(policy: &mut cpufreq::Policy, index: cpufreq::TableIndex) -> Result {
884 /// fn get(policy: &mut cpufreq::Policy) -> Result<u32> {
885 /// policy.generic_get()
1070 // lifetime of `policy`. in init_callback()
1071 let policy = unsafe { Policy::from_raw_mut(ptr) }; in init_callback() localVariable
1073 let data = T::init(policy)?; in init_callback()
1074 policy.set_data(data)?; in init_callback()
1087 // lifetime of `policy`. in exit_callback()
1088 let policy = unsafe { Policy::from_raw_mut(ptr) }; in exit_callback() localVariable
1090 let data = policy.clear_data(); in exit_callback()
1091 let _ = T::exit(policy, data); in exit_callback()
1103 // lifetime of `policy`. in online_callback()
1104 let policy = unsafe { Policy::from_raw_mut(ptr) }; in online_callback() localVariable
1105 T::online(policy).map(|()| 0) in online_callback()
1118 // lifetime of `policy`. in offline_callback()
1119 let policy = unsafe { Policy::from_raw_mut(ptr) }; in offline_callback() localVariable
1120 T::offline(policy).map(|()| 0) in offline_callback()
1133 // lifetime of `policy`. in suspend_callback()
1134 let policy = unsafe { Policy::from_raw_mut(ptr) }; in suspend_callback() localVariable
1135 T::suspend(policy).map(|()| 0) in suspend_callback()
1148 // lifetime of `policy`. in resume_callback()
1149 let policy = unsafe { Policy::from_raw_mut(ptr) }; in resume_callback() localVariable
1150 T::resume(policy).map(|()| 0) in resume_callback()
1162 // lifetime of `policy`. in ready_callback()
1163 let policy = unsafe { Policy::from_raw_mut(ptr) }; in ready_callback() localVariable
1164 T::ready(policy); in ready_callback()
1176 // lifetime of `policy`. in verify_callback()
1191 // lifetime of `policy`. in setpolicy_callback()
1192 let policy = unsafe { Policy::from_raw_mut(ptr) }; in setpolicy_callback() localVariable
1193 T::setpolicy(policy).map(|()| 0) in setpolicy_callback()
1210 // lifetime of `policy`. in target_callback()
1211 let policy = unsafe { Policy::from_raw_mut(ptr) }; in target_callback() localVariable
1212 T::target(policy, target_freq, Relation::new(relation)?).map(|()| 0) in target_callback()
1228 // lifetime of `policy`. in target_index_callback()
1229 let policy = unsafe { Policy::from_raw_mut(ptr) }; in target_index_callback() localVariable
1235 T::target_index(policy, index).map(|()| 0) in target_index_callback()
1250 // lifetime of `policy`. in fast_switch_callback()
1251 let policy = unsafe { Policy::from_raw_mut(ptr) }; in fast_switch_callback() localVariable
1252 T::fast_switch(policy, target_freq) in fast_switch_callback()
1269 if let Ok(mut policy) = PolicyCpu::from_cpu(cpu_id) { in adjust_perf_callback()
1270 T::adjust_perf(&mut policy, min_perf, target_perf, capacity); in adjust_perf_callback()
1285 // lifetime of `policy`. in get_intermediate_callback()
1286 let policy = unsafe { Policy::from_raw_mut(ptr) }; in get_intermediate_callback() localVariable
1292 T::get_intermediate(policy, index) in get_intermediate_callback()
1307 // lifetime of `policy`. in target_intermediate_callback()
1308 let policy = unsafe { Policy::from_raw_mut(ptr) }; in target_intermediate_callback() localVariable
1314 T::target_intermediate(policy, index).map(|()| 0) in target_intermediate_callback()
1327 PolicyCpu::from_cpu(cpu_id).map_or(0, |mut policy| T::get(&mut policy).map_or(0, |f| f)) in get_callback()
1338 // lifetime of `policy`. in update_limits_callback()
1339 let policy = unsafe { Policy::from_raw_mut(ptr) }; in update_limits_callback() localVariable
1340 T::update_limits(policy); in update_limits_callback()
1354 let mut policy = PolicyCpu::from_cpu(cpu_id)?; in bios_limit_callback() localVariable
1357 T::bios_limit(&mut policy, &mut (unsafe { *limit })).map(|()| 0) in bios_limit_callback()
1373 // lifetime of `policy`. in set_boost_callback()
1374 let policy = unsafe { Policy::from_raw_mut(ptr) }; in set_boost_callback() localVariable
1375 T::set_boost(policy, state).map(|()| 0) in set_boost_callback()
1387 // lifetime of `policy`. in register_em_callback()
1388 let policy = unsafe { Policy::from_raw_mut(ptr) }; in register_em_callback() localVariable
1389 T::register_em(policy); in register_em_callback()