STRUCT DEVFREQ_DEV_PROFILE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct devfreq_dev_profile(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual ✨ and buckle up, because this one's all about struct devfreq_dev_profile β€” literally the glow-up plan your device hands to devfreq so it knows how to be managed. it's giving "here's my whole personality, please govern me" 🫢


🌸 NAME 🌸

struct devfreq_dev_profile β€” Devfreq's user device profile πŸ’–


✨ SYNOPSIS ✨

struct devfreq_dev_profile {
    unsigned long initial_freq;
    unsigned int polling_ms;
    enum devfreq_timer timer;
    int (*target)(struct device *dev, unsigned long *freq, u32 flags);
    int (*get_dev_status)(struct device *dev, struct devfreq_dev_status
*stat);
    int (*get_cur_freq)(struct device *dev, unsigned long *freq);
    void (*exit)(struct device *dev);
    unsigned long *freq_table;
    unsigned int max_state;
    bool is_cooling_device;
    const struct attribute_group **dev_groups;
 };

like, that's the whole vibe right there πŸ‘‘


πŸŽ€ Members πŸŽ€

  • initial_freq β€” the operating frequency at the moment devfreq_add_device gets called. the "hi nice to meet you" frequency 🌸
  • polling_ms β€” the polling interval, measured in ms. set it to 0 and polling is disabled, no cap 🚫
  • timer β€” the timer type, and it's either a deferrable timer or a delayed timer. pick your fighter ⏰
  • target β€” the main character callback, fr. your device is supposed to set its operating frequency at freq or at the lowest-upper-than-freq value. if freq is higher than any frequency it can actually operate at, then set maximum. and before it returns, the target function should set freq to the current frequency. the "flags" parameter's possible values are explained above with the "DEVFREQ_FLAG_*" macros πŸ‘‘πŸ”₯
  • get_dev_status β€” your device should hand devfreq its current performance status here. governors are recommended not to use this one directly β€” instead, governors are recommended to use devfreq_update_stats along with devfreq.last_status. iykyk πŸ™ˆ
  • get_cur_freq β€” your device should provide the current frequency it's operating at. simple, iconic, does what it says πŸ’«
  • exit β€” an optional callback, called when devfreq is removing the devfreq object because of an error, or from a devfreq_remove_device call. and if the user has registered devfreq->nb at a notifier-head, this is the time to unregister it. like, this is your moment, do the cleanup 🧹
  • freq_table β€” an optional list of frequencies, used to support statistics β€” and heads up, freq_table must be generated in ascending order β¬†οΈβœ¨
  • max_state β€” the size of freq_table, periodt πŸ’…
  • is_cooling_device β€” a self-explanatory boolean that gives the device a cooling effect property. it's giving "yes i run cool, literally" ❄️
  • dev_groups β€” optional device-specific sysfs attribute groups that are to be attached to the devfreq device πŸŽ€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./include/linux/devfreq.h β€” struct devfreq_dev_status(9), struct devfreq_stats(9), struct devfreq(9), struct devfreq_simple_ondemand_data(9), struct devfreq_passive_data(9) β€” go read all of them, bestie, they're all linked in the group chat πŸ“šπŸ’œ


and that's the whole page 🫢 it lives over in ./include/linux, and this version is dated October 2026 β€” slay, see you next kernel cycle βœ¨πŸ’…πŸ”₯

πŸ“¦ where this page comes from