From d9e676ad0157f7e6644769dcef44aac425d0b7cc Mon Sep 17 00:00:00 2001 From: sashwinbalaji Date: Mon, 5 Dec 2022 11:11:11 +0800 Subject: [PATCH 1/2] thermal: add CPU GPU throttling policy and VIRTUAL-SKIN-HINT - Add VIRTUAL-SKIN-CPU-GPU - Add PID and BindedCdev aligning with older devices - Add VIRTUAL-SKIN-HINT - Modify light temp from 39 to 37 Change-Id: I648680eedcd508bf2d81ad8d04f5e5a17a1f508f Bug: 261148703(skin hint) Bug: 254021126(cpu policy) Bug: 254021580(gpu policy) Test: use local build to check lshal and log --- thermal_info_config_tangorpro.json | 113 +++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 5 deletions(-) diff --git a/thermal_info_config_tangorpro.json b/thermal_info_config_tangorpro.json index eb822e0..3c50eeb 100644 --- a/thermal_info_config_tangorpro.json +++ b/thermal_info_config_tangorpro.json @@ -97,11 +97,92 @@ "HotThreshold":["NAN", "39.0", "43.0", "45.0", "47.0", "51.0", "140.0"], "HotHysteresis":[0.0, 1.9, 1.9, 1.9, 1.9, 1.9, 1.9], "Multiplier":0.001, - "SendPowerHint":true, - "Monitor":true, + "SendCallback":true, "PollingDelay":300000, "PassiveDelay":7000 }, + { + "Name":"VIRTUAL-SKIN-HINT", + "Type":"UNKNOWN", + "Hidden":true, + "VirtualSensor":true, + "TriggerSensor":"quiet_therm", + "Formula":"MAXIMUM", + "Combination":["VIRTUAL-FRONT-SOC", "VIRTUAL-FRONT-BL", "VIRTUAL-BACK-SOC", "VIRTUAL-BACK-CHARGER"], + "Coefficient":["1.0", "1.0", "1.0", "1.0"], + "HotThreshold":["NAN", "37.0", "43.0", "45.0", "47.0", "51.0", "140.0"], + "HotHysteresis":[0.0, 1.9, 1.9, 1.9, 1.9, 1.9, 1.9], + "Multiplier":0.001, + "SendPowerHint":true, + "PollingDelay":300000, + "PassiveDelay":7000 + }, + { + "Name":"VIRTUAL-SKIN-CPU-GPU", + "Type":"UNKNOWN", + "Hidden":true, + "VirtualSensor":true, + "TriggerSensor":"quiet_therm", + "Formula":"MAXIMUM", + "Combination":["VIRTUAL-FRONT-SOC", "VIRTUAL-FRONT-BL", "VIRTUAL-BACK-SOC", "VIRTUAL-BACK-CHARGER"], + "Coefficient":["1.0", "1.0", "1.0", "1.0"], + "HotThreshold":["NAN", "39.0", "43.0", "45.0", "47.0", "51.0", "140.0"], + "HotHysteresis":[0.0, 1.9, 1.9, 1.9, 1.9, 1.9, 1.9], + "Multiplier":0.001, + "PollingDelay":300000, + "PassiveDelay":7000, + "PIDInfo": { + "K_Po":["NAN", "NAN", 1800, 500, "NAN", "NAN", "NAN"], + "K_Pu":["NAN", "NAN", 1800, 500, "NAN", "NAN", "NAN"], + "K_I":["NAN", "NAN", 20, 5, "NAN", "NAN", "NAN"], + "K_D":["NAN", "NAN", 0, 0, "NAN", "NAN", "NAN"], + "I_Max":["NAN", "NAN", 1500, 100, "NAN", "NAN", "NAN"], + "S_Power":["NAN", "NAN", 2500, 1300, "NAN", "NAN", "NAN"], + "MinAllocPower":["NAN", "NAN", 2000, 800, "NAN", "NAN", "NAN"], + "MaxAllocPower":["NAN", "NAN", 10000, 4000, "NAN", "NAN", "NAN"], + "I_Cutoff":["NAN", "NAN", 2, 2, "NAN", "NAN", "NAN"], + "I_Default": 1000, + "TranCycle": 5 + }, + "BindedCdevInfo": [ + { + "CdevRequest": "thermal-cpufreq-0", + "CdevWeightForPID": [1, 1, 1, 1, 1, 1, 1], + "MaxReleaseStep": 1, + "MaxThrottleStep": 1, + "BindedPowerRail": "S4M_VDD_CPUCL0", + "CdevCeiling": [0, 8, 8, 8, 8, 10, 10], + "LimitInfo": [0, 0, 0, 0, 8, 10, 10] + }, + { + "CdevRequest": "thermal-cpufreq-1", + "CdevWeightForPID": [1, 1, 1, 1, 1, 1, 1], + "MaxReleaseStep": 1, + "MaxThrottleStep": 1, + "BindedPowerRail": "S3M_VDD_CPUCL1", + "CdevCeiling": [0, 12, 12, 12, 12, 14, 14], + "LimitInfo": [0, 0, 0, 0, 12, 14, 14] + }, + { + "CdevRequest": "thermal-cpufreq-2", + "CdevWeightForPID": [1, 1, 1, 1, 1, 1, 1], + "MaxReleaseStep": 1, + "MaxThrottleStep": 1, + "BindedPowerRail": "S2M_VDD_CPUCL2", + "CdevCeiling": [0, 15, 15, 15, 15, 17, 17], + "LimitInfo": [0, 0, 0, 0, 15, 17, 17] + }, + { + "CdevRequest": "thermal-gpufreq-0", + "CdevWeightForPID": [1, 1, 1, 1, 1, 1, 1], + "MaxReleaseStep": 1, + "MaxThrottleStep": 1, + "BindedPowerRail": "S2S_VDD_G3D", + "CdevCeiling": [0, 6, 6, 6, 8, 10, 10], + "LimitInfo": [0, 0, 0, 0, 8, 10, 10] + } + ] + }, { "Name":"cellular-emergency", "Type":"POWER_AMPLIFIER", @@ -474,19 +555,19 @@ "Name":"thermal-cpufreq-0", "Type":"CPU", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote", - "State2Power":["1100", "1050", "1000", "950", "900", "850", "800", "750", "700", "650", "600"] + "State2Power":[1100, 1050, 1000, 950, 900, 850, 800, 750, 700, 650, 600] }, { "Name":"thermal-cpufreq-1", "Type":"CPU", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote", - "State2Power":["1400", "1350", "1300", "1250", "1200", "1150", "1100", "1050", "1000", "950", "900", "850", "800", "750"] + "State2Power":[1400, 1350, 1300, 1250, 1200, 1150, 1100, 1050, 1000, 950, 900, 850, 800, 750] }, { "Name":"thermal-cpufreq-2", "Type":"CPU", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote", - "State2Power":["1450", "1400", "1350", "1300", "1250", "1200", "1150", "1100", "1050", "1000", "950", "900", "850", "800", "750"] + "State2Power":[1450, 1400, 1350, 1300, 1250, 1200, 1150, 1100, 1050, 1000, 950, 900, 850, 800, 750] }, { "Name":"thermal-gpufreq-0", @@ -499,5 +580,27 @@ "Type":"NPU", "WritePath":"/dev/thermal/cdev-by-name/tpu_cooling/user_vote" } + ], + "PowerRails":[ + { + "Name":"S2M_VDD_CPUCL2", + "PowerSampleDelay":7000, + "PowerSampleCount":1 + }, + { + "Name":"S3M_VDD_CPUCL1", + "PowerSampleDelay":7000, + "PowerSampleCount":1 + }, + { + "Name":"S4M_VDD_CPUCL0", + "PowerSampleDelay":7000, + "PowerSampleCount":1 + }, + { + "Name":"S2S_VDD_G3D", + "PowerSampleDelay":7000, + "PowerSampleCount":1 + } ] } From 4c6b6d02aa93a22d724d77e83451c95d81b43ed2 Mon Sep 17 00:00:00 2001 From: sashwinbalaji Date: Mon, 5 Dec 2022 19:58:28 +0800 Subject: [PATCH 2/2] thermal: add charging throttling policy - Align thermal charge config with older devices - Add hardlimit for fcc Bug: 254020998 Test: tested locally by verifying lshal and logs Change-Id: I96460871a2fa9ad714f9a3e2e722a0ab62fa4ba6 --- thermal_info_config_charge_tangorpro.json | 62 +++++++++++++++++++++++ thermal_info_config_tangorpro.json | 14 ++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/thermal_info_config_charge_tangorpro.json b/thermal_info_config_charge_tangorpro.json index 7ed0bc7..db6b9ec 100644 --- a/thermal_info_config_charge_tangorpro.json +++ b/thermal_info_config_charge_tangorpro.json @@ -4,6 +4,68 @@ "Name":"battery", "Type":"BATTERY", "Multiplier":0.001 + }, + { + "Name":"neutral_therm", + "Type":"UNKNOWN", + "TempPath":"/dev/thermal/tz-by-name/neutral_therm/tz_temp", + "Multiplier":0.001 + }, + { + "Name":"quiet_therm", + "Type":"UNKNOWN", + "HotThreshold":["NAN", "35.0", "NAN", "NAN", "NAN", "NAN", "NAN"], + "TempPath":"/dev/thermal/tz-by-name/quiet_therm/tz_temp", + "Multiplier":0.001 + }, + { + "Name":"charger_skin_therm", + "Type":"UNKNOWN", + "TempPath":"/dev/thermal/tz-by-name/charger_skin_therm/tz_temp", + "Multiplier":0.001 + }, + { + "Name":"disp_therm", + "Type":"UNKNOWN", + "TempPath":"/dev/thermal/tz-by-name/disp_therm/tz_temp", + "Multiplier":0.001 + }, + { + "Name":"usb_pwr_therm", + "Type":"UNKNOWN", + "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm/tz_temp", + "Multiplier":0.001 + }, + { + "Name":"usb_pwr_therm2", + "Type":"UNKNOWN", + "TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm2/tz_temp", + "Multiplier":0.001 + }, + { + "Name":"VIRTUAL-BACK-CHARGER", + "Type":"UNKNOWN", + "Hidden":true, + "VirtualSensor":true, + "Formula":"WEIGHTED_AVG", + "Combination":["neutral_therm", "quiet_therm", "charger_skin_therm", "disp_therm"], + "Coefficient":["-0.148", "0.666", "0.256", "-0.079"], + "HotThreshold":["NAN", "39.0", "43.0", "45.0", "47.0", "51.0", "55.0"], + "HotHysteresis":[0.0, 1.9, 1.9, 1.9, 1.9, 1.9, 1.9], + "Offset":7137, + "Multiplier":0.001, + "BindedCdevInfo": [ + { + "CdevRequest": "fcc", + "LimitInfo": [0, 1, 2, 3, 4, 5, 5] + } + ] + } + ], + "CoolingDevices":[ + { + "Name":"fcc", + "Type":"BATTERY" } ] } diff --git a/thermal_info_config_tangorpro.json b/thermal_info_config_tangorpro.json index 3c50eeb..9dc971b 100644 --- a/thermal_info_config_tangorpro.json +++ b/thermal_info_config_tangorpro.json @@ -83,8 +83,16 @@ "Formula":"WEIGHTED_AVG", "Combination":["neutral_therm", "quiet_therm", "charger_skin_therm", "disp_therm"], "Coefficient":["-0.148", "0.666", "0.256", "-0.079"], + "HotThreshold":["NAN", "39.0", "43.0", "45.0", "47.0", "51.0", "55.0"], + "HotHysteresis":[0.0, 1.9, 1.9, 1.9, 1.9, 1.9, 1.9], "Offset":7137, - "Multiplier":0.001 + "Multiplier":0.001, + "BindedCdevInfo": [ + { + "CdevRequest": "fcc", + "LimitInfo": [0, 1, 2, 3, 4, 5, 5] + } + ] }, { "Name":"VIRTUAL-SKIN", @@ -579,6 +587,10 @@ "Name":"tpu_cooling", "Type":"NPU", "WritePath":"/dev/thermal/cdev-by-name/tpu_cooling/user_vote" + }, + { + "Name":"fcc", + "Type":"BATTERY" } ], "PowerRails":[