我们先看下dts中,各个参数的分析如下:
poll-ms代表KTM检测温度的间隔
limit-temp KTM调频的温度
temp-hysteresis 当温度降到limit-temp - temp-hysteresis 频率升到前面档位
freq-step 每次调频的步长(就是cpu频率的档位)
core-limit-temp代表KTM拔核(除cpu0)的温度
core-temp-hysteresis当温度降到core-limit-temp - core-temp-hysteresis,各个cpu online
hotplug-temp 代表KTM拔核的温度
holhotplutplug-temp-hysteresis 当温度降到hotplug-temp - holtplug-temp-hysteresis各个恢复cpu online
这里3个的温度值除了hotplug其他的都在thermal-engine起来后失效了,hotplug是在thermal-engine起来后起作用。
561 qcom,msm-thermal {
562 compatible = "qcom,msm-thermal";
563 qcom,sensor-id = <3>;
564 qcom,poll-ms = <250>;
565 qcom,limit-temp = <60>;
566 qcom,temp-hysteresis = <10>;
567 qcom,freq-step = <2>;
568 qcom,core-limit-temp = <80>;
569 qcom,core-temp-hysteresis = <10>;
570 qcom,hotplug-temp = <97>;
571 qcom,hotplug-temp-hysteresis = <12>;
572 qcom,freq-mitigation-temp = <97>;
573 qcom,freq-mitigation-temp-hysteresis = <12>;
574 qcom,freq-mitigation-value = <400000>;
575 qcom,online-hotplug-core;
576 qcom,therm-reset-temp = <115>;
577 qcom,disable-cx-phase-ctrl;
578 qcom,disable-gfx-phase-ctrl;
579 qcom,disable-vdd-mx;
580 qcom,disable-psm;
581 qcom,disable-ocr;
582 qcom,vdd-restriction-temp = <5>;
583 qcom,vdd-restriction-temp-hysteresis = <10>;
584 vdd-dig-supply = <&pm8909_s1_floor_corner>;
585
586 qcom,vdd-dig-rstr{
587 qcom,vdd-rstr-reg = "vdd-dig";
588 qcom,levels = <5 7 7>; /* Nominal, Super Turbo, Super Turbo */
589 qcom,min-level = <1>; /* No Request */
590 };
591 };
节点:
sys/module/msm_thermal/cat sensor_info 读取各个sensor的信息,其实就是dts中如下内容:
qcom,sensor-information {
489 compatible = "qcom,sensor-information";
490 sensor_information0: qcom,sensor-information-0 {
491 qcom,sensor-type = "tsens";
492 qcom,sensor-name = "tsens_tz_sensor0";
493 qcom,alias-name = "pop_mem";
494 };
495
496 sensor_information1: qcom,sensor-information-1 {
497 qcom,sensor-type = "tsens";
498 qcom,sensor-name = "tsens_tz_sensor1";
499 };
500
501 sensor_information2: qcom,sensor-information-2 {
502 qcom,sensor-type = "tsens";
503 qcom,sensor-name = "tsens_tz_sensor2";
504 };
505
506 sensor_information3: qcom,sensor-information-3 {
507 qcom,sensor-type = "tsens";
508 qcom,sensor-name = "tsens_tz_sensor3";
509 };
510
511 sensor_information4: qcom,sensor-information-4 {
512 qcom,sensor-type = "tsens";
513 qcom,sensor-name = "tsens_tz_sensor4";
514 };
515
516 sensor_information5: qcom,sensor-information-5 {
517 qcom,sensor-type = "adc";
518 qcom,sensor-name = "pa_therm0";
519 };
520
521 sensor_information6: qcom,sensor-information-6 {
522 qcom,sensor-type = "adc";
523 qcom,sensor-name = "case_therm";
524 };
525
526 sensor_information7: qcom,sensor-information-7 {
527 qcom,sensor-type = "alarm";
528 qcom,sensor-name = "pm8909_tz";
529 qcom,scaling-factor = <1000>;
530 };
531
532 sensor_information8: qcom,sensor-information-8 {
字符设备dev/msm_thermal_query,让daemon可以通过ioctl的方式来限制cpu频率
/sys/module/msm_thermal/parameters/enabled节点控制KTM关闭、KTM关闭后不可恢复
/sys/module/msm_thermal/core_control/cpus_offlined daemon发起cpu的offline
/sys/module/msm_thermal/core_control/enabled 关闭后KTM不能拔核 daemon启动后KTM也不会自动hotplug