Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1 | /* |
Minghao Zhang | b35b008 | 2021-04-12 18:29:50 +0800 | [diff] [blame] | 2 | * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above |
| 10 | * copyright notice, this list of conditions and the following |
| 11 | * disclaimer in the documentation and/or other materials provided |
| 12 | * with the distribution. |
| 13 | * * Neither the name of The Linux Foundation nor the names of its |
| 14 | * contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 25 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 27 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 28 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 29 | * |
| 30 | * Changes from Qualcomm Innovation Center are provided under the following license: |
| 31 | * |
| 32 | * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. |
| 33 | * |
| 34 | * Redistribution and use in source and binary forms, with or without |
| 35 | * modification, are permitted provided that the following conditions are |
| 36 | * met: |
| 37 | * * Redistributions of source code must retain the above copyright |
| 38 | * notice, this list of conditions and the following disclaimer. |
| 39 | * * Redistributions in binary form must reproduce the above |
| 40 | * copyright notice, this list of conditions and the following |
| 41 | * disclaimer in the documentation and/or other materials provided |
| 42 | * with the distribution. |
| 43 | * * Neither the name of Qualcomm Innovation Center, Inc. nor the |
| 44 | * names of its contributors may be used to endorse or promote products |
| 45 | * derived from this software without specific prior written permission. |
| 46 | * |
| 47 | * |
| 48 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED |
| 49 | * BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS |
| 50 | * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |
| 51 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 52 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 53 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
| 54 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 59 | *(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 61 | */ |
| 62 | |
| 63 | #include <unordered_map> |
| 64 | #include <android-base/logging.h> |
| 65 | #include <android/hardware/thermal/2.0/IThermal.h> |
| 66 | |
| 67 | #include "thermalData.h" |
| 68 | #include "thermalConfig.h" |
| 69 | |
| 70 | namespace android { |
| 71 | namespace hardware { |
| 72 | namespace thermal { |
| 73 | namespace V2_0 { |
| 74 | namespace implementation { |
| 75 | constexpr std::string_view socIDPath("/sys/devices/soc0/soc_id"); |
| 76 | |
Minghao Zhang | b35b008 | 2021-04-12 18:29:50 +0800 | [diff] [blame] | 77 | std::vector<std::string> cpu_sensors_439 = |
| 78 | { |
| 79 | "apc1-cpu0-usr", |
| 80 | "apc1-cpu1-usr", |
| 81 | "apc1-cpu2-usr", |
| 82 | "apc1-cpu3-usr", |
| 83 | "cpuss0-usr", |
| 84 | "cpuss0-usr", |
| 85 | "cpuss0-usr", |
| 86 | "cpuss0-usr", |
| 87 | }; |
| 88 | |
| 89 | std::vector<struct target_therm_cfg> sensor_cfg_439 = |
| 90 | { |
| 91 | { |
| 92 | TemperatureType::CPU, |
| 93 | cpu_sensors_439, |
| 94 | "", |
| 95 | 95000, |
| 96 | 115000, |
| 97 | 95000, |
| 98 | true, |
| 99 | }, |
| 100 | { |
| 101 | TemperatureType::GPU, |
| 102 | { "gpu-usr" }, |
| 103 | "GPU", |
| 104 | 95000, |
| 105 | 115000, |
| 106 | 95000, |
| 107 | true, |
| 108 | }, |
| 109 | { |
| 110 | TemperatureType::SKIN, |
| 111 | { "quiet-therm-adc" }, |
| 112 | "skin", |
| 113 | 40000, |
| 114 | 95000, |
| 115 | 40000, |
| 116 | true, |
| 117 | }, |
| 118 | { |
| 119 | TemperatureType::BCL_VOLTAGE, |
| 120 | { "vbat_adc" }, |
| 121 | "vbat", |
| 122 | 3200, |
| 123 | 3000, |
| 124 | 3200, |
| 125 | false, |
| 126 | }, |
| 127 | { |
| 128 | TemperatureType::BCL_CURRENT, |
| 129 | { "ibat-high" }, |
| 130 | "ibat", |
| 131 | 4200, |
| 132 | 4400, |
| 133 | 4200, |
| 134 | true, |
| 135 | }, |
| 136 | { |
| 137 | TemperatureType::BCL_PERCENTAGE, |
| 138 | { "soc" }, |
| 139 | "soc", |
| 140 | 10, |
| 141 | 2, |
| 142 | 10, |
| 143 | false, |
| 144 | }, |
| 145 | }; |
| 146 | |
Minghao Zhang | 530c87d | 2022-08-25 22:40:53 +0800 | [diff] [blame] | 147 | std::vector<std::string> cpu_sensors_talos = |
| 148 | { |
| 149 | "cpuss-2-usr", |
| 150 | "cpuss-2-usr", |
| 151 | "cpuss-1-usr", |
| 152 | "cpuss-1-usr", |
| 153 | "cpuss-0-usr", |
| 154 | "cpuss-0-usr", |
| 155 | "cpu-1-0-usr", |
| 156 | "cpu-1-2-usr", |
| 157 | }; |
| 158 | |
| 159 | std::vector<struct target_therm_cfg> sensor_cfg_talos_common = |
| 160 | { |
| 161 | { |
| 162 | TemperatureType::CPU, |
| 163 | cpu_sensors_talos, |
| 164 | "", |
| 165 | 95000, |
| 166 | 115000, |
| 167 | 95000, |
| 168 | true, |
| 169 | }, |
| 170 | { |
| 171 | TemperatureType::GPU, |
| 172 | { "gpu-usr" }, |
| 173 | "gpu", |
| 174 | 95000, |
| 175 | 115000, |
| 176 | 95000, |
| 177 | true, |
| 178 | }, |
| 179 | { |
| 180 | TemperatureType::SKIN, |
| 181 | { "xo-therm-adc" }, |
| 182 | "skin", |
| 183 | 40000, |
| 184 | 95000, |
| 185 | 40000, |
| 186 | true, |
| 187 | }, |
| 188 | }; |
| 189 | |
| 190 | std::vector<struct target_therm_cfg> sensor_cfg_talos_specific = { |
| 191 | { |
| 192 | TemperatureType::BCL_PERCENTAGE, |
| 193 | { "soc" }, |
| 194 | "soc", |
| 195 | 10, |
| 196 | 2, |
| 197 | 10, |
| 198 | false, |
| 199 | }, |
| 200 | }; |
| 201 | |
Manaf Meethalavalappu Pallikunhi | 2d02b6c | 2021-05-25 23:43:09 +0530 | [diff] [blame] | 202 | std::vector<std::string> cpu_sensors_monaco = |
| 203 | { |
| 204 | "cpuss-0-usr", |
| 205 | "cpuss-1-usr", |
| 206 | "cpuss-0-usr", |
| 207 | "cpuss-1-usr", |
| 208 | }; |
| 209 | |
| 210 | std::vector<struct target_therm_cfg> sensor_cfg_monaco = |
| 211 | { |
| 212 | { |
| 213 | TemperatureType::CPU, |
| 214 | cpu_sensors_monaco, |
| 215 | "", |
| 216 | 95000, |
| 217 | 115000, |
| 218 | 95000, |
| 219 | true, |
| 220 | }, |
| 221 | { |
| 222 | TemperatureType::GPU, |
| 223 | { "gpu-usr" }, |
| 224 | "gpu", |
| 225 | 95000, |
| 226 | 115000, |
| 227 | 95000, |
| 228 | true, |
| 229 | }, |
| 230 | { |
| 231 | TemperatureType::SKIN, |
| 232 | { "quiet-therm-usr" }, |
| 233 | "skin", |
| 234 | 40000, |
| 235 | 95000, |
| 236 | 40000, |
| 237 | true, |
| 238 | }, |
| 239 | { |
| 240 | TemperatureType::BCL_CURRENT, |
| 241 | { "pm5100-ibat-lvl0" }, |
| 242 | "ibat", |
| 243 | 1100, |
| 244 | 1500, |
| 245 | 1100, |
| 246 | true, |
| 247 | }, |
| 248 | }; |
| 249 | |
Gopala Krishna Nuthaki | 6fd2193 | 2021-05-04 12:06:53 +0530 | [diff] [blame] | 250 | std::vector<std::string> cpu_sensors_sdm845 = |
| 251 | { |
| 252 | "cpu0-silver-usr", |
| 253 | "cpu1-silver-usr", |
| 254 | "cpu2-silver-usr", |
| 255 | "cpu3-silver-usr", |
| 256 | "cpu0-gold-usr", |
| 257 | "cpu1-gold-usr", |
| 258 | "cpu2-gold-usr", |
| 259 | "cpu3-gold-usr", |
| 260 | }; |
| 261 | |
| 262 | std::vector<struct target_therm_cfg> sensor_cfg_sdm845 = { |
| 263 | { |
| 264 | TemperatureType::CPU, |
| 265 | cpu_sensors_sdm845, |
| 266 | "", |
| 267 | 95000, |
| 268 | 115000, |
| 269 | 95000, |
| 270 | true, |
| 271 | }, |
| 272 | { |
| 273 | TemperatureType::GPU, |
| 274 | {"gpu0-usr"}, |
| 275 | "gpu0", |
| 276 | 95000, |
| 277 | 115000, |
| 278 | 95000, |
| 279 | true, |
| 280 | }, |
| 281 | { |
| 282 | TemperatureType::GPU, |
| 283 | {"gpu1-usr"}, |
| 284 | "gpu1", |
| 285 | 95000, |
| 286 | 115000, |
| 287 | 95000, |
| 288 | true, |
| 289 | }, |
| 290 | { |
| 291 | TemperatureType::SKIN, |
| 292 | {"xo-therm-adc"}, |
| 293 | "skin", |
| 294 | 40000, |
| 295 | 95000, |
| 296 | 40000, |
| 297 | true, |
| 298 | }, |
| 299 | { |
| 300 | TemperatureType::BCL_PERCENTAGE, |
| 301 | {"soc"}, |
| 302 | "soc", |
| 303 | 10, |
| 304 | 2, |
| 305 | 10, |
| 306 | false, |
| 307 | }, |
| 308 | }; |
| 309 | |
Minghao Zhang | 2658fa6 | 2020-12-28 10:16:45 +0800 | [diff] [blame] | 310 | std::vector<std::string> cpu_sensors_bengal = |
| 311 | { |
| 312 | "cpuss-2-usr", |
| 313 | "cpuss-2-usr", |
| 314 | "cpuss-2-usr", |
| 315 | "cpuss-2-usr", |
| 316 | "cpu-1-0-usr", |
| 317 | "cpu-1-1-usr", |
| 318 | "cpu-1-2-usr", |
| 319 | "cpu-1-3-usr", |
| 320 | }; |
| 321 | |
| 322 | std::vector<struct target_therm_cfg> sensor_cfg_bengal = |
| 323 | { |
| 324 | { |
| 325 | TemperatureType::CPU, |
| 326 | cpu_sensors_bengal, |
| 327 | "", |
| 328 | 95000, |
| 329 | 115000, |
| 330 | 95000, |
| 331 | true, |
| 332 | }, |
| 333 | { |
| 334 | TemperatureType::GPU, |
| 335 | { "gpu-usr" }, |
| 336 | "GPU", |
| 337 | 95000, |
| 338 | 115000, |
| 339 | 95000, |
| 340 | true, |
| 341 | }, |
| 342 | { |
| 343 | TemperatureType::SKIN, |
| 344 | { "xo-therm-usr" }, |
| 345 | "skin", |
| 346 | 40000, |
| 347 | 95000, |
| 348 | 40000, |
| 349 | true, |
| 350 | }, |
| 351 | { |
| 352 | TemperatureType::BCL_VOLTAGE, |
| 353 | { "pmi632-vbat-lvl0" }, |
| 354 | "vbat", |
| 355 | 3000, |
| 356 | 2800, |
| 357 | 3000, |
| 358 | false, |
| 359 | }, |
| 360 | { |
| 361 | TemperatureType::BCL_CURRENT, |
| 362 | { "pmi632-ibat-lvl0" }, |
| 363 | "ibat", |
| 364 | 4000, |
| 365 | 4200, |
| 366 | 4000, |
| 367 | true, |
| 368 | }, |
| 369 | { |
| 370 | TemperatureType::BCL_PERCENTAGE, |
| 371 | { "soc" }, |
| 372 | "soc", |
| 373 | 10, |
| 374 | 2, |
| 375 | 10, |
| 376 | false, |
| 377 | }, |
| 378 | }; |
Minghao Zhang | ae04ce3 | 2020-09-23 23:28:34 +0800 | [diff] [blame] | 379 | |
Manaf Meethalavalappu Pallikunhi | 91e6f8d | 2021-06-02 23:13:43 +0530 | [diff] [blame] | 380 | std::vector<struct target_therm_cfg> sensor_cfg_khaje = |
| 381 | { |
| 382 | { |
| 383 | TemperatureType::CPU, |
| 384 | cpu_sensors_bengal, |
| 385 | "", |
| 386 | 95000, |
| 387 | 115000, |
| 388 | 95000, |
| 389 | true, |
| 390 | }, |
| 391 | { |
| 392 | TemperatureType::GPU, |
| 393 | { "gpu-usr" }, |
| 394 | "GPU", |
| 395 | 95000, |
| 396 | 115000, |
| 397 | 95000, |
| 398 | true, |
| 399 | }, |
| 400 | { |
| 401 | TemperatureType::SKIN, |
| 402 | { "xo-therm-usr" }, |
| 403 | "skin", |
| 404 | 40000, |
| 405 | 95000, |
| 406 | 40000, |
| 407 | true, |
| 408 | }, |
| 409 | { |
| 410 | TemperatureType::BCL_VOLTAGE, |
| 411 | { "pm7250b-vbat-lvl0" }, |
| 412 | "vbat", |
| 413 | 3000, |
| 414 | 2800, |
| 415 | 3000, |
| 416 | false, |
| 417 | }, |
| 418 | { |
| 419 | TemperatureType::BCL_CURRENT, |
| 420 | { "pm7250b-ibat-lvl0" }, |
| 421 | "ibat", |
| 422 | 5500, |
| 423 | 6000, |
| 424 | 5500, |
| 425 | true, |
| 426 | }, |
| 427 | { |
| 428 | TemperatureType::BCL_PERCENTAGE, |
| 429 | { "soc" }, |
| 430 | "soc", |
| 431 | 10, |
| 432 | 2, |
| 433 | 10, |
| 434 | false, |
| 435 | }, |
| 436 | }; |
| 437 | |
Minghao Zhang | ae04ce3 | 2020-09-23 23:28:34 +0800 | [diff] [blame] | 438 | std::vector<std::string> cpu_sensors_trinket = |
| 439 | { |
| 440 | "cpuss-0-usr", |
| 441 | "cpuss-0-usr", |
| 442 | "cpuss-0-usr", |
| 443 | "cpuss-0-usr", |
| 444 | "cpu-1-0-usr", |
| 445 | "cpu-1-1-usr", |
| 446 | "cpu-1-2-usr", |
| 447 | "cpu-1-3-usr", |
| 448 | }; |
| 449 | |
| 450 | std::vector<struct target_therm_cfg> sensor_cfg_trinket = |
| 451 | { |
| 452 | { |
| 453 | TemperatureType::CPU, |
| 454 | cpu_sensors_trinket, |
| 455 | "", |
| 456 | 95000, |
| 457 | 115000, |
| 458 | 95000, |
| 459 | true, |
| 460 | }, |
| 461 | { |
| 462 | TemperatureType::GPU, |
| 463 | { "gpu-usr" }, |
| 464 | "GPU", |
| 465 | 95000, |
| 466 | 115000, |
| 467 | 95000, |
| 468 | true, |
| 469 | }, |
| 470 | { |
| 471 | TemperatureType::SKIN, |
| 472 | { "xo-therm-adc" }, |
| 473 | "skin", |
| 474 | 40000, |
| 475 | 95000, |
| 476 | 40000, |
| 477 | true, |
| 478 | }, |
| 479 | { |
| 480 | TemperatureType::BCL_VOLTAGE, |
| 481 | { "pmi632-vbat-lvl0" }, |
| 482 | "vbat", |
| 483 | 3000, |
| 484 | 2800, |
| 485 | 3000, |
| 486 | false, |
| 487 | }, |
| 488 | { |
| 489 | TemperatureType::BCL_CURRENT, |
| 490 | { "pmi632-ibat-lvl0" }, |
| 491 | "ibat", |
| 492 | 4000, |
| 493 | 4200, |
| 494 | 4000, |
| 495 | true, |
| 496 | }, |
| 497 | { |
| 498 | TemperatureType::BCL_PERCENTAGE, |
| 499 | { "soc" }, |
| 500 | "soc", |
| 501 | 10, |
| 502 | 2, |
| 503 | 10, |
| 504 | false, |
| 505 | }, |
| 506 | }; |
| 507 | |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 508 | std::vector<std::string> cpu_sensors_lito = |
| 509 | { |
| 510 | "cpu-0-0-usr", |
| 511 | "cpu-0-1-usr", |
| 512 | "cpu-0-2-usr", |
| 513 | "cpu-0-3-usr", |
| 514 | "cpu-0-4-usr", |
| 515 | "cpu-0-5-usr", |
| 516 | "cpu-1-0-usr", |
| 517 | "cpu-1-2-usr", |
| 518 | }; |
| 519 | |
| 520 | std::vector<struct target_therm_cfg> sensor_cfg_lito = |
| 521 | { |
| 522 | { |
| 523 | TemperatureType::CPU, |
| 524 | cpu_sensors_lito, |
| 525 | "", |
| 526 | 95000, |
| 527 | 115000, |
| 528 | 95000, |
| 529 | true, |
| 530 | }, |
| 531 | { |
| 532 | TemperatureType::GPU, |
| 533 | { "gpuss-0-usr" }, |
| 534 | "GPU", |
| 535 | 95000, |
| 536 | 115000, |
| 537 | 95000, |
| 538 | true, |
| 539 | }, |
| 540 | { |
| 541 | TemperatureType::SKIN, |
| 542 | { "xo-therm-usr" }, |
| 543 | "skin", |
| 544 | 40000, |
Minghao Zhang | 50998c8 | 2020-09-11 17:17:13 +0800 | [diff] [blame] | 545 | 95000, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 546 | 40000, |
| 547 | true, |
| 548 | }, |
| 549 | { |
| 550 | TemperatureType::BCL_CURRENT, |
| 551 | { "pm7250b-ibat-lvl0" }, |
| 552 | "ibat", |
| 553 | 4500, |
| 554 | 5000, |
| 555 | 4500, |
| 556 | true, |
| 557 | }, |
| 558 | { |
| 559 | TemperatureType::BCL_VOLTAGE, |
| 560 | { "pm7250b-vbat-lvl0" }, |
| 561 | "vbat", |
| 562 | 3200, |
| 563 | 3000, |
| 564 | 3200, |
| 565 | false, |
| 566 | }, |
| 567 | { |
| 568 | TemperatureType::BCL_PERCENTAGE, |
| 569 | { "soc" }, |
| 570 | "soc", |
| 571 | 10, |
| 572 | 2, |
| 573 | 10, |
| 574 | false, |
| 575 | }, |
| 576 | }; |
| 577 | |
Minghao Zhang | ae04ce3 | 2020-09-23 23:28:34 +0800 | [diff] [blame] | 578 | std::vector<struct target_therm_cfg> sensor_cfg_sdmmagpie = |
| 579 | { |
| 580 | { |
| 581 | TemperatureType::CPU, |
| 582 | cpu_sensors_lito, |
| 583 | "", |
| 584 | 95000, |
| 585 | 115000, |
| 586 | 95000, |
| 587 | true, |
| 588 | }, |
| 589 | { |
| 590 | TemperatureType::GPU, |
| 591 | { "gpuss-0-usr" }, |
| 592 | "GPU", |
| 593 | 95000, |
| 594 | 115000, |
| 595 | 95000, |
| 596 | true, |
| 597 | }, |
| 598 | { |
| 599 | TemperatureType::SKIN, |
| 600 | { "xo-therm-adc" }, |
| 601 | "skin", |
| 602 | 40000, |
| 603 | 95000, |
| 604 | 40000, |
| 605 | true, |
| 606 | }, |
| 607 | { |
| 608 | TemperatureType::BCL_VOLTAGE, |
| 609 | { "pm6150-vbat-lvl0" }, |
| 610 | "vbat", |
| 611 | 3000, |
| 612 | 2800, |
| 613 | 3000, |
| 614 | false, |
| 615 | }, |
| 616 | { |
| 617 | TemperatureType::BCL_CURRENT, |
| 618 | { "pm6150-ibat-lvl0" }, |
| 619 | "ibat", |
| 620 | 5500, |
| 621 | 6000, |
| 622 | 5500, |
| 623 | true, |
| 624 | }, |
| 625 | { |
| 626 | TemperatureType::BCL_PERCENTAGE, |
| 627 | { "soc" }, |
| 628 | "soc", |
| 629 | 10, |
| 630 | 2, |
| 631 | 10, |
| 632 | false, |
| 633 | }, |
| 634 | }; |
| 635 | |
Manaf Meethalavalappu Pallikunhi | 8c2153e | 2020-09-04 00:46:47 +0530 | [diff] [blame] | 636 | std::vector<struct target_therm_cfg> sensor_cfg_holi = |
| 637 | { |
| 638 | { |
| 639 | TemperatureType::CPU, |
| 640 | cpu_sensors_lito, |
| 641 | "", |
| 642 | 95000, |
| 643 | 115000, |
| 644 | 95000, |
| 645 | true, |
| 646 | }, |
| 647 | { |
| 648 | TemperatureType::GPU, |
| 649 | { "gpuss-0-usr" }, |
| 650 | "gpu0", |
| 651 | 95000, |
| 652 | 115000, |
| 653 | 95000, |
| 654 | true, |
| 655 | }, |
| 656 | { |
| 657 | TemperatureType::GPU, |
| 658 | { "gpuss-1-usr" }, |
| 659 | "gpu1", |
| 660 | 95000, |
| 661 | 115000, |
| 662 | 95000, |
| 663 | true, |
| 664 | }, |
| 665 | { |
| 666 | TemperatureType::SKIN, |
| 667 | { "quiet-therm-usr" }, |
| 668 | "skin", |
| 669 | 40000, |
| 670 | 95000, |
| 671 | 40000, |
| 672 | true, |
| 673 | }, |
| 674 | { |
| 675 | TemperatureType::BCL_CURRENT, |
| 676 | { "pm7250b-ibat-lvl0" }, |
| 677 | "ibat", |
| 678 | 5500, |
| 679 | 6000, |
| 680 | 5500, |
| 681 | true, |
| 682 | }, |
| 683 | }; |
| 684 | |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 685 | std::vector<std::string> cpu_sensors_kona = |
| 686 | { |
| 687 | "cpu-0-0-usr", |
| 688 | "cpu-0-1-usr", |
| 689 | "cpu-0-2-usr", |
| 690 | "cpu-0-3-usr", |
| 691 | "cpu-1-0-usr", |
| 692 | "cpu-1-1-usr", |
| 693 | "cpu-1-2-usr", |
| 694 | "cpu-1-3-usr", |
| 695 | }; |
| 696 | |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 697 | std::vector<struct target_therm_cfg> sensor_cfg_msmnile_common = { |
Minghao Zhang | 035f95e | 2020-11-16 09:52:40 +0800 | [diff] [blame] | 698 | { |
| 699 | TemperatureType::CPU, |
| 700 | cpu_sensors_kona, |
| 701 | "", |
| 702 | 95000, |
| 703 | 115000, |
| 704 | 95000, |
| 705 | true, |
| 706 | }, |
| 707 | { |
| 708 | TemperatureType::GPU, |
| 709 | { "gpuss-0-usr" }, |
| 710 | "gpu0", |
| 711 | 95000, |
| 712 | 115000, |
| 713 | 95000, |
| 714 | true, |
| 715 | }, |
| 716 | { |
| 717 | TemperatureType::GPU, |
| 718 | { "gpuss-1-usr" }, |
| 719 | "gpu1", |
| 720 | 95000, |
| 721 | 115000, |
| 722 | 95000, |
| 723 | true, |
| 724 | }, |
| 725 | { |
| 726 | TemperatureType::SKIN, |
| 727 | { "xo-therm" }, |
| 728 | "skin", |
| 729 | 40000, |
| 730 | 95000, |
| 731 | 40000, |
| 732 | true, |
| 733 | }, |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 734 | }; |
| 735 | |
| 736 | std::vector<struct target_therm_cfg> sensor_cfg_msmnile_specific = { |
Minghao Zhang | 035f95e | 2020-11-16 09:52:40 +0800 | [diff] [blame] | 737 | { |
| 738 | TemperatureType::BCL_CURRENT, |
| 739 | { "pm8150b-ibat-lvl0" }, |
| 740 | "ibat", |
| 741 | 4500, |
| 742 | 5000, |
| 743 | 4500, |
| 744 | true, |
| 745 | }, |
| 746 | { |
| 747 | TemperatureType::BCL_VOLTAGE, |
| 748 | { "pm8150b-vbat-lvl0" }, |
| 749 | "vbat", |
| 750 | 3200, |
| 751 | 3000, |
| 752 | 3200, |
| 753 | false, |
| 754 | }, |
| 755 | { |
| 756 | TemperatureType::BCL_PERCENTAGE, |
| 757 | { "soc" }, |
| 758 | "soc", |
| 759 | 10, |
| 760 | 2, |
| 761 | 10, |
| 762 | false, |
| 763 | }, |
| 764 | }; |
| 765 | |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 766 | std::vector<struct target_therm_cfg> kona_common = { |
| 767 | { |
| 768 | TemperatureType::CPU, |
| 769 | cpu_sensors_kona, |
| 770 | "", |
| 771 | 95000, |
| 772 | 115000, |
| 773 | 95000, |
| 774 | true, |
| 775 | }, |
| 776 | { |
| 777 | TemperatureType::GPU, |
| 778 | { "gpuss-0-usr" }, |
| 779 | "GPU0", |
| 780 | 95000, |
| 781 | 115000, |
| 782 | 95000, |
| 783 | true, |
| 784 | }, |
| 785 | { |
| 786 | TemperatureType::GPU, |
| 787 | { "gpuss-1-usr" }, |
| 788 | "GPU1", |
| 789 | 95000, |
| 790 | 115000, |
| 791 | 95000, |
| 792 | true, |
| 793 | }, |
| 794 | { |
| 795 | TemperatureType::SKIN, |
| 796 | { "skin-msm-therm-usr" }, |
| 797 | "skin", |
| 798 | 40000, |
| 799 | 95000, |
| 800 | 40000, |
| 801 | true, |
| 802 | } |
| 803 | }; |
| 804 | |
| 805 | std::vector<struct target_therm_cfg> kona_specific = { |
| 806 | { |
| 807 | TemperatureType::BCL_CURRENT, |
| 808 | { "pm8150b-ibat-lvl0" }, |
| 809 | "ibat", |
| 810 | 4500, |
| 811 | 5000, |
| 812 | 4500, |
| 813 | true, |
| 814 | }, |
| 815 | { |
| 816 | TemperatureType::BCL_VOLTAGE, |
| 817 | { "pm8150b-vbat-lvl0" }, |
| 818 | "vbat", |
| 819 | 3200, |
| 820 | 3000, |
| 821 | 3200, |
| 822 | false, |
| 823 | }, |
| 824 | { |
| 825 | TemperatureType::BCL_PERCENTAGE, |
| 826 | { "soc" }, |
| 827 | "soc", |
| 828 | 10, |
| 829 | 2, |
| 830 | 10, |
| 831 | false, |
| 832 | }, |
| 833 | { |
| 834 | TemperatureType::NPU, |
| 835 | { "npu-usr" }, |
| 836 | "npu", |
| 837 | 95000, |
Ram Chandrasekar | c49329d | 2020-08-25 14:28:02 -0700 | [diff] [blame] | 838 | 115000, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 839 | 95000, |
| 840 | true, |
| 841 | }, |
| 842 | }; |
| 843 | |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 844 | std::vector<std::string> cpu_sensors_lahaina = |
| 845 | { |
| 846 | "cpu-0-0-usr", |
| 847 | "cpu-0-1-usr", |
| 848 | "cpu-0-2-usr", |
| 849 | "cpu-0-3-usr", |
| 850 | "cpu-1-0-usr", |
| 851 | "cpu-1-2-usr", |
| 852 | "cpu-1-4-usr", |
| 853 | "cpu-1-6-usr", |
| 854 | }; |
| 855 | |
| 856 | std::vector<struct target_therm_cfg> lahaina_common = { |
| 857 | { |
| 858 | TemperatureType::CPU, |
| 859 | cpu_sensors_lahaina, |
| 860 | "", |
| 861 | 95000, |
| 862 | 115000, |
| 863 | 95000, |
| 864 | true, |
| 865 | }, |
| 866 | { |
| 867 | TemperatureType::GPU, |
| 868 | { "gpuss-0-usr" }, |
| 869 | "GPU0", |
| 870 | 95000, |
| 871 | 115000, |
| 872 | 95000, |
| 873 | true, |
| 874 | }, |
| 875 | { |
| 876 | TemperatureType::GPU, |
| 877 | { "gpuss-1-usr" }, |
| 878 | "GPU1", |
| 879 | 95000, |
| 880 | 115000, |
| 881 | 95000, |
| 882 | true, |
| 883 | }, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 884 | { |
| 885 | TemperatureType::BCL_CURRENT, |
| 886 | { "pm8350b-ibat-lvl0" }, |
| 887 | "ibat", |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 888 | 6000, |
| 889 | 7500, |
| 890 | 6000, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 891 | true, |
| 892 | }, |
| 893 | { |
| 894 | TemperatureType::NPU, |
| 895 | { "nspss-0-usr" }, |
| 896 | "nsp0", |
| 897 | 95000, |
Ram Chandrasekar | c49329d | 2020-08-25 14:28:02 -0700 | [diff] [blame] | 898 | 115000, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 899 | 95000, |
| 900 | true, |
| 901 | }, |
| 902 | { |
| 903 | TemperatureType::NPU, |
| 904 | { "nspss-1-usr" }, |
| 905 | "nsp1", |
| 906 | 95000, |
Ram Chandrasekar | c49329d | 2020-08-25 14:28:02 -0700 | [diff] [blame] | 907 | 115000, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 908 | 95000, |
| 909 | true, |
| 910 | }, |
| 911 | { |
| 912 | TemperatureType::NPU, |
| 913 | { "nspss-2-usr" }, |
| 914 | "nsp2", |
| 915 | 95000, |
Ram Chandrasekar | c49329d | 2020-08-25 14:28:02 -0700 | [diff] [blame] | 916 | 115000, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 917 | 95000, |
| 918 | true, |
| 919 | }, |
| 920 | }; |
| 921 | |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 922 | std::vector<struct target_therm_cfg> lahaina_specific = { |
| 923 | { |
| 924 | TemperatureType::SKIN, |
Minghao Zhang | 7273761 | 2020-10-29 10:32:44 +0800 | [diff] [blame] | 925 | { "xo-therm-usr" }, |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 926 | "skin", |
Minghao Zhang | 7273761 | 2020-10-29 10:32:44 +0800 | [diff] [blame] | 927 | 55000, |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 928 | 95000, |
Minghao Zhang | 7273761 | 2020-10-29 10:32:44 +0800 | [diff] [blame] | 929 | 55000, |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 930 | true, |
| 931 | }, |
| 932 | }; |
| 933 | |
| 934 | std::vector<struct target_therm_cfg> shima_specific = { |
| 935 | { |
| 936 | TemperatureType::SKIN, |
| 937 | { "quiet-therm-usr" }, |
| 938 | "skin", |
| 939 | 40000, |
| 940 | 95000, |
| 941 | 40000, |
| 942 | true, |
| 943 | }, |
| 944 | }; |
| 945 | |
Gopala Krishna Nuthaki | e920869 | 2021-01-18 15:51:39 +0530 | [diff] [blame] | 946 | std::vector<struct target_therm_cfg> sensor_cfg_yupik = { |
| 947 | { |
| 948 | TemperatureType::CPU, |
| 949 | cpu_sensors_lahaina, |
| 950 | "", |
| 951 | 95000, |
| 952 | 115000, |
| 953 | 95000, |
| 954 | true, |
| 955 | }, |
| 956 | { |
| 957 | TemperatureType::GPU, |
| 958 | { "gpuss-0-usr" }, |
| 959 | "GPU0", |
| 960 | 95000, |
| 961 | 115000, |
| 962 | 95000, |
| 963 | true, |
| 964 | }, |
| 965 | { |
| 966 | TemperatureType::GPU, |
| 967 | { "gpuss-1-usr" }, |
| 968 | "GPU1", |
| 969 | 95000, |
| 970 | 115000, |
| 971 | 95000, |
| 972 | true, |
| 973 | }, |
| 974 | { |
| 975 | TemperatureType::NPU, |
| 976 | { "nspss-0-usr" }, |
| 977 | "nsp0", |
| 978 | 95000, |
| 979 | 115000, |
| 980 | 95000, |
| 981 | true, |
| 982 | }, |
| 983 | { |
| 984 | TemperatureType::NPU, |
| 985 | { "nspss-1-usr" }, |
| 986 | "nsp1", |
| 987 | 95000, |
| 988 | 115000, |
| 989 | 95000, |
| 990 | true, |
| 991 | }, |
| 992 | { |
| 993 | TemperatureType::SKIN, |
| 994 | { "quiet-therm-usr" }, |
| 995 | "skin", |
| 996 | 40000, |
| 997 | 95000, |
| 998 | 40000, |
| 999 | true, |
| 1000 | }, |
| 1001 | }; |
| 1002 | |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1003 | struct target_therm_cfg bat_conf = { |
| 1004 | TemperatureType::BATTERY, |
| 1005 | { "battery" }, |
| 1006 | "battery", |
| 1007 | 80000, |
| 1008 | 90000, |
| 1009 | 80000, |
| 1010 | true, |
| 1011 | }; |
| 1012 | |
| 1013 | std::vector<struct target_therm_cfg> bcl_conf = { |
| 1014 | { |
| 1015 | TemperatureType::BCL_VOLTAGE, |
| 1016 | { "vbat" }, |
| 1017 | "vbat", |
| 1018 | 3200, |
| 1019 | 3000, |
| 1020 | 3200, |
| 1021 | false, |
| 1022 | }, |
| 1023 | { |
| 1024 | TemperatureType::BCL_PERCENTAGE, |
| 1025 | { "socd" }, |
| 1026 | "socd", |
| 1027 | 90, |
| 1028 | 99, |
| 1029 | 90, |
| 1030 | true, |
| 1031 | }, |
| 1032 | }; |
| 1033 | |
| 1034 | const std::unordered_map<int, std::vector<struct target_therm_cfg>> |
| 1035 | msm_soc_map = { |
Minghao Zhang | b35b008 | 2021-04-12 18:29:50 +0800 | [diff] [blame] | 1036 | {353, sensor_cfg_439}, |
| 1037 | {354, sensor_cfg_439}, |
| 1038 | {363, sensor_cfg_439}, |
| 1039 | {364, sensor_cfg_439}, |
| 1040 | {416, sensor_cfg_439}, |
| 1041 | {437, sensor_cfg_439}, |
Minghao Zhang | 530c87d | 2022-08-25 22:40:53 +0800 | [diff] [blame] | 1042 | {355, sensor_cfg_talos_common}, |
| 1043 | {377, sensor_cfg_talos_common}, |
| 1044 | {380, sensor_cfg_talos_common}, |
Gopala Krishna Nuthaki | 6fd2193 | 2021-05-04 12:06:53 +0530 | [diff] [blame] | 1045 | {321, sensor_cfg_sdm845}, |
| 1046 | {341, sensor_cfg_sdm845}, |
Minghao Zhang | 2658fa6 | 2020-12-28 10:16:45 +0800 | [diff] [blame] | 1047 | {417, sensor_cfg_bengal}, // bengal |
| 1048 | {420, sensor_cfg_bengal}, |
| 1049 | {444, sensor_cfg_bengal}, |
| 1050 | {445, sensor_cfg_bengal}, |
| 1051 | {469, sensor_cfg_bengal}, |
| 1052 | {470, sensor_cfg_bengal}, |
Manaf Meethalavalappu Pallikunhi | 91e6f8d | 2021-06-02 23:13:43 +0530 | [diff] [blame] | 1053 | {518, sensor_cfg_khaje}, //khaje |
Minghao Zhang | ae04ce3 | 2020-09-23 23:28:34 +0800 | [diff] [blame] | 1054 | {394, sensor_cfg_trinket}, |
| 1055 | {467, sensor_cfg_trinket}, |
| 1056 | {468, sensor_cfg_trinket}, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1057 | {400, sensor_cfg_lito}, // lito |
| 1058 | {440, sensor_cfg_lito}, |
| 1059 | {407, sensor_cfg_lito}, // atoll |
Minghao Zhang | ae04ce3 | 2020-09-23 23:28:34 +0800 | [diff] [blame] | 1060 | {365, sensor_cfg_sdmmagpie}, |
| 1061 | {366, sensor_cfg_sdmmagpie}, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1062 | {434, sensor_cfg_lito}, // lagoon |
Minghao Zhang | 15c2bdc | 2021-01-14 14:51:25 +0800 | [diff] [blame] | 1063 | {435, sensor_cfg_lito}, |
| 1064 | {459, sensor_cfg_lito}, |
Gopala Krishna Nuthaki | b99fef3 | 2020-09-09 14:26:32 +0530 | [diff] [blame] | 1065 | {476, sensor_cfg_lito}, // orchid |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 1066 | {339, sensor_cfg_msmnile_common}, |
| 1067 | {361, sensor_cfg_msmnile_common}, |
| 1068 | {362, sensor_cfg_msmnile_common}, |
| 1069 | {367, sensor_cfg_msmnile_common}, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1070 | {356, kona_common}, // kona |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 1071 | {415, lahaina_common}, // lahaina |
| 1072 | {439, lahaina_common}, // lahainap |
| 1073 | {456, lahaina_common}, // lahaina-atp |
Minghao Zhang | 31932a0 | 2021-03-08 10:58:11 +0800 | [diff] [blame] | 1074 | {501, lahaina_common}, |
| 1075 | {502, lahaina_common}, |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 1076 | {450, lahaina_common}, // shima |
Manaf Meethalavalappu Pallikunhi | 8c2153e | 2020-09-04 00:46:47 +0530 | [diff] [blame] | 1077 | {454, sensor_cfg_holi}, // holi |
Manaf Meethalavalappu Pallikunhi | 1e7b60a | 2021-05-25 22:20:39 +0530 | [diff] [blame] | 1078 | {507, sensor_cfg_holi}, // blair |
Gopala Krishna Nuthaki | e920869 | 2021-01-18 15:51:39 +0530 | [diff] [blame] | 1079 | {475, sensor_cfg_yupik}, // yupik |
Gopala Krishna Nuthaki | 15c1be2 | 2021-03-16 19:43:17 +0530 | [diff] [blame] | 1080 | {515, sensor_cfg_yupik}, // YUPIK-LTE |
Manaf Meethalavalappu Pallikunhi | 2d02b6c | 2021-05-25 23:43:09 +0530 | [diff] [blame] | 1081 | {486, sensor_cfg_monaco}, // monaco |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1082 | }; |
| 1083 | |
| 1084 | const std::unordered_map<int, std::vector<struct target_therm_cfg>> |
| 1085 | msm_soc_specific = { |
Minghao Zhang | 530c87d | 2022-08-25 22:40:53 +0800 | [diff] [blame] | 1086 | {355, sensor_cfg_talos_specific}, |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 1087 | {339, sensor_cfg_msmnile_specific}, |
| 1088 | {361, sensor_cfg_msmnile_specific}, |
| 1089 | {362, sensor_cfg_msmnile_specific}, |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1090 | {356, kona_specific}, // kona |
| 1091 | {415, lahaina_specific}, // lahaina |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 1092 | {439, lahaina_specific}, // lahainap |
| 1093 | {456, lahaina_specific}, // lahaina-atp |
Minghao Zhang | 31932a0 | 2021-03-08 10:58:11 +0800 | [diff] [blame] | 1094 | {501, lahaina_specific}, |
| 1095 | {502, lahaina_specific}, |
Manaf Meethalavalappu Pallikunhi | 9dd647c | 2020-09-09 01:20:40 +0530 | [diff] [blame] | 1096 | {450, shima_specific}, // shima |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1097 | }; |
| 1098 | |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 1099 | const std::unordered_map<int, bool> |
| 1100 | battery_bcl_cfg_disable_map = { |
| 1101 | {367, true}, |
Minghao Zhang | 530c87d | 2022-08-25 22:40:53 +0800 | [diff] [blame] | 1102 | {377, true}, |
| 1103 | {380, true}, |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 1104 | }; |
| 1105 | |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1106 | std::vector<struct target_therm_cfg> add_target_config( |
| 1107 | int socID, |
| 1108 | std::vector<struct target_therm_cfg> conf) |
| 1109 | { |
| 1110 | std::vector<struct target_therm_cfg> targetConf; |
| 1111 | |
| 1112 | if (msm_soc_specific.find(socID) == msm_soc_specific.end()) |
| 1113 | return conf; |
| 1114 | targetConf = (msm_soc_specific.find(socID))->second; |
| 1115 | |
| 1116 | conf.insert(conf.end(), targetConf.begin(), |
| 1117 | targetConf.end()); |
| 1118 | return conf; |
| 1119 | } |
| 1120 | |
| 1121 | ThermalConfig::ThermalConfig():cmnInst() |
| 1122 | { |
| 1123 | std::unordered_map<int, std::vector<struct target_therm_cfg>>::const_iterator it; |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 1124 | std::unordered_map<int, bool>::const_iterator it_2; |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1125 | std::vector<struct target_therm_cfg>::iterator it_vec; |
| 1126 | bool bcl_defined = false; |
| 1127 | std::string soc_val; |
Gopala Krishna Nuthaki | 774bf10 | 2022-03-17 17:55:17 +0530 | [diff] [blame] | 1128 | int ct = 0; |
| 1129 | bool read_ok = false; |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1130 | |
Gopala Krishna Nuthaki | 774bf10 | 2022-03-17 17:55:17 +0530 | [diff] [blame] | 1131 | do { |
| 1132 | if (cmnInst.readFromFile(socIDPath, soc_val) <= 0) { |
| 1133 | LOG(ERROR) <<"soc ID fetch error"; |
| 1134 | return; |
| 1135 | } |
| 1136 | try { |
| 1137 | soc_id = std::stoi(soc_val, nullptr, 0); |
| 1138 | read_ok = true; |
| 1139 | } |
| 1140 | catch (std::exception &err) { |
| 1141 | LOG(ERROR) <<"soc id stoi err:" << err.what() |
| 1142 | << " buf:" << soc_val; |
| 1143 | } |
| 1144 | ct++; |
| 1145 | } while (!read_ok && ct < RETRY_CT); |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1146 | if (soc_id <= 0) { |
| 1147 | LOG(ERROR) << "Invalid soc ID: " << soc_id; |
| 1148 | return; |
| 1149 | } |
| 1150 | it = msm_soc_map.find(soc_id); |
| 1151 | if (it == msm_soc_map.end()) { |
| 1152 | LOG(ERROR) << "No config for soc ID: " << soc_id; |
| 1153 | return; |
| 1154 | } |
| 1155 | thermalConfig = add_target_config(soc_id, it->second); |
| 1156 | for (it_vec = thermalConfig.begin(); |
| 1157 | it_vec != thermalConfig.end(); it_vec++) { |
| 1158 | if (it_vec->type == TemperatureType::BCL_PERCENTAGE) |
| 1159 | bcl_defined = true; |
| 1160 | } |
| 1161 | |
Minghao Zhang | e997b13 | 2022-08-25 22:26:31 +0800 | [diff] [blame] | 1162 | it_2 = battery_bcl_cfg_disable_map.find(soc_id); |
| 1163 | if (it_2 == battery_bcl_cfg_disable_map.end() || !it_2->second) { |
| 1164 | thermalConfig.push_back(bat_conf); |
| 1165 | if (!bcl_defined) |
| 1166 | thermalConfig.insert(thermalConfig.end(), |
| 1167 | bcl_conf.begin(), bcl_conf.end()); |
| 1168 | } |
Ram Chandrasekar | dac8f7d | 2020-06-10 12:23:28 -0700 | [diff] [blame] | 1169 | LOG(DEBUG) << "Total sensors:" << thermalConfig.size(); |
| 1170 | } |
| 1171 | } // namespace implementation |
| 1172 | } // namespace V2_0 |
| 1173 | } // namespace thermal |
| 1174 | } // namespace hardware |
| 1175 | } // namespace android |
| 1176 | |