Lines Matching +full:reference +full:- +full:out
1 // SPDX-License-Identifier: GPL-2.0
9 //! Reference: <https://docs.kernel.org/power/opp.html>
40 pub(crate) fn new(table: &Table) -> Result<Self> { in new()
55 /// Returns a reference to the underlying [`cpufreq::Table`].
57 fn table(&self) -> &cpufreq::Table { in table()
67 fn deref(&self) -> &Self::Target { in deref()
90 /// Creates a null-terminated slice of pointers to [`CString`]s.
91 fn to_c_str_array(names: &[CString]) -> Result<KVec<*const c_char>> { in to_c_str_array()
92 // Allocated a null-terminated vector of pointers. in to_c_str_array()
123 fn from(volt: MicroVolt) -> Self { in from()
148 fn from(power: MicroWatt) -> Self { in from()
168 /// fn create_opp(dev: &ARef<Device>, freq: Hertz, volt: MicroVolt, level: u32) -> Result<Token> {
171 /// // OPP is removed once token goes out of scope.
182 fn new(dev: &ARef<Device>, mut data: Data) -> Result<Self> { in new()
217 /// fn create_opp(dev: &ARef<Device>, freq: Hertz, volt: MicroVolt, level: u32) -> Result<Token> {
220 /// // OPP is removed once token goes out of scope.
231 pub fn new(freq: Hertz, volt: MicroVolt, level: u32, turbo: bool) -> Self { in new()
243 /// when it goes out of scope.
245 pub fn add_opp(self, dev: &ARef<Device>) -> Result<Token> { in add_opp()
251 fn freq(&self) -> Hertz { in freq()
268 /// fn find_opp(table: &Table, freq: Hertz) -> Result<ARef<OPP>> {
296 fn config_clks(_dev: &Device, _table: &Table, _opp: &OPP, _scaling_down: bool) -> Result { in config_clks()
308 ) -> Result { in config_regulators()
332 /// The following example demonstrates how to set OPP property-name configuration for a [`Device`].
348 /// fn configure(dev: &ARef<Device>) -> Result<ConfigToken> {
351 /// // The OPP configuration is cleared once the [`ConfigToken`] goes out of scope.
375 pub fn new() -> Self { in new()
380 pub fn set_clk_names(mut self, names: KVec<CString>) -> Result<Self> { in set_clk_names()
394 pub fn set_prop_name(mut self, name: CString) -> Result<Self> { in set_prop_name()
404 pub fn set_regulator_names(mut self, names: KVec<CString>) -> Result<Self> { in set_regulator_names()
419 pub fn set_required_dev(mut self, dev: ARef<Device>, index: u32) -> Result<Self> { in set_required_dev()
429 pub fn set_supported_hw(mut self, hw: KVec<u32>) -> Result<Self> { in set_supported_hw()
445 pub fn set(self, dev: &Device) -> Result<ConfigToken> { in set()
505 // closure is `FnOnce` because it moves the variable `clk_names` out of its environment in set()
507 let _: &dyn Fn() -> _ = &set_config; in set()
521 ) -> c_int { in config_clks()
546 ) -> c_int { in config_regulators()
564 /// A reference-counted OPP table.
570 /// The pointer stored in `Self` is non-null and valid for the lifetime of the [`Table`].
572 /// Instances of this type are reference-counted.
588 /// fn get_table(dev: &ARef<Device>, mask: &mut Cpumask, freq: Hertz) -> Result<Table> {
620 /// Creates a new reference-counted [`Table`] from a raw pointer.
624 /// Callers must ensure that `ptr` is valid and non-null.
625 unsafe fn from_raw_table(ptr: *mut bindings::opp_table, dev: &ARef<Device>) -> Self { in from_raw_table()
628 // INVARIANT: The reference-count is decremented when [`Table`] goes out of scope. in from_raw_table()
640 /// Creates a new reference-counted [`Table`] instance for a [`Device`].
641 pub fn from_dev(dev: &Device) -> Result<Self> { in from_dev()
645 // INVARIANT: The reference-count is incremented by the C code and is decremented when in from_dev()
646 // [`Table`] goes out of scope. in from_dev()
658 /// Creates a new reference-counted [`Table`] instance for a [`Device`] based on device tree
661 pub fn from_of(dev: &ARef<Device>, index: i32) -> Result<Self> { in from_of()
665 // INVARIANT: The reference-count is incremented by the C code and is decremented when in from_of()
666 // [`Table`] goes out of scope. in from_of()
681 // requirements. We took the reference from [`from_of`] earlier, it is safe to drop the in remove_of()
686 /// Creates a new reference-counted [`Table`] instance for a [`Cpumask`] based on device tree
689 pub fn from_of_cpumask(dev: &Device, cpumask: &mut Cpumask) -> Result<Self> { in from_of_cpumask()
693 // INVARIANT: The reference-count is incremented by the C code and is decremented when in from_of_cpumask()
694 // [`Table`] goes out of scope. in from_of_cpumask()
708 // SAFETY: The cpumask is valid and we took the reference from [`from_of_cpumask`] earlier, in remove_of_cpumask()
714 pub fn opp_count(&self) -> Result<u32> { in opp_count()
724 pub fn max_clock_latency_ns(&self) -> usize { in max_clock_latency_ns()
732 pub fn max_volt_latency_ns(&self) -> usize { in max_volt_latency_ns()
740 pub fn max_transition_latency_ns(&self) -> usize { in max_transition_latency_ns()
748 pub fn suspend_freq(&self) -> Hertz { in suspend_freq()
756 pub fn sync_regulators(&self) -> Result { in sync_regulators()
764 pub fn sharing_cpus(dev: &Device, cpumask: &mut Cpumask) -> Result { in sharing_cpus()
771 pub fn set_sharing_cpus(&mut self, cpumask: &mut Cpumask) -> Result { in set_sharing_cpus()
789 pub fn of_sharing_cpus(dev: &Device, cpumask: &mut Cpumask) -> Result { in of_sharing_cpus()
805 ) -> Result { in adjust_voltage()
822 pub fn cpufreq_table(&mut self) -> Result<FreqTable> { in cpufreq_table()
828 pub fn set_rate(&self, freq: Hertz) -> Result { in set_rate()
836 pub fn set_opp(&self, opp: &OPP) -> Result { in set_opp()
849 ) -> Result<ARef<OPP>> { in opp_from_freq()
888 pub fn opp_from_level(&self, mut level: u32, stype: SearchType) -> Result<ARef<OPP>> { in opp_from_level()
914 pub fn opp_from_bw(&self, mut bw: u32, index: i32, stype: SearchType) -> Result<ARef<OPP>> { in opp_from_bw()
940 pub fn enable_opp(&self, freq: Hertz) -> Result { in enable_opp()
948 pub fn disable_opp(&self, freq: Hertz) -> Result { in disable_opp()
956 pub fn of_register_em(&mut self, cpumask: &mut Cpumask) -> Result { in of_register_em()
979 // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe in drop()
999 /// A reference-counted Operating performance point (OPP).
1005 /// The pointer stored in `Self` is non-null and valid for the lifetime of the [`OPP`].
1007 /// Instances of this type are reference-counted. The reference count is incremented by the
1009 /// represents a pointer that owns a reference count on the [`OPP`].
1011 /// A reference to the [`OPP`], &[`OPP`], isn't refcounted by the Rust code.
1023 /// fn configure_opp(table: &Table, freq: Hertz) -> Result {
1046 // SAFETY: The existence of a shared reference means that the refcount is nonzero. in inc_ref()
1057 /// Creates an owned reference to a [`OPP`] from a valid pointer.
1068 pub unsafe fn from_raw_opp_owned(ptr: *mut bindings::dev_pm_opp) -> Result<ARef<Self>> { in from_raw_opp_owned()
1073 // INVARIANT: The reference-count is decremented when [`OPP`] goes out of scope. in from_raw_opp_owned()
1077 /// Creates a reference to a [`OPP`] from a valid pointer.
1079 /// The refcount is not updated by the Rust API unless the returned reference is converted to
1086 pub unsafe fn from_raw_opp<'a>(ptr: *mut bindings::dev_pm_opp) -> Result<&'a Self> { in from_raw_opp()
1093 fn as_raw(&self) -> *mut bindings::dev_pm_opp { in as_raw()
1098 pub fn freq(&self, index: Option<u32>) -> Hertz { in freq()
1101 // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to in freq()
1108 pub fn voltage(&self) -> MicroVolt { in voltage()
1109 // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to in voltage()
1116 pub fn level(&self) -> u32 { in level()
1117 // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to in level()
1124 pub fn power(&self) -> MicroWatt { in power()
1125 // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to in power()
1132 pub fn required_pstate(&self, index: u32) -> u32 { in required_pstate()
1133 // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to in required_pstate()
1140 pub fn is_turbo(&self) -> bool { in is_turbo()
1141 // SAFETY: By the type invariants, we know that `self` owns a reference, so it is safe to in is_turbo()