Skip to content

Conversation

ytakano
Copy link
Collaborator

@ytakano ytakano commented Apr 3, 2025

Description

Related links

How was this PR tested?

Notes for reviewers

Signed-off-by: Yuuki Takano <[email protected]>
@ytakano
Copy link
Collaborator Author

ytakano commented Apr 3, 2025

@atsushi421

I added four methods to Dvfs.

  • set_min_performance(min: u8) -> bool
  • get_min_performance() -> Option<u8>
  • set_max_performance(max: u8) -> bool
  • get_max_performance() -> Option<u8>

Additionally, update the return value of convention methods to return bool or Option<u64>.
What do you think?

pub trait Dvfs {
    /// Fix the frequency of the current CPU.
    ///
    /// If current driver does not support this operation,
    /// it will return `false`.
    fn fix_freq(freq: u64) -> bool {
        false
    }

    /// Get the maximum frequency of the current CPU.
    ///
    /// If current driver does not support this operation,
    /// it will return `None`.
    fn get_max_freq() -> Option<u64> {
        None
    }

    /// Get the frequency of the current CPU.
    ///
    /// If current driver does not support this operation,
    /// it will return `None`.
    fn get_curr_freq() -> Option<u64> {
        None
    }

    /// Select the Minimum Performance.
    /// (range from 0, lowest performant, through 100, highest performance)
    ///
    /// If current driver does not support this operation,
    /// it will return `false`.
    fn set_min_performance(min: u8) -> bool {
        false
    }

    /// Get the Minimum Performance.
    /// (range from 0, lowest performant, through 100, highest performance)
    ///
    /// If current driver does not support this operation,
    /// it will return `None`.
    fn get_min_performance() -> Option<u8> {
        None
    }

    /// Set the Maximum Performance.
    /// (range from 0, lowest performant, through 100, highest performance)
    ///
    /// If current driver does not support this operation,
    /// it will return `false`.
    fn set_max_performance(max: u8) -> bool {
        false
    }

    /// Get the Maximum Performance.
    /// (range from 0, lowest performant, through 100, highest performance)
    ///
    /// If current driver does not support this operation,
    /// it will return `None`.
    fn get_max_performance() -> Option<u8> {
        None
    }
}

@atsushi421
Copy link
Contributor

@ytakano
I have no concerns, thank you.

ytakano added 18 commits April 4, 2025 11:18
Signed-off-by: Yuuki Takano <[email protected]>
Signed-off-by: Yuuki Takano <[email protected]>
Signed-off-by: Yuuki Takano <[email protected]>
Signed-off-by: Yuuki Takano <[email protected]>
Signed-off-by: Yuuki Takano <[email protected]>
Signed-off-by: Yuuki Takano <[email protected]>
@ytakano
Copy link
Collaborator Author

ytakano commented Jun 25, 2025

Add set_min_max_performance() to select the minimum and maximum Performance.

pub trait Dvfs {
    fn set_min_max_performance();
}

Signed-off-by: Yuuki Takano <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants