如何使用QCS8550的 thermal-engine,比如调整风扇的强度?

开开心心过大 2024-07-26 15:58:34

如何使用QCS8550的 thermal-engine,比如调整风扇的强度?

...全文
1093 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38498942 2024-07-29
  • 打赏
  • 举报
回复 1

由于各个厂商在thermal governor和硬件上的差异(sensor的排布不同),thermal zone中的温度sensor、cooling devices的设备树配置也有所不同。kernel document总结了几种thermal zone设备树配置示例。

#include <dt-bindings/thermal/thermal.h>

/*cpufreq cooling device-passive被动冷却*/
cpus {
    /*
     * Here is an example of describing a cooling device for a DVFS
     * capable CPU. The CPU node describes its four OPPs.
     * The cooling states possible are 0..3, and they are
     * used as OPP indexes. The minimum cooling state is 0, which means
     * all four OPPs can be available to the system. The maximum
     * cooling state is 3, which means only the lowest OPPs (198MHz@0.85V)
     * can be available in the system.
     */
    /*  */
    cpu0: cpu@0 {
        ...
        operating-points = <
            /* kHz    uV */
            970000  1200000
            792000  1100000
            396000  950000
            198000  850000
        >;
        cooling-min-level = <0>;/* 说明四组OPPs都可用 */
        cooling-max-level = <3>;/* 说明OPPs中只有频率最低的那一组可用(198MHz@0.85V) */
        #cooling-cells = <2>; /* min followed by max */
    };
    ...
};

/*风扇控制器-active主动冷却*/
/*一个通过i2c总线1控制的风扇设备fan0,地址0x48,有10个冷却等级*/
&i2c1 {
    ...
    /*
     * A simple fan controller which supports 10 speeds of operation
     * (represented as 0-9).
     */
    fan0: fan@0x48 {
        ...
        cooling-min-level = <0>;
        cooling-max-level = <9>;/* 10 cooling states */
        #cooling-cells = <2>; /* min followed by max */
    };
};

/*温度传感器IC*/
/*ADC sensor(bandgap0),地址0x0000ED00,用来监视'cpu-thermal'的温度*/
ocp {
    ...
    /*
     * A simple IC with a single bandgap temperature sensor.
     */
    bandgap0: bandgap@0x0000ED00 {
        ...
        #thermal-sensor-cells = <0>;
    };
};

thermal-zones {
    cpu_thermal: cpu-thermal {
        polling-delay-passive = <250>; /* milliseconds */
        polling-delay = <1000>; /* milliseconds */

        thermal-sensors = <&bandgap0>;

        trips {
            cpu_alert0: cpu-alert0 {
                temperature = <90000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "active";
            };
            cpu_alert1: cpu-alert1 {
                temperature = <100000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "passive";
            };
            cpu_crit: cpu-crit {
                temperature = <125000>; /* millicelsius */
                hysteresis = <2000>; /* millicelsius */
                type = "critical";
            };
        };

        cooling-maps {
            map0 {
                trip = <&cpu_alert0>;
                cooling-device = <&fan0 THERMAL_NO_LIMIT 4>;/* 温度超过cpu_alert0时,等级0-4 */
            };
            map1 {
                trip = <&cpu_alert1>;
                cooling-device = <&fan0 5 THERMAL_NO_LIMIT>;/* 温度超过cpu_alert1时,等级5-9 */ 
            };
            map2 {
                trip = <&cpu_alert1>;
                cooling-device =
                    <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;/* 所有冷却等级都可以用在cpu_alert1上,即温度在alert1-alert2之间,所有冷却等级可用 */
            };
        };
    };
};


当对应的thermal zone的传感器的温度在不同的等级的时候, 我们就调用不同的风扇等级, 以此降温

m0_45875771 2024-07-26
  • 打赏
  • 举报
回复

同问6490

2,851

社区成员

发帖
与我相关
我的任务
社区描述
本论坛以AI、WoS 、XR、IoT、Auto、生成式AI等核心板块组成,为开发者提供便捷及高效的学习和交流平台。 高通开发者专区主页:https://qualcomm.csdn.net/
人工智能物联网机器学习 技术论坛(原bbs) 北京·东城区
社区管理员
  • csdnsqst0050
  • chipseeker
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧