STRUCT DEVFREQ(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

okay bestie, this is struct devfreq(9) from the Kernel API Manual โ€” the whole vibe is the Device devfreq structure, and we're getting into every lil field. ๐Ÿ’…โœจ

โœจ NAME โœจ

struct devfreq โ€” Device devfreq structure. periodt.

๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

struct devfreq {
    struct list_head node;
    struct mutex lock;
    struct device dev;
    struct devfreq_dev_profile *profile;
    const struct devfreq_governor *governor;
    struct opp_table *opp_table;
    struct notifier_block nb;
    struct delayed_work work;
    unsigned long *freq_table;
    unsigned int max_state;
    unsigned long previous_freq;
    struct devfreq_dev_status last_status;
    void *data;
    void *governor_data;
    struct dev_pm_qos_request user_min_freq_req;
    struct dev_pm_qos_request user_max_freq_req;
    unsigned long scaling_min_freq;
    unsigned long scaling_max_freq;
    bool stop_polling;
    unsigned long suspend_freq;
    unsigned long resume_freq;
    atomic_t suspend_count;
    struct devfreq_stats stats;
    struct srcu_notifier_head transition_notifier_list;
    struct thermal_cooling_device *cdev;
    struct notifier_block nb_min;
    struct notifier_block nb_max;
};

๐Ÿงš MEMBERS ๐Ÿงš

  • node โ€” list node โ€” contains the devices with devfreq that have been registered. ๐Ÿงต
  • lock โ€” a mutex to protect accessing devfreq. ๐Ÿ”’
  • dev โ€” device registered by devfreq class. dev.parent is the device using devfreq. ๐Ÿ“ฑ
  • profile โ€” device-specific devfreq profile. ๐Ÿงฌ
  • governor โ€” method how to choose frequency based on the usage. ๐ŸŽ›๏ธ
  • opp_table โ€” Reference to OPP table of dev.parent, if one exists. ๐Ÿ“‹
  • nb โ€” notifier block used to notify the devfreq object that it should reevaluate operable frequencies. Devfreq users may use devfreq.nb to the corresponding register notifier call chain. ๐Ÿ””
  • work โ€” delayed work for load monitoring. โณ
  • freq_table โ€” current frequency table used by the devfreq driver. ๐Ÿ“Š
  • max_state โ€” count of entry present in the frequency table. ๐Ÿ”ข
  • previous_freq โ€” previously configured frequency value. ๐Ÿ•ฐ๏ธ
  • last_status โ€” devfreq user device info, performance statistics. ๐Ÿ“ˆ
  • data โ€” devfreq driver pass to governors, governor should not change it. ๐Ÿšซ
  • governor_data โ€” private data for governors, devfreq core doesn't touch it. ๐Ÿ™ˆ
  • user_min_freq_req โ€” PM QoS minimum frequency request from user (via sysfs). ๐ŸงŠ
  • user_max_freq_req โ€” PM QoS maximum frequency request from user (via sysfs). ๐Ÿ”ฅ
  • scaling_min_freq โ€” Limit minimum frequency requested by OPP interface. โฌ‡๏ธ
  • scaling_max_freq โ€” Limit maximum frequency requested by OPP interface. โฌ†๏ธ
  • stop_polling โ€” devfreq polling status of a device. ๐Ÿ›‘
  • suspend_freq โ€” frequency of a device set during suspend phase. ๐Ÿ˜ด
  • resume_freq โ€” frequency of a device set in resume phase. ๐ŸŒ…
  • suspend_count โ€” suspend requests counter for a device. ๐Ÿงฎ
  • stats โ€” Statistics of devfreq device behavior. ๐Ÿ“‰
  • transition_notifier_list โ€” list head of DEVFREQ_TRANSITION_NOTIFIER notifier. ๐Ÿšฆ
  • cdev โ€” Cooling device pointer if the devfreq has cooling property. โ„๏ธ
  • nb_min โ€” Notifier block for DEV_PM_QOS_MIN_FREQUENCY. ๐ŸงŠ
  • nb_max โ€” Notifier block for DEV_PM_QOS_MAX_FREQUENCY. ๐Ÿ”ฅ

๐Ÿ’ซ DESCRIPTION ๐Ÿ’ซ

This structure stores the devfreq information for a given device. ๐Ÿ’พ

okay so important, bestie: when a governor accesses entries in struct devfreq in its functions โ€” except for the context of callbacks defined in struct devfreq_governor โ€” the governor should protect its access with the struct mutex lock in struct devfreq. A governor may use this mutex to protect its own private data in void *data as well. ๐Ÿ”

๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

  • Kernel file ./include/linux/devfreq.h โ€” also peep struct devfreq_dev_status(9), struct devfreq_dev_profile(9), struct devfreq_stats(9), struct devfreq_simple_ondemand_data(9), struct devfreq_passive_data(9). ๐Ÿ‘€

xoxo bestie ๐Ÿ’– โ€” this page comes from source ./include/linux, dated October 2026, and the version/manual title is struct devfreq(9). slay. ๐ŸŽ€

๐Ÿ“ฆ where this page comes from