devfreq 是指频率电源可以动态调节的设备,可以添加不同设备及不同govvernor ;
devfreq 框架和opp(operating performance point) 频率电源对 devices driver 通过 devfreq profile 交互
devfreq_dev_profile
include/linux/devfreq.h
devfreq_governor 与 devfreq 框架交互数据结构
drivers/devfreq/governor.h
devfreq opp 设备核心数据结构,将opp device driver 的 devfreq_dev_profile 和 governor 的devfreq_governor 关联起来,并通过设备驱动模型中device 类为用户控件提供接口。
struct devfreq { 177 struct list_head node; 178 179 struct mutex lock; 180 struct device dev; 181 struct devfreq_dev_profile *profile; 182 const struct devfreq_governor *governor; 183 struct opp_table *opp_table; 184 struct notifier_block nb; 185 struct delayed_work work; 186 187 unsigned long previous_freq; 188 struct devfreq_dev_status last_status; 189 190 void *data; /* private data for governors */ 191 192 struct dev_pm_qos_request user_min_freq_req; 193 struct dev_pm_qos_request user_max_freq_req; 194 unsigned long scaling_min_freq; 195 unsigned long scaling_max_freq; 196 bool stop_polling; 197 198 unsigned long suspend_freq; 199 unsigned long resume_freq; 200 atomic_t suspend_count; 201 202 /* information for device frequency transitions */ 203 struct devfreq_stats stats; 204 205 struct srcu_notifier_head transition_notifier_list; 206 207 /* Pointer to the cooling device if used for thermal mitigation */ 208 struct thermal_cooling_device *cdev; 209 210 struct notifier_block nb_min; 211 struct notifier_block nb_max; 212 }; 213
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-devfreq
属性对应class devfreq 文件节点
1、初始化 devfreq class
2、governor 初始化并添加
3、opp device driver 通过devfreq 框架 创建devfreq device