Ejemplo n.º 1
0
static int mtktsabb_get_temp(struct thermal_zone_device *thermal,
			       unsigned long *t)
{
#if MTK_TS_ABB_SW_FILTER == 1
	int curr_temp;
	int temp_temp;
	int ret = 0;
	static int last_abb_read_temp = 0;
	curr_temp = mtktsabb_get_hw_temp();
	mtktsabb_dprintk("mtktsabb_get_temp CPU T2=%d\n", curr_temp);

	if ((curr_temp > (trip_temp[0] - 15000)) || (curr_temp < -30000)) // abnormal high temp
		printk("[Power/ABB_Thermal] ABB T=%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
		{
			printk("[Power/ABB_Thermal] ABB temp invalid=%d\n", curr_temp); 
			temp_temp = 50000;
			ret = -1;
		}
		else if (last_abb_read_temp != 0)
		{
			if ((curr_temp - last_abb_read_temp > 20000) ||(last_abb_read_temp - curr_temp > 20000)) //delta 20C, invalid change
			{
				 printk("[Power/ABB_Thermal] ABB 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 = mtktsabb_get_hw_temp();
	mtktsabb_dprintk(" mtktsabb_get_temp CPU T2=%d\n", curr_temp);
	if ((curr_temp > (trip_temp[0] - 15000)) || (curr_temp < -30000))
		printk("[Power/ABB_Thermal] ABB T=%d\n", curr_temp);
	*t  = curr_temp;
	return 0;
#endif
}
static int mtktsabb_get_temp(struct thermal_zone_device *thermal,
			       unsigned long *t)
{
//	int curr_temp;
    *t  = mtktsabb_get_hw_temp();

    mtktsabb_dprintk(" mtktsabb_get_temp  CPU T2=%d\n",*t );
	return 0;
}
Ejemplo n.º 3
0
static int mtktsabb_get_temp(struct thermal_zone_device *thermal,
			       unsigned long *t)
{
    *t = mtktsabb_get_hw_temp();
		return 0;
}