Merge 52ad4bbcd4e9cfa750831be20491fd2b391e5302 on remote branch
Change-Id: Ib8a6a078c3ceac914a10007cfda98442b24ceb96
diff --git a/android.hardware.thermal@2.0-service.qti.rc b/android.hardware.thermal@2.0-service.qti.rc
index 4c9186c..5c98ab4 100644
--- a/android.hardware.thermal@2.0-service.qti.rc
+++ b/android.hardware.thermal@2.0-service.qti.rc
@@ -25,6 +25,10 @@
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Changes from Qualcomm Innovation Center are provided under the following license:
+# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause-Clear
service android.thermal-hal /vendor/bin/hw/android.hardware.thermal@2.0-service.qti
interface android.hardware.thermal@1.0::IThermal default
@@ -32,3 +36,6 @@
class hal
user root
group root
+
+on property:sys.boot_completed=1
+ restart android.thermal-hal
diff --git a/thermalConfig.cpp b/thermalConfig.cpp
index 291a74d..eb4e7d1 100644
--- a/thermalConfig.cpp
+++ b/thermalConfig.cpp
@@ -26,6 +26,38 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * 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
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Qualcomm Innovation Center, Inc. nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
+ * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
+ * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <unordered_map>
@@ -112,6 +144,61 @@
},
};
+ 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",
@@ -607,7 +694,7 @@
"cpu-1-3-usr",
};
- std::vector<struct target_therm_cfg> sensor_cfg_msmnile = {
+ std::vector<struct target_therm_cfg> sensor_cfg_msmnile_common = {
{
TemperatureType::CPU,
cpu_sensors_kona,
@@ -644,6 +731,9 @@
40000,
true,
},
+ };
+
+ std::vector<struct target_therm_cfg> sensor_cfg_msmnile_specific = {
{
TemperatureType::BCL_CURRENT,
{ "pm8150b-ibat-lvl0" },
@@ -949,6 +1039,9 @@
{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
@@ -970,10 +1063,10 @@
{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
@@ -990,6 +1083,10 @@
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
@@ -999,6 +1096,13 @@
{450, shima_specific}, // shima
};
+ 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)
@@ -1017,6 +1121,7 @@
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;
@@ -1054,10 +1159,13 @@
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