diff options
Diffstat (limited to 'thermalConfig.cpp')
-rw-r--r-- | thermalConfig.cpp | 735 |
1 files changed, 721 insertions, 14 deletions
diff --git a/thermalConfig.cpp b/thermalConfig.cpp index a1aeee3..9ce4726 100644 --- a/thermalConfig.cpp +++ b/thermalConfig.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2020,2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -46,6 +47,239 @@ namespace V2_0 { namespace implementation { constexpr std::string_view socIDPath("/sys/devices/soc0/soc_id"); + std::vector<std::string> cpu_sensors_439 = + { + "apc1-cpu0-usr", + "apc1-cpu1-usr", + "apc1-cpu2-usr", + "apc1-cpu3-usr", + "cpuss0-usr", + "cpuss0-usr", + "cpuss0-usr", + "cpuss0-usr", + }; + + std::vector<struct target_therm_cfg> sensor_cfg_439 = + { + { + TemperatureType::CPU, + cpu_sensors_439, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpu-usr" }, + "GPU", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::SKIN, + { "quiet-therm-adc" }, + "skin", + 40000, + 95000, + 40000, + true, + }, + { + TemperatureType::BCL_VOLTAGE, + { "vbat_adc" }, + "vbat", + 3200, + 3000, + 3200, + false, + }, + { + TemperatureType::BCL_CURRENT, + { "ibat-high" }, + "ibat", + 4200, + 4400, + 4200, + true, + }, + { + TemperatureType::BCL_PERCENTAGE, + { "soc" }, + "soc", + 10, + 2, + 10, + false, + }, + }; + + std::vector<std::string> cpu_sensors_talos = + { + "cpuss-2-usr", + "cpuss-2-usr", + "cpuss-1-usr", + "cpuss-1-usr", + "cpuss-0-usr", + "cpuss-0-usr", + "cpu-1-0-usr", + "cpu-1-2-usr", + }; + + std::vector<struct target_therm_cfg> sensor_cfg_talos_common = + { + { + TemperatureType::CPU, + cpu_sensors_talos, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpu-usr" }, + "gpu", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::SKIN, + { "xo-therm-adc" }, + "skin", + 40000, + 95000, + 40000, + true, + }, + }; + + std::vector<struct target_therm_cfg> sensor_cfg_talos_specific = { + { + TemperatureType::BCL_PERCENTAGE, + { "soc" }, + "soc", + 10, + 2, + 10, + false, + }, + }; + + std::vector<std::string> cpu_sensors_monaco = + { + "cpuss-0-usr", + "cpuss-1-usr", + "cpuss-0-usr", + "cpuss-1-usr", + }; + + std::vector<struct target_therm_cfg> sensor_cfg_monaco = + { + { + TemperatureType::CPU, + cpu_sensors_monaco, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpu-usr" }, + "gpu", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::SKIN, + { "pa-therm0-usr" }, + "skin", + 40000, + 95000, + 40000, + true, + }, + { + TemperatureType::BCL_CURRENT, + { "pm5100-ibat-lvl0" }, + "ibat", + 1100, + 1500, + 1100, + true, + }, + }; + + std::vector<std::string> cpu_sensors_sdm845 = + { + "cpu0-silver-usr", + "cpu1-silver-usr", + "cpu2-silver-usr", + "cpu3-silver-usr", + "cpu0-gold-usr", + "cpu1-gold-usr", + "cpu2-gold-usr", + "cpu3-gold-usr", + }; + + std::vector<struct target_therm_cfg> sensor_cfg_sdm845 = { + { + TemperatureType::CPU, + cpu_sensors_sdm845, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + {"gpu0-usr"}, + "gpu0", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + {"gpu1-usr"}, + "gpu1", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::SKIN, + {"xo-therm-adc"}, + "skin", + 40000, + 95000, + 40000, + true, + }, + { + TemperatureType::BCL_PERCENTAGE, + {"soc"}, + "soc", + 10, + 2, + 10, + false, + }, + }; + std::vector<std::string> cpu_sensors_bengal = { "cpuss-2-usr", @@ -493,7 +727,7 @@ namespace implementation { "cpu-1-3", }; - std::vector<struct target_therm_cfg> sensor_cfg_msmnile = { + std::vector<struct target_therm_cfg> sensor_cfg_msmnile_common = { { TemperatureType::CPU, cpu_sensors_kona, @@ -530,6 +764,9 @@ namespace implementation { 40000, true, }, + }; + + std::vector<struct target_therm_cfg> sensor_cfg_msmnile_specific = { { TemperatureType::BCL_CURRENT, { "pm8150b-ibat-lvl0" }, @@ -865,6 +1102,69 @@ namespace implementation { }, }; + std::vector<struct target_therm_cfg> diwali_common = { + { + TemperatureType::CPU, + cpu_sensors_waipio, + "", + 95000, + 115000, + 95000, + true, + ThrottlingSeverity::LIGHT, + }, + { + TemperatureType::GPU, + { "gpuss-0" }, + "GPU0", + 95000, + 115000, + 95000, + true, + ThrottlingSeverity::LIGHT, + }, + { + TemperatureType::GPU, + { "gpuss-1" }, + "GPU1", + 95000, + 115000, + 95000, + true, + ThrottlingSeverity::LIGHT, + }, + { + TemperatureType::NPU, + { "nspss-0" }, + "nsp0", + 95000, + 115000, + 95000, + true, + ThrottlingSeverity::LIGHT, + }, + { + TemperatureType::NPU, + { "nspss-1" }, + "nsp1", + 95000, + 115000, + 95000, + true, + ThrottlingSeverity::LIGHT, + }, + { + TemperatureType::NPU, + { "nspss-2" }, + "nsp2", + 95000, + 115000, + 95000, + true, + ThrottlingSeverity::LIGHT, + }, + }; + std::vector<struct target_therm_cfg> waipio_specific = { { TemperatureType::BCL_CURRENT, @@ -1042,7 +1342,154 @@ namespace implementation { std::vector<struct target_therm_cfg> diwali_specific = { { TemperatureType::BCL_CURRENT, - { "pm8350b-ibat-lvl0" }, + { "pm7250b-ibat-lvl0" }, + "ibat", + 9000, + 9500, + 9000, + true, + }, + { + TemperatureType::SKIN, + { "quiet-therm" }, + "skin", + 46000, + 95000, + 46000, + true, + ThrottlingSeverity::LIGHT, + }, + }; + + std::vector<std::string> cpu_sensors_neo = + { + "cpu-0-0", + "cpu-0-1", + "cpu-0-2", + "cpu-0-3", + }; + + std::vector<struct target_therm_cfg> neo_common = { + { + TemperatureType::CPU, + cpu_sensors_neo, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-0" }, + "GPU0", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-1" }, + "GPU1", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-0" }, + "nsp0", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-1" }, + "nsp1", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-2" }, + "nsp2", + 95000, + 115000, + 95000, + true, + }, + }; + + std::vector<std::string> cpu_sensors_parrot = + { + "cpu-0-0", + "cpu-0-1", + "cpu-0-2", + "cpu-0-3", + "cpu-1-0", + "cpu-1-2", + "cpu-1-4", + "cpu-1-6", + }; + + std::vector<struct target_therm_cfg> parrot_common = { + { + TemperatureType::CPU, + cpu_sensors_parrot, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-0" }, + "GPU0", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-1" }, + "GPU1", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-0" }, + "nsp0", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-1" }, + "nsp1", + 95000, + 115000, + 95000, + true, + }, + }; + + std::vector<struct target_therm_cfg> parrot_specific = { + { + TemperatureType::BCL_CURRENT, + { "pm7250b-ibat-lvl0" }, "ibat", 6000, 7500, @@ -1051,15 +1498,215 @@ namespace implementation { }, { TemperatureType::SKIN, - { "quiet-therm" }, + { "xo-therm" }, "skin", - 40000, + 55000, + 95000, + 55000, + true, + }, + }; + + std::vector<std::string> cpu_sensors_anorak = + { + "cpu-0-0-0", + "cpu-0-0-1", + "cpu-0-1-0", + "cpu-0-1-1", + "cpu-1-0-0", + "cpu-1-0-1", + "cpu-1-1-0", + "cpu-1-1-1", + "cpu-1-2-0", + "cpu-1-2-1", + "cpu-1-3-0", + "cpu-1-3-1", + }; + + std::vector<struct target_therm_cfg> anorak_common = { + { + TemperatureType::CPU, + cpu_sensors_anorak, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-0" }, + "nsp0", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-1" }, + "nsp1", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::NPU, + { "nspss-2" }, + "nsp2", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-0" }, + "GPU0", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-1" }, + "GPU1", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-2" }, + "GPU2", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-3" }, + "GPU3", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-4" }, + "GPU4", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-5" }, + "GPU5", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-6" }, + "GPU6", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss-7" }, + "GPU7", + 95000, + 115000, + 95000, + true, + }, + }; + std::vector<struct target_therm_cfg> anorak_specific = { + { + TemperatureType::BCL_CURRENT, + { "pm8550b-ibat-lvl0" }, + "ibat", + 9000, + 10000, + 9000, + true, + }, + { + TemperatureType::SKIN, + { "sys-therm-0" }, + "skin", + 55000, + 95000, + 55000, + true, + }, + }; + + std::vector<std::string> cpu_sensors_ravelin = + { + "cpu-0-0", + "cpu-0-1", + "cpu-0-2", + "cpu-0-3", + "cpu-0-4", + "cpu-0-5", + "cpu-1-0", + "cpu-1-2", + }; + + std::vector<struct target_therm_cfg> ravelin_common = { + { + TemperatureType::CPU, + cpu_sensors_parrot, + "", + 95000, + 115000, + 95000, + true, + }, + { + TemperatureType::GPU, + { "gpuss" }, + "GPU", + 95000, + 115000, 95000, - 40000, true, }, }; + std::vector<struct target_therm_cfg> ravelin_specific = { + { + TemperatureType::BCL_CURRENT, + { "pm7250b-ibat-lvl0" }, + "ibat", + 6000, + 7500, + 6000, + true, + }, + { + TemperatureType::SKIN, + { "sys-therm6" }, + "skin", + 55000, + 95000, + 55000, + true, + }, + }; struct target_therm_cfg bat_conf = { TemperatureType::BATTERY, { "battery" }, @@ -1093,6 +1740,17 @@ namespace implementation { const std::unordered_map<int, std::vector<struct target_therm_cfg>> msm_soc_map = { + {353, sensor_cfg_439}, + {354, sensor_cfg_439}, + {363, sensor_cfg_439}, + {364, sensor_cfg_439}, + {416, sensor_cfg_439}, + {437, sensor_cfg_439}, + {355, sensor_cfg_talos_common}, + {377, sensor_cfg_talos_common}, + {380, sensor_cfg_talos_common}, + {321, sensor_cfg_sdm845}, + {341, sensor_cfg_sdm845}, {417, sensor_cfg_bengal}, // bengal {420, sensor_cfg_bengal}, {444, sensor_cfg_bengal}, @@ -1117,10 +1775,10 @@ namespace implementation { {435, sensor_cfg_lito}, {459, sensor_cfg_lito}, {476, sensor_cfg_lito}, // orchid - {339, sensor_cfg_msmnile}, - {361, sensor_cfg_msmnile}, - {362, sensor_cfg_msmnile}, - {367, sensor_cfg_msmnile}, + {339, sensor_cfg_msmnile_common}, + {361, sensor_cfg_msmnile_common}, + {362, sensor_cfg_msmnile_common}, + {367, sensor_cfg_msmnile_common}, {356, kona_common}, // kona {415, lahaina_common}, // lahaina {439, lahaina_common}, // lahainap @@ -1129,15 +1787,40 @@ namespace implementation { {502, lahaina_common}, {450, lahaina_common}, // shima {454, sensor_cfg_holi}, // holi + {507, sensor_cfg_holi}, // blair {475, sensor_cfg_yupik}, // yupik {515, sensor_cfg_yupik}, // YUPIK-LTE + {576, sensor_cfg_yupik}, // yupik qcm5430 modem + {575, sensor_cfg_yupik}, // yupik qcm5430 + {567, sensor_cfg_yupik}, // yupik + {563, sensor_cfg_yupik}, // yupik + {553, sensor_cfg_yupik}, // yupik + {546, sensor_cfg_yupik}, // yupik + {499, sensor_cfg_yupik}, // yupik + {498, sensor_cfg_yupik}, // yupik-iot + {497, sensor_cfg_yupik}, // yupik-iot mdm + {488, sensor_cfg_yupik}, // yupik + {487, sensor_cfg_yupik}, // yupik + {486, sensor_cfg_monaco}, // monaco + {517, sensor_cfg_monaco}, // monaco {457, waipio_common}, //Waipio {482, waipio_common}, //Waipio {552, waipio_common}, //Waipio-LTE - {506, waipio_common}, //diwali + {506, diwali_common}, //diwali + {547, diwali_common}, //diwali + {564, diwali_common}, //diwali-LTE {530, waipio_common}, // cape {531, waipio_common}, // cape {540, waipio_common}, // cape + {525, neo_common}, + {554, neo_common}, + {537, parrot_common}, //Netrani mobile + {583, parrot_common}, //Netrani mobile without modem + {613, parrot_common}, //Netrani APQ + {549, anorak_common}, + {568, ravelin_common}, //Clarence Mobile + {581, ravelin_common}, //Clarence IOT + {582, ravelin_common}, //Clarence IOT without modem {519, kalama_common}, //Kalama {536, kalama_common}, //Kalamap {600, kalama_common}, //Kalama_sg @@ -1150,6 +1833,10 @@ namespace implementation { const std::unordered_map<int, std::vector<struct target_therm_cfg>> msm_soc_specific = { + {355, sensor_cfg_talos_specific}, + {339, sensor_cfg_msmnile_specific}, + {361, sensor_cfg_msmnile_specific}, + {362, sensor_cfg_msmnile_specific}, {356, kona_specific}, // kona {415, lahaina_specific}, // lahaina {439, lahaina_specific}, // lahainap @@ -1161,9 +1848,18 @@ namespace implementation { {482, waipio_specific}, //Waipio {552, waipio_specific}, //Waipio-LTE {506, diwali_specific}, //diwali + {547, diwali_specific}, //diwali + {564, diwali_specific}, //diwali-LTE {530, waipio_specific}, // cape {531, waipio_specific}, // cape {540, waipio_specific}, // cape + {537, parrot_specific}, //Netrani mobile + {583, parrot_specific}, //Netrani mobile without modem + {613, parrot_specific}, //Netrani APQ + {549, anorak_specific}, + {568, ravelin_specific}, //Clarence Mobile + {581, ravelin_specific}, //Clarence IOT + {582, ravelin_specific}, //Clarence IOT without modem {519, kalama_specific}, //Kalama {536, kalama_specific}, //Kalamap {600, kalama_specific}, //Kalama_sg @@ -1172,6 +1868,13 @@ namespace implementation { {604, kalama_specific}, //Kalama_qcm }; + const std::unordered_map<int, bool> + battery_bcl_cfg_disable_map = { + {367, true}, + {377, true}, + {380, true}, + }; + std::vector<struct target_therm_cfg> add_target_config( int socID, std::vector<struct target_therm_cfg> conf) @@ -1190,6 +1893,7 @@ namespace implementation { ThermalConfig::ThermalConfig():cmnInst() { std::unordered_map<int, std::vector<struct target_therm_cfg>>::const_iterator it; + std::unordered_map<int, bool>::const_iterator it_2; std::vector<struct target_therm_cfg>::iterator it_vec; bool bcl_defined = false; std::string soc_val; @@ -1227,10 +1931,13 @@ namespace implementation { bcl_defined = true; } - thermalConfig.push_back(bat_conf); - if (!bcl_defined) - thermalConfig.insert(thermalConfig.end(), - bcl_conf.begin(), bcl_conf.end()); + it_2 = battery_bcl_cfg_disable_map.find(soc_id); + if (it_2 == battery_bcl_cfg_disable_map.end() || !it_2->second) { + thermalConfig.push_back(bat_conf); + if (!bcl_defined) + thermalConfig.insert(thermalConfig.end(), + bcl_conf.begin(), bcl_conf.end()); + } LOG(DEBUG) << "Total sensors:" << thermalConfig.size(); } } // namespace implementation |