static int amlogic_get_temp(struct thermal_zone_device *thermal, unsigned long *temp) { #if 0 if(aa>=100) trend=1; else if (aa<=40) trend=0; if(trend) aa=aa-5; else aa=aa+5; //get_random_bytes(&aa,4); printk("======== temp=%d\n",aa); *temp=aa; #else #ifdef CONFIG_AML_VIRTUAL_THERMAL if (trim_flag) { *temp = (unsigned long)get_cpu_temp(); } else if (virtual_thermal_en) { *temp = aml_cal_virtual_temp(); } else { *temp = 45; // fix cpu temperature to 45 if not trimed && disable virtual thermal } #else *temp = (unsigned long)get_cpu_temp(); pr_debug( "======== temp=%ld\n",*temp); #endif #endif return 0; }
/* Get temperature callback functions for thermal zone */ static int amlogic_get_temp(struct thermal_zone_device *thermal, unsigned long *temp) { struct amlogic_thermal_platform_data *pdata = thermal->devdata; int tmp; if (pdata->trim_flag) { tmp = get_cpu_temp(); if (tmp < MIN_TEMP) { pdata->temp_valid = 0; return -EINVAL; } pdata->temp_valid = 1; *temp = (unsigned long)get_cpu_temp(); pdata->current_temp = *temp; } else if (pdata->virtual_thermal_en) { *temp = aml_cal_virtual_temp(pdata); } else { *temp = 45; // fix cpu temperature to 45 if not trimed && disable virtual thermal } return 0; }