Lines Matching defs:OPP
5 //! This module provides rust abstractions for interacting with the OPP subsystem.
30 /// OPP frequency table.
153 /// Handle for a dynamically created [`OPP`].
155 /// The associated [`OPP`] is automatically removed when the [`Token`] is dropped.
159 /// The following example demonstrates how to create an [`OPP`] dynamically.
171 /// // OPP is removed once token goes out of scope.
181 /// Dynamically adds an [`OPP`] and returns a [`Token`] that removes it on drop.
201 /// OPP data.
208 /// The following example demonstrates how to create an [`OPP`] with [`Data`].
220 /// // OPP is removed once token goes out of scope.
230 /// This can be used to define a dynamic OPP to be added to a device.
240 /// Adds an [`OPP`] dynamically.
242 /// Returns a [`Token`] that ensures the OPP is automatically removed
249 /// Returns the frequency associated with this OPP data.
256 /// [`OPP`] search options.
260 /// Defines how to search for an [`OPP`] in a [`Table`] relative to a frequency.
265 /// use kernel::opp::{OPP, SearchType, Table};
268 /// fn find_opp(table: &Table, freq: Hertz) -> Result<ARef<OPP>> {
271 /// pr_info!("OPP frequency is: {:?}\n", opp.freq(None));
272 /// pr_info!("OPP voltage is: {:?}\n", opp.voltage());
273 /// pr_info!("OPP level is: {}\n", opp.level());
274 /// pr_info!("OPP power is: {:?}\n", opp.power());
289 /// OPP configuration callbacks.
291 /// Implement this trait to customize OPP clock and regulator setup for your device.
296 fn config_clks(_dev: &Device, _table: &Table, _opp: &OPP, _scaling_down: bool) -> Result {
304 _opp_old: &OPP,
305 _opp_new: &OPP,
313 /// OPP configuration token.
315 /// Returned by the OPP core when configuration is applied to a [`Device`]. The associated
326 /// OPP configurations.
332 /// The following example demonstrates how to set OPP property-name configuration for a [`Device`].
351 /// // The OPP configuration is cleared once the [`ConfigToken`] goes out of scope.
442 /// Sets the configuration with the OPP core.
501 // requirements. The OPP core guarantees not to access fields of [`Config`] after this call
526 unsafe { OPP::from_raw_opp(opp)? },
549 unsafe { OPP::from_raw_opp(old_opp)? },
551 unsafe { OPP::from_raw_opp(new_opp)? },
560 /// A reference-counted OPP table.
572 /// The following example demonstrates how to get OPP [`Table`] for a [`Cpumask`] and set its
709 /// Returns the number of [`OPP`]s in the [`Table`].
718 /// Returns max clock latency (in nanoseconds) of the [`OPP`]s in the [`Table`].
726 /// Returns max volt latency (in nanoseconds) of the [`OPP`]s in the [`Table`].
734 /// Returns max transition latency (in nanoseconds) of the [`OPP`]s in the [`Table`].
742 /// Returns the suspend [`OPP`]'s frequency.
793 /// Updates the voltage value for an [`OPP`].
822 /// Configures device with [`OPP`] matching the frequency value.
830 /// Configures device with [`OPP`].
832 pub fn set_opp(&self, opp: &OPP) -> Result {
838 /// Finds [`OPP`] based on frequency.
845 ) -> Result<ARef<OPP>> {
855 // [`OPP`] instance.
867 // requirements. The returned pointer will be owned by the new [`OPP`] instance.
873 // requirements. The returned pointer will be owned by the new [`OPP`] instance.
880 unsafe { OPP::from_raw_opp_owned(ptr) }
883 /// Finds [`OPP`] based on level.
884 pub fn opp_from_level(&self, mut level: u32, stype: SearchType) -> Result<ARef<OPP>> {
889 // requirements. The returned pointer will be owned by the new [`OPP`] instance.
893 // requirements. The returned pointer will be owned by the new [`OPP`] instance.
899 // requirements. The returned pointer will be owned by the new [`OPP`] instance.
906 unsafe { OPP::from_raw_opp_owned(ptr) }
909 /// Finds [`OPP`] based on bandwidth.
910 pub fn opp_from_bw(&self, mut bw: u32, index: i32, stype: SearchType) -> Result<ARef<OPP>> {
914 // The OPP core doesn't support this yet.
918 // requirements. The returned pointer will be owned by the new [`OPP`] instance.
924 // requirements. The returned pointer will be owned by the new [`OPP`] instance.
931 unsafe { OPP::from_raw_opp_owned(ptr) }
934 /// Enables the [`OPP`].
942 /// Disables the [`OPP`].
995 /// A reference-counted Operating performance point (OPP).
1001 /// The pointer stored in `Self` is non-null and valid for the lifetime of the [`OPP`].
1004 /// `dev_pm_opp_get` function and decremented by `dev_pm_opp_put`. The Rust type `ARef<OPP>`
1005 /// represents a pointer that owns a reference count on the [`OPP`].
1007 /// A reference to the [`OPP`], &[`OPP`], isn't refcounted by the Rust code.
1011 /// The following example demonstrates how to get [`OPP`] corresponding to a frequency value and
1030 pub struct OPP(Opaque<bindings::dev_pm_opp>);
1032 /// SAFETY: It is okay to send the ownership of [`OPP`] across thread boundaries.
1033 unsafe impl Send for OPP {}
1035 /// SAFETY: It is okay to access [`OPP`] through shared references from other threads because we're
1037 unsafe impl Sync for OPP {}
1039 /// SAFETY: The type invariants guarantee that [`OPP`] is always refcounted.
1040 unsafe impl AlwaysRefCounted for OPP {
1052 impl OPP {
1053 /// Creates an owned reference to a [`OPP`] from a valid pointer.
1060 /// The caller must ensure that `ptr` is valid and the refcount of the [`OPP`] is incremented.
1061 /// The caller must also ensure that it doesn't explicitly drop the refcount of the [`OPP`], as
1069 // INVARIANT: The reference-count is decremented when [`OPP`] goes out of scope.
1073 /// Creates a reference to a [`OPP`] from a valid pointer.
1084 // duration of 'a. The cast is okay because [`OPP`] is `repr(transparent)`.
1093 /// Returns the frequency of an [`OPP`].
1102 /// Returns the voltage of an [`OPP`].
1110 /// Returns the level of an [`OPP`].
1118 /// Returns the power of an [`OPP`].
1126 /// Returns the required pstate of an [`OPP`].
1134 /// Returns true if the [`OPP`] is turbo.