1 /* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *  * Redistributions of source code must retain the above copyright
7  *    notice, this list of conditions and the following disclaimer.
8  *  * Redistributions in binary form must reproduce the above
9  *    copyright notice, this list of conditions and the following
10  *    disclaimer in the documentation and/or other materials provided
11  *    with the distribution.
12  *  * Neither the name of The Linux Foundation nor the names of its
13  *    contributors may be used to endorse or promote products derived
14  *    from this software without specific prior written permission.
15 
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #define LOG_TAG "ThermalHAL-TARGET"
30 #include <utils/Log.h>
31 
32 #include <hardware/hardware.h>
33 #include <hardware/thermal.h>
34 #include <stdlib.h>
35 #include "thermal_common.h"
36 
37 #define SYSFS_PLATFORMID   "/sys/devices/soc0/soc_id"
38 #define SOC_INFO_NAME_LEN  15
39 
40 struct therm_msm_soc_type {
41     enum therm_msm_id msm_id;
42     int  soc_id;
43 };
44 
45 static struct therm_msm_soc_type msm_soc_table[] = {
46     {THERM_MSM_8953, 293},
47     {THERM_MSM_8953, 304},
48     {THERM_MSM_8953, 338},
49     {THERM_MSM_8953, 351},
50     {THERM_SDM_660, 317},
51     {THERM_SDM_660, 324},
52     {THERM_SDM_660, 325},
53     {THERM_SDM_660, 326},
54     {THERM_SDM_660, 345},
55     {THERM_SDM_660, 346},
56     {THERM_SDM_630, 318},
57     {THERM_SDM_630, 327},
58     {THERM_SDM_630, 385},
59     {THERM_SDM_710, 336},
60     {THERM_SDM_710, 337},
61     {THERM_SDM_710, 393}, // This SOC ID is for SDM712
62     {THERM_QCS_605, 347},
63     {THERM_SDM_632, 349},
64     {THERM_SDM_632, 350},
65     {THERM_SDM_439, 353},
66     {THERM_SDM_439, 354},
67     {THERM_SDM_439, 363},
68     {THERM_SDM_439, 364},
69     {THERM_MSMNILE, 339},
70     {THERM_MSMNILE, 361},
71     {THERM_MSMNILE, 362},
72     {THERM_MSMNILE, 367},
73     {THERM_KONA, 356},
74     {THERM_TALOS,  355},
75     {THERM_SDMMAGPIE, 365},
76     {THERM_MSM_8917, 303},
77     {THERM_MSM_8917, 307},
78     {THERM_MSM_8917, 308},
79     {THERM_MSM_8917, 309},
80     {THERM_MSM_8917, 386}, // This SOC ID is for QM215
81     {THERM_TRINKET,  394},
82     {THERM_LITO,  400},
83     {THERM_ATOLL,  407},
84 };
85 
86 static char *cpu_sensors_talos[] =
87 {
88     "cpuss-2-usr",
89     "cpuss-2-usr",
90     "cpuss-1-usr",
91     "cpuss-1-usr",
92     "cpuss-0-usr",
93     "cpuss-0-usr",
94     "cpu-1-0-usr",
95     "cpu-1-2-usr",
96 };
97 
98 static char *misc_sensors_talos[] =
99 {
100     "gpu-usr",
101     "battery",
102     "xo-therm"
103 };
104 
105 static struct target_therm_cfg sensor_cfg_talos[] = {
106     {
107         .type = DEVICE_TEMPERATURE_CPU,
108         .sensor_list = cpu_sensors_talos,
109         .sens_cnt = ARRAY_SIZE(cpu_sensors_talos),
110         .mult = 0.001,
111     },
112     {
113         .type = DEVICE_TEMPERATURE_GPU,
114         .sensor_list = &misc_sensors_talos[0],
115         .sens_cnt = 1,
116         .mult = 0.001,
117         .label = "GPU",
118     },
119     {
120         .type = DEVICE_TEMPERATURE_BATTERY,
121         .sensor_list = &misc_sensors_talos[1],
122         .sens_cnt = 1,
123         .mult = 0.001,
124         .label = "battery",
125     },
126     {
127         .type = DEVICE_TEMPERATURE_SKIN,
128         .sensor_list = &misc_sensors_talos[2],
129         .sens_cnt = 1,
130         .mult = 0.001,
131         .label = "skin",
132     }
133 };
134 
135 static char *cpu_sensors_sdmmagpie[] =
136 {
137     "cpu-0-0-usr",
138     "cpu-0-1-usr",
139     "cpu-0-2-usr",
140     "cpu-0-3-usr",
141     "cpu-0-4-usr",
142     "cpu-0-5-usr",
143     "cpu-1-0-usr",
144     "cpu-1-2-usr",
145 };
146 
147 static char *misc_sensors_sdmmagpie[] =
148 {
149     "gpuss-0-usr",
150     "battery",
151     "xo-therm-adc"
152 };
153 
154 static struct target_therm_cfg sensor_cfg_sdmmagpie[] = {
155     {
156         .type = DEVICE_TEMPERATURE_CPU,
157         .sensor_list = cpu_sensors_sdmmagpie,
158         .sens_cnt = ARRAY_SIZE(cpu_sensors_sdmmagpie),
159         .mult = 0.001,
160     },
161     {
162         .type = DEVICE_TEMPERATURE_GPU,
163         .sensor_list = &misc_sensors_sdmmagpie[0],
164         .sens_cnt = 1,
165         .mult = 0.001,
166         .label = "GPU",
167     },
168     {
169         .type = DEVICE_TEMPERATURE_BATTERY,
170         .sensor_list = &misc_sensors_sdmmagpie[1],
171         .sens_cnt = 1,
172         .mult = 0.001,
173         .label = "battery",
174     },
175     {
176         .type = DEVICE_TEMPERATURE_SKIN,
177         .sensor_list = &misc_sensors_sdmmagpie[2],
178         .sens_cnt = 1,
179         .mult = 0.001,
180         .label = "skin",
181     }
182 };
183 
184 static char *misc_sensors_lito[] =
185 {
186     "gpuss-0-usr",
187     "battery",
188     "xo-therm-usr"
189 };
190 
191 static struct target_therm_cfg sensor_cfg_lito[] = {
192     {
193         .type = DEVICE_TEMPERATURE_CPU,
194         .sensor_list = cpu_sensors_sdmmagpie,
195         .sens_cnt = ARRAY_SIZE(cpu_sensors_sdmmagpie),
196         .mult = 0.001,
197     },
198     {
199         .type = DEVICE_TEMPERATURE_GPU,
200         .sensor_list = &misc_sensors_lito[0],
201         .sens_cnt = 1,
202         .mult = 0.001,
203         .label = "GPU",
204     },
205     {
206         .type = DEVICE_TEMPERATURE_BATTERY,
207         .sensor_list = &misc_sensors_lito[1],
208         .sens_cnt = 1,
209         .mult = 0.001,
210         .label = "battery",
211     },
212     {
213         .type = DEVICE_TEMPERATURE_SKIN,
214         .sensor_list = &misc_sensors_lito[2],
215         .sens_cnt = 1,
216         .mult = 0.001,
217         .label = "skin",
218     }
219 };
220 
221 static char *cpu_sensors_trinket[] =
222 {
223     "cpuss-0-usr",
224     "cpuss-0-usr",
225     "cpuss-0-usr",
226     "cpuss-0-usr",
227     "cpu-1-0-usr",
228     "cpu-1-1-usr",
229     "cpu-1-2-usr",
230     "cpu-1-3-usr",
231 };
232 
233 static char *misc_sensors_trinket[] =
234 {
235     "gpu-usr",
236     "battery",
237     "xo-therm-adc"
238 };
239 
240 static struct target_therm_cfg sensor_cfg_trinket[] = {
241     {
242         .type = DEVICE_TEMPERATURE_CPU,
243         .sensor_list = cpu_sensors_trinket,
244         .sens_cnt = ARRAY_SIZE(cpu_sensors_trinket),
245         .mult = 0.001,
246     },
247     {
248         .type = DEVICE_TEMPERATURE_GPU,
249         .sensor_list = &misc_sensors_trinket[0],
250         .sens_cnt = 1,
251         .mult = 0.001,
252         .label = "GPU",
253     },
254     {
255         .type = DEVICE_TEMPERATURE_BATTERY,
256         .sensor_list = &misc_sensors_trinket[1],
257         .sens_cnt = 1,
258         .mult = 0.001,
259         .label = "battery",
260     },
261     {
262         .type = DEVICE_TEMPERATURE_SKIN,
263         .sensor_list = &misc_sensors_trinket[2],
264         .sens_cnt = 1,
265         .mult = 0.001,
266         .label = "skin",
267     }
268 };
269 
270 static char *cpu_sensors_msmnile[] =
271 {
272     "cpu-0-0-usr",
273     "cpu-0-1-usr",
274     "cpu-0-2-usr",
275     "cpu-0-3-usr",
276     "cpu-1-0-usr",
277     "cpu-1-1-usr",
278     "cpu-1-2-usr",
279     "cpu-1-3-usr",
280 };
281 
282 static char *misc_sensors_msmnile[] =
283 {
284     "gpuss-0-usr",
285     "battery",
286     "xo-therm"
287 };
288 
289 static struct target_therm_cfg sensor_cfg_msmnile[] = {
290     {
291         .type = DEVICE_TEMPERATURE_CPU,
292         .sensor_list = cpu_sensors_msmnile,
293         .sens_cnt = ARRAY_SIZE(cpu_sensors_msmnile),
294         .mult = 0.001,
295     },
296     {
297         .type = DEVICE_TEMPERATURE_GPU,
298         .sensor_list = &misc_sensors_msmnile[0],
299         .sens_cnt = 1,
300         .mult = 0.001,
301         .label = "GPU",
302     },
303     {
304         .type = DEVICE_TEMPERATURE_BATTERY,
305         .sensor_list = &misc_sensors_msmnile[1],
306         .sens_cnt = 1,
307         .mult = 0.001,
308         .label = "battery",
309     },
310     {
311         .type = DEVICE_TEMPERATURE_SKIN,
312         .sensor_list = &misc_sensors_msmnile[2],
313         .sens_cnt = 1,
314         .mult = 0.001,
315         .label = "skin",
316     }
317 };
318 
319 static char *cpu_sensors_660[] =
320 {
321     "tsens_tz_sensor1",
322     "tsens_tz_sensor1",
323     "tsens_tz_sensor1",
324     "tsens_tz_sensor1",
325     "tsens_tz_sensor3",
326     "tsens_tz_sensor4",
327     "tsens_tz_sensor5",
328     "tsens_tz_sensor6",
329 };
330 
331 static char *misc_sensors_660[] =
332 {
333     "tsens_tz_sensor8",
334     "battery",
335     "xo_therm"
336 };
337 
338 static struct target_therm_cfg sensor_cfg_660[] = {
339     {
340         .type = DEVICE_TEMPERATURE_CPU,
341         .sensor_list = cpu_sensors_660,
342         .sens_cnt = ARRAY_SIZE(cpu_sensors_660),
343         .mult = 0.1,
344     },
345     {
346         .type = DEVICE_TEMPERATURE_GPU,
347         .sensor_list = &misc_sensors_660[0],
348         .sens_cnt = 1,
349         .mult = 0.1,
350         .label = "GPU",
351     },
352     {
353         .type = DEVICE_TEMPERATURE_BATTERY,
354         .sensor_list = &misc_sensors_660[1],
355         .sens_cnt = 1,
356         .mult = 0.001,
357         .label = "battery",
358     },
359     {
360         .type = DEVICE_TEMPERATURE_SKIN,
361         .sensor_list = &misc_sensors_660[2],
362         .sens_cnt = 1,
363         .mult = 1,
364         .label = "skin",
365     }
366 };
367 
368 static char *cpu_sensors_630[] =
369 {
370     "tsens_tz_sensor3",
371     "tsens_tz_sensor4",
372     "tsens_tz_sensor5",
373     "tsens_tz_sensor6",
374     "tsens_tz_sensor7",
375     "tsens_tz_sensor7",
376     "tsens_tz_sensor7",
377     "tsens_tz_sensor7",
378 };
379 
380 static struct target_therm_cfg sensor_cfg_630[] = {
381     {
382         .type = DEVICE_TEMPERATURE_CPU,
383         .sensor_list = cpu_sensors_630,
384         .sens_cnt = ARRAY_SIZE(cpu_sensors_630),
385         .mult = 0.1,
386     },
387     {
388         .type = DEVICE_TEMPERATURE_GPU,
389         .sensor_list = &misc_sensors_660[0],
390         .sens_cnt = 1,
391         .mult = 0.1,
392         .label = "GPU",
393     },
394     {
395         .type = DEVICE_TEMPERATURE_BATTERY,
396         .sensor_list = &misc_sensors_660[1],
397         .sens_cnt = 1,
398         .mult = 0.001,
399         .label = "battery",
400     },
401     {
402         .type = DEVICE_TEMPERATURE_SKIN,
403         .sensor_list = &misc_sensors_660[2],
404         .sens_cnt = 1,
405         .mult = 1,
406         .label = "skin",
407     }
408 };
409 
410 static char *cpu_sensors_8953[] =
411 {
412     "tsens_tz_sensor9",
413     "tsens_tz_sensor10",
414     "tsens_tz_sensor11",
415     "tsens_tz_sensor12",
416     "tsens_tz_sensor4",
417     "tsens_tz_sensor5",
418     "tsens_tz_sensor6",
419     "tsens_tz_sensor7",
420 };
421 
422 static char *misc_sensors_8953[] =
423 {
424     "tsens_tz_sensor15",
425     "battery",
426     "xo_therm"
427 };
428 
429 static struct target_therm_cfg sensor_cfg_8953[] = {
430     {
431         .type = DEVICE_TEMPERATURE_CPU,
432         .sensor_list = cpu_sensors_8953,
433         .sens_cnt = ARRAY_SIZE(cpu_sensors_8953),
434         .mult = 0.1,
435     },
436     {
437         .type = DEVICE_TEMPERATURE_GPU,
438         .sensor_list = &misc_sensors_8953[0],
439         .sens_cnt = 1,
440         .mult = 0.1,
441         .label = "GPU",
442     },
443     {
444         .type = DEVICE_TEMPERATURE_BATTERY,
445         .sensor_list = &misc_sensors_8953[1],
446         .sens_cnt = 1,
447         .mult = 0.001,
448         .label = "battery",
449     },
450     {
451         .type = DEVICE_TEMPERATURE_SKIN,
452         .sensor_list = &misc_sensors_8953[2],
453         .sens_cnt = 1,
454         .mult = 1,
455         .label = "skin",
456     }
457 };
458 
459 
460 static char *cpu_sensors_710[] =
461 {
462     "cpu0-silver-usr",
463     "cpu1-silver-usr",
464     "cpu2-silver-usr",
465     "cpu3-silver-usr",
466     "cpu4-silver-usr",
467     "cpu5-silver-usr",
468     "cpu0-gold-usr",
469     "cpu1-gold-usr",
470 };
471 
472 static char *misc_sensors_710[] =
473 {
474     "gpu0-usr",
475     "battery",
476     "xo-therm-adc"
477 };
478 
479 static struct target_therm_cfg sensor_cfg_710[] = {
480     {
481         .type = DEVICE_TEMPERATURE_CPU,
482         .sensor_list = cpu_sensors_710,
483         .sens_cnt = ARRAY_SIZE(cpu_sensors_710),
484         .mult = 0.001,
485     },
486     {
487         .type = DEVICE_TEMPERATURE_GPU,
488         .sensor_list = &misc_sensors_710[0],
489         .sens_cnt = 1,
490         .mult = 0.001,
491         .label = "GPU",
492     },
493     {
494         .type = DEVICE_TEMPERATURE_BATTERY,
495         .sensor_list = &misc_sensors_710[1],
496         .sens_cnt = 1,
497         .mult = 0.001,
498         .label = "battery",
499     },
500     {
501         .type = DEVICE_TEMPERATURE_SKIN,
502         .sensor_list = &misc_sensors_710[2],
503         .sens_cnt = 1,
504         .mult = 0.001,
505         .label = "skin",
506     }
507 };
508 
509 static char *cpu_sensors_632[] =
510 {
511     "cpuss0-usr",
512     "cpuss0-usr",
513     "cpuss0-usr",
514     "cpuss0-usr",
515     "apc1-cpu0-usr",
516     "apc1-cpu1-usr",
517     "apc1-cpu2-usr",
518     "apc1-cpu3-usr",
519 };
520 
521 static char *misc_sensors_632[] =
522 {
523     "gpu0-usr",
524     "battery",
525     "quiet-therm-adc"
526 };
527 
528 static struct target_therm_cfg sensor_cfg_632[] = {
529     {
530         .type = DEVICE_TEMPERATURE_CPU,
531         .sensor_list = cpu_sensors_632,
532         .sens_cnt = ARRAY_SIZE(cpu_sensors_632),
533         .mult = 0.001,
534     },
535     {
536         .type = DEVICE_TEMPERATURE_GPU,
537         .sensor_list = &misc_sensors_632[0],
538         .sens_cnt = 1,
539         .mult = 0.001,
540         .label = "GPU",
541     },
542     {
543         .type = DEVICE_TEMPERATURE_BATTERY,
544         .sensor_list = &misc_sensors_632[1],
545         .sens_cnt = 1,
546         .mult = 0.001,
547         .label = "battery",
548     },
549     {
550         .type = DEVICE_TEMPERATURE_SKIN,
551         .sensor_list = &misc_sensors_632[2],
552         .sens_cnt = 1,
553         .mult = 0.001,
554         .label = "skin",
555     }
556 };
557 
558 static char *cpu_sensors_439[] =
559 {
560     "apc1-cpu0-usr",
561     "apc1-cpu1-usr",
562     "apc1-cpu2-usr",
563     "apc1-cpu3-usr",
564     "cpuss0-usr",
565     "cpuss0-usr",
566     "cpuss0-usr",
567     "cpuss0-usr",
568 };
569 
570 static char *misc_sensors_439[] =
571 {
572     "gpu-usr",
573     "battery",
574     "quiet-therm-adc"
575 };
576 
577 static struct target_therm_cfg sensor_cfg_439[] = {
578     {
579         .type = DEVICE_TEMPERATURE_CPU,
580         .sensor_list = cpu_sensors_439,
581         .sens_cnt = ARRAY_SIZE(cpu_sensors_439),
582         .mult = 0.001,
583     },
584     {
585         .type = DEVICE_TEMPERATURE_GPU,
586         .sensor_list = &misc_sensors_439[0],
587         .sens_cnt = 1,
588         .mult = 0.001,
589         .label = "GPU",
590     },
591     {
592         .type = DEVICE_TEMPERATURE_BATTERY,
593         .sensor_list = &misc_sensors_439[1],
594         .sens_cnt = 1,
595         .mult = 0.001,
596         .label = "battery",
597     },
598     {
599         .type = DEVICE_TEMPERATURE_SKIN,
600         .sensor_list = &misc_sensors_439[2],
601         .sens_cnt = 1,
602         .mult = 0.001,
603         .label = "skin",
604     }
605 };
606 
607 static char *cpu_sensors_8917[] =
608 {
609     "apc1-cpu0-usr",
610     "apc1-cpu1-usr",
611     "apc1-cpu2-usr",
612     "apc1-cpu3-usr",
613 };
614 
615 static char *misc_sensors_8917[] =
616 {
617     "gpu0-usr",
618     "battery",
619     "xo-therm-adc"
620 };
621 
622 static struct target_therm_cfg sensor_cfg_8917[] = {
623     {
624         .type = DEVICE_TEMPERATURE_CPU,
625         .sensor_list = cpu_sensors_8917,
626         .sens_cnt = ARRAY_SIZE(cpu_sensors_8917),
627         .mult = 0.001,
628     },
629     {
630         .type = DEVICE_TEMPERATURE_GPU,
631         .sensor_list = &misc_sensors_8917[0],
632         .sens_cnt = 1,
633         .mult = 0.001,
634         .label = "GPU",
635     },
636     {
637         .type = DEVICE_TEMPERATURE_BATTERY,
638         .sensor_list = &misc_sensors_8917[1],
639         .sens_cnt = 1,
640         .mult = 0.001,
641         .label = "battery",
642     },
643     {
644         .type = DEVICE_TEMPERATURE_SKIN,
645         .sensor_list = &misc_sensors_8917[2],
646         .sens_cnt = 1,
647         .mult = 0.001,
648         .label = "skin",
649     }
650 };
651 
get_soc_info(char * buf)652 static int get_soc_info(char *buf)
653 {
654     int ret = 0;
655 
656     ret = read_line_from_file(SYSFS_PLATFORMID, buf, SOC_INFO_NAME_LEN);
657     if (ret < 0) {
658         ALOGE("Error getting platform_id %d", ret);
659         return ret;
660     }
661     if (ret && buf[ret - 1] == '\n')
662         buf[ret - 1] = '\0';
663 
664     return ret;
665 }
666 
therm_get_soc_id(void)667 enum therm_msm_id therm_get_soc_id(void)
668 {
669     static enum therm_msm_id msm_id;
670     int soc_id = -1;
671 
672     if (!msm_id) {
673         int idx;
674         char buf[SOC_INFO_NAME_LEN];
675 
676         if (get_soc_info(buf) <= 0)
677             return msm_id;
678 
679         soc_id = atoi(buf);
680         for (idx = 0; idx < ARRAY_SIZE(msm_soc_table); idx++) {
681             if (soc_id == msm_soc_table[idx].soc_id) {
682                 msm_id = msm_soc_table[idx].msm_id;
683                 break;
684             }
685         }
686         if (!msm_id)
687             ALOGE("Unknown target identified with soc id %d\n", soc_id);
688    }
689 
690    return msm_id;
691 }
692 
get_temperatures(thermal_module_t * module,temperature_t * list,size_t size)693 ssize_t get_temperatures(thermal_module_t *module, temperature_t *list, size_t size) {
694     ALOGD("Entering %s",__func__);
695     static int thermal_sens_size;
696 
697     if (!thermal_sens_size) {
698 	struct target_therm_cfg *cfg = NULL;
699         size_t num_cfg = 0;
700 
701         switch (therm_get_soc_id()) {
702             case THERM_MSM_8953:
703                 cfg = sensor_cfg_8953;
704                 num_cfg = ARRAY_SIZE(sensor_cfg_8953);
705                 break;
706             case THERM_SDM_660:
707                 cfg = sensor_cfg_660;
708                 num_cfg = ARRAY_SIZE(sensor_cfg_660);
709                 break;
710             case THERM_SDM_630:
711                 cfg = sensor_cfg_630;
712                 num_cfg = ARRAY_SIZE(sensor_cfg_630);
713                 break;
714             case THERM_SDM_710:
715             case THERM_QCS_605:
716                 cfg = sensor_cfg_710;
717                 num_cfg = ARRAY_SIZE(sensor_cfg_710);
718                 break;
719             case THERM_SDM_632:
720                 cfg = sensor_cfg_632;
721                 num_cfg = ARRAY_SIZE(sensor_cfg_632);
722                 break;
723             case THERM_SDM_439:
724                 cfg = sensor_cfg_439;
725                 num_cfg = ARRAY_SIZE(sensor_cfg_439);
726                 break;
727             case THERM_MSM_8917:
728                 cfg = sensor_cfg_8917;
729                 num_cfg = ARRAY_SIZE(sensor_cfg_8917);
730                 break;
731             case THERM_MSMNILE:
732             case THERM_KONA:
733                 cfg = sensor_cfg_msmnile;
734                 num_cfg = ARRAY_SIZE(sensor_cfg_msmnile);
735                 break;
736             case THERM_TALOS:
737                 cfg = sensor_cfg_talos;
738                 num_cfg = ARRAY_SIZE(sensor_cfg_talos);
739                 break;
740             case THERM_SDMMAGPIE:
741                 cfg = sensor_cfg_sdmmagpie;
742                 num_cfg = ARRAY_SIZE(sensor_cfg_sdmmagpie);
743                 break;
744             case THERM_TRINKET:
745                 cfg = sensor_cfg_trinket;
746                 num_cfg = ARRAY_SIZE(sensor_cfg_trinket);
747                 break;
748             case THERM_LITO:
749             case THERM_ATOLL:
750                 cfg = sensor_cfg_lito;
751                 num_cfg = ARRAY_SIZE(sensor_cfg_lito);
752                 break;
753             default:
754                 cfg = NULL;
755                 num_cfg = 0;
756                 break;
757 	}
758 	if (cfg == NULL || num_cfg == 0) {
759             ALOGE("No target specific sensor config\n");
760             return 0;
761 	}
762 	thermal_sens_size = thermal_zone_init(cfg, num_cfg);
763 	if (thermal_sens_size <= 0) {
764             ALOGE("thermal sensor initialization is failed\n");
765             thermal_sens_size = 0;
766 	    return 0;
767         }
768     }
769 
770     if (list == NULL)
771         return thermal_sens_size;
772 
773     return get_temperature_for_all(list, size);
774 }
775