static void __protect_flags_update(struct battery_type *battery, struct protect_flags_type *flags) { /* Flags: is_charging_enable_available - Over temperature, need to stop charging is_charging_high_current_avaialble - Temperature is too high so that we have to slow charge*/ if (is_over_temp(battery)) { /* Ex: T<0 or T>45 */ flags->is_charging_enable_available = FALSE; flags->is_charging_high_current_avaialble = FALSE; #if 0 flags->is_battery_overtemp = TRUE; #endif } else if (is_not_over_temp(battery)) { /* Ex: T<42 or T>3*/ flags->is_charging_enable_available = TRUE; flags->is_charging_high_current_avaialble = TRUE; #if 0 flags->is_battery_overtemp = FALSE; #endif } /* Flags: is_battery_dead - If battery is dead, show special indicator for it*/ if (battery->voltage_mV < BATTERY_DEAD_VOLTAGE_LEVEL) { flags->is_battery_dead = TRUE; } else if (battery->voltage_mV > BATTERY_DEAD_VOLTAGE_RELEASE) { flags->is_battery_dead = FALSE; } }
static void __protect_flags_update(struct battery_type *battery, struct protect_flags_type *flags) { if( NULL != flags->func_update_charging_protect_flag) { int pstate = flags->func_update_charging_protect_flag( battery->current_mA, battery->voltage_mV, battery->temp_01c, &(flags->is_charging_enable_available), &(flags->is_charging_high_current_avaialble), &(flags->is_temperature_fault)); if (flags->is_fake_room_temp) { flags->is_charging_enable_available = TRUE; flags->is_charging_high_current_avaialble = TRUE; } printk(DRIVER_ZONE "batt: protect pState=%d,allow(chg,hchg)=(%d,%d)\n", pstate, flags->is_charging_enable_available, flags->is_charging_high_current_avaialble); } else { if (is_over_temp(battery)) { flags->is_charging_enable_available = FALSE; flags->is_charging_high_current_avaialble = FALSE; #if 0 flags->is_battery_overtemp = TRUE; #endif } else if (is_not_over_temp(battery)) { flags->is_charging_enable_available = TRUE; flags->is_charging_high_current_avaialble = TRUE; #if 0 flags->is_battery_overtemp = FALSE; #endif } } if (battery->voltage_mV < BATTERY_DEAD_VOLTAGE_LEVEL) { flags->is_battery_dead = TRUE; } else if (battery->voltage_mV > BATTERY_DEAD_VOLTAGE_RELEASE) { flags->is_battery_dead = FALSE; } }
static void __protect_flags_update(struct battery_type *battery, struct protect_flags_type *flags) { /* Flags: is_charging_enable_available - Over temperature, need to stop charging is_charging_high_current_avaialble - Temperature is too high so that we have to slow charge*/ if( NULL != flags->func_update_charging_protect_flag) { int pstate = flags->func_update_charging_protect_flag( battery->current_mA, battery->voltage_mV, battery->temp_01c, &(flags->is_charging_enable_available), &(flags->is_charging_high_current_avaialble)); printk(DRIVER_ZONE "batt: protect pState=%d,allow(chg,hchg)=(%d,%d)\n", pstate, flags->is_charging_enable_available, flags->is_charging_high_current_avaialble); } else { if (is_over_temp(battery)) { /* Ex: T<0 or T>45 */ flags->is_charging_enable_available = FALSE; flags->is_charging_high_current_avaialble = FALSE; #if 0 flags->is_battery_overtemp = TRUE; #endif } else if (is_not_over_temp(battery)) { /* Ex: T<42 or T>3*/ flags->is_charging_enable_available = TRUE; flags->is_charging_high_current_avaialble = TRUE; #if 0 flags->is_battery_overtemp = FALSE; #endif } } /* Flags: is_battery_dead - If battery is dead, show special indicator for it*/ if (battery->voltage_mV < battery->dead_voltage_mV) flags->is_battery_dead = TRUE; else flags->is_battery_dead = FALSE; }
static void __protect_flags_update(struct battery_type *battery, struct protect_flags_type *flags) { /* Flags: is_charging_enable_available - Over temperature, need to stop charging is_charging_high_current_avaialble - Temperature is too high so that we have to slow charge*/ if( NULL != flags->func_update_charging_protect_flag) { flags->func_update_charging_protect_flag( battery->current_mA, battery->voltage_mV, battery->temp_01c, &(flags->is_charging_enable_available), &(flags->is_charging_high_current_avaialble), &(flags->is_temperature_fault)); } else { if (is_over_temp(battery)) { /* Ex: T<0 or T>45 */ flags->is_charging_enable_available = FALSE; flags->is_charging_high_current_avaialble = FALSE; flags->is_temperature_fault = TRUE; } else if (is_not_over_temp(battery)) { /* Ex: T<42 or T>3*/ flags->is_charging_enable_available = TRUE; flags->is_charging_high_current_avaialble = TRUE; flags->is_temperature_fault = FALSE; } } /* Flags: is_battery_dead - If battery is dead, show special indicator for it*/ if (battery->voltage_mV < battery->dead_voltage_mV) flags->is_battery_dead = TRUE; else flags->is_battery_dead = FALSE; }