OMAP4平台CPU频率调节机制浅析

本文深入探讨了OMAP4平台如何根据负载和温度动态调节CPU频率。系统通过温度传感器监控温度,触发中断进行频率调整。此外,根据负载变化,系统也会相应调整频率。关键函数`omap_target`负责频率设定,而`cpufreq_interactive_freq_down`和`cpufreq_interactive_up_task`分别处理降频和升频操作。当温度过高时,`omap_thermal_step_freq_down`会降低频率,反之则通过`omap_thermal_step_freq_up`提升。冷却设备和温度管理机制确保了这一过程的协调执行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

          最近在看CPU如何动态调节频率的相关部分。系统会根据当前负载,以及温度情况来调节cpu的频率,以满足系统需求和省电。

cpu内部有温度传感器,当温度升高和降低到一定程度,都会出发中断,以此来调节频率(温度升高后,进行降频,温度降低后,如果系统仍需要更高频率,则把频率调高)。另外,系统会根据当前负载,进行调频。这个优先级比温度稍微低些,因为温度方面是通过中断来控制的。

         首先,需要时刻更新当前需要的频率。

532 static struct cpufreq_driver omap_driver = {
533     .flags      = CPUFREQ_STICKY,
534     .verify     = omap_verify_speed,
535     .target     = omap_target,
536     .get        = omap_getspeed,
537     .init       = omap_cpu_init,
538     .exit       = omap_cpu_exit,
539     .name       = "omap2plus",
540     .attr       = omap_cpufreq_attr,
541 };

这里,最重要的函数omap_target中会进行频率调节(根据负载,调整当前频率为需要的频率),调用的地方呆会再看。先看看它的定义

267 static int omap_target(struct cpufreq_policy *policy,
268                unsigned int target_freq,
269                unsigned int relation)
270 {
271     unsigned int i;
272     int ret = 0;
273 
274     if (!freq_table) {
275         dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__,
276                 policy->cpu);
277         return -EINVAL;
278     }
279 
280     ret = cpufreq_frequency_table_target(policy, freq_table, target_freq,
281             relation, &i);
282     if (ret) {
283         dev_dbg(mpu_dev, "%s: cpu%d: no freq match for %d(ret=%d)\n",
284             __func__, policy->cpu, target_freq, ret);
285         return ret;
286     }
287 
288     mutex_lock(&omap_cpufreq_lock);
289 
290     current_target_freq = freq_table[i].frequency;
291 
292     if (!omap_cpufreq_suspended) {
293 #ifdef CONFIG_OMAP4_DPLL_CASCADING
294         if (cpu_is_omap44xx() && target_freq > policy->min)
295             omap4_dpll_cascading_blocker_hold(mp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值