static int tsallts_get_temp(struct thermal_zone_device *thermal, unsigned long *t) { #if MTK_ALLTS_SW_FILTER == 1 int curr_temp; int temp_temp; int ret = 0; static int last_abb_read_temp; curr_temp = get_immediate_ts2_wrap(); tsallts_dprintk("tsallts_get_temp CPU ts2 =%d\n", curr_temp); /* abnormal high temp */ if ((curr_temp > (trip_temp[0] - 15000)) || (curr_temp < -30000) || (curr_temp > 85000)) tsallts_printk("ts2 =%d\n", curr_temp); temp_temp = curr_temp; if (curr_temp != 0) {/* not the first temp read after resume from suspension */ if ((curr_temp > 150000) || (curr_temp < -20000)) { /* invalid range */ tsallts_printk("ts2 temp invalid=%d\n", curr_temp); temp_temp = 50000; ret = -1; } else if (last_abb_read_temp != 0) { /* delta 20C, invalid change */ if ((curr_temp - last_abb_read_temp > 20000) || (last_abb_read_temp - curr_temp > 20000)) { tsallts_printk("ts2 temp float hugely temp=%d, lasttemp=%d\n", curr_temp, last_abb_read_temp); temp_temp = 50000; ret = -1; } } } last_abb_read_temp = curr_temp; curr_temp = temp_temp; *t = (unsigned long)curr_temp; return ret; #else int curr_temp; curr_temp = get_immediate_ts2_wrap(); tsallts_dprintk("tsallts_get_temp ts2 =%d\n", curr_temp); if ((curr_temp > (trip_temp[0] - 15000)) || (curr_temp < -30000)) tsallts_printk("ts2 =%d\n", curr_temp); *t = curr_temp; return 0; #endif }
static int tsallts_get_ts2_temp(void) { int t_ret = 0; t_ret = get_immediate_ts2_wrap(); tsallts_dprintk("[tsallts_get_ts2_temp] TS2 =%d\n", t_ret); return t_ret; }