Ver Mensaje Individual
  #2  
Viejo 13/09/15, 18:14:16
Avatar de Simeneuro
Simeneuro Simeneuro no está en línea
Usuario poco activo
Mensajes: 44
 
Fecha de registro: mar 2014
Localización: Canarias
Mensajes: 44
Modelo de smartphone: Note 2 GT-N7100 / Note Edge SM-N915FY / S7 Edge
Versión de ROM: OmniROM Lollipop / Touchwiz 5.0.1
Tu operador: Yoigo
Mencionado: 1 comentarios
Tagged: 0 hilos
Por si le pasa a alguien mas, hay que parchear esto:

static int sec_bat_check_temper(struct sec_bat_info *info)
{
struct power_supply *psy
= power_supply_get_by_name(info->fuel_gauge_name);
union power_supply_propval value;
int ret;

int temp;
int temp_adc = s3c_read_temper_adc(info);
int health = info->batt_health;
int low = 0;
int high = 0;
int mid = 0;

calculate_average_adc(info, &info->temper_adc_sample, temp_adc);

if (!info->adc_table || !info->adc_arr_size) {
/* using fake temp *
temp = 300;
info->batt_temp = temp;
return temp;
}
high = info->adc_arr_size - 1;

while (low <= high) {
mid = (low + high) / 2;
if (info->adc_table[mid].adc > temp_adc)
high = mid - 1;
else if (info->adc_table[mid].adc < temp_adc)
low = mid + 1;
else
break;
}
temp = info->adc_table[mid].temperature;

info->batt_temp = temp;

if (temp >= HIGH_BLOCK_TEMP) {
if (health != POWER_SUPPLY_HEALTH_OVERHEAT &&
health != POWER_SUPPLY_HEALTH_UNSPEC_FAILURE)
if (info->batt_temp_high_cnt < TEMP_BLOCK_COUNT)
info->batt_temp_high_cnt++;
dev_info(info->dev, "%s: high count = %d\n",
__func__, info->batt_temp_high_cnt);
} else if (temp <= HIGH_RECOVER_TEMP && temp >= LOW_RECOVER_TEMP) {
if (health == POWER_SUPPLY_HEALTH_OVERHEAT ||
health == POWER_SUPPLY_HEALTH_COLD)
if (info->batt_temp_recover_cnt < TEMP_BLOCK_COUNT)
info->batt_temp_recover_cnt++;
dev_info(info->dev, "%s: recovery count = %d\n",
__func__, info->batt_temp_recover_cnt);
} else if (temp <= LOW_BLOCK_TEMP) {
if (health != POWER_SUPPLY_HEALTH_COLD &&
health != POWER_SUPPLY_HEALTH_UNSPEC_FAILURE)
if (info->batt_temp_low_cnt < TEMP_BLOCK_COUNT)
info->batt_temp_low_cnt++;
dev_info(info->dev, "%s: low count = %d\n",
__func__, info->batt_temp_low_cnt);
} else {
info->batt_temp_high_cnt = 0;
info->batt_temp_low_cnt = 0;
info->batt_temp_recover_cnt = 0;
}

if (info->batt_temp_high_cnt >= TEMP_BLOCK_COUNT)
info->batt_health = POWER_SUPPLY_HEALTH_OVERHEAT;
else if (info->batt_temp_low_cnt >= TEMP_BLOCK_COUNT)
info->batt_health = POWER_SUPPLY_HEALTH_COLD;
else if (info->batt_temp_recover_cnt >= TEMP_BLOCK_COUNT)
info->batt_health = POWER_SUPPLY_HEALTH_GOOD;

/* Set temperature to fuel gauge *
if (info->fuel_gauge_name) {
value.intval = info->batt_temp / 10;
ret = psy->set_property(psy, POWER_SUPPLY_PROP_TEMP, &value);
if (ret) {
dev_err(info->dev, "%s: fail to set temperature(%d)\n",
__func__, ret);
}
}

dev_info(info->dev, "%s: temp=%d, adc=%d\n", __func__, temp, temp_adc);

return temp;
}
Responder Con Cita