power: pm8921: consideration of ibat max overwrite

The thermal mitigation and battery temp control can overwrite
the ibat max value each other. So this patch remove the possibility
of overwrite ibat max value by mitigation and battery temp control.

Change-Id: Ib0f7bf2b8bd2e474d1d9c76bd5100b05310cb048
This commit is contained in:
choongryeol.lee
2012-08-25 00:15:42 -07:00
committed by Iliyan Malchev
parent 58a482fbef
commit 4e4f4dabfd
2 changed files with 15 additions and 4 deletions

View File

@@ -283,6 +283,7 @@ struct pm8921_chg_chip {
bool host_mode;
u8 active_path;
int recent_reported_soc;
unsigned int ext_warm_i_limit;
int ext_batt_health;
int ext_batt_temp_monitor;
};
@@ -1823,6 +1824,11 @@ int pm8921_set_max_battery_charge_current(int ma)
pr_err("called before init\n");
return -EINVAL;
}
if (thermal_mitigation != 0 && the_chip->thermal_mitigation)
ma = min((unsigned int)ma,
the_chip->thermal_mitigation[thermal_mitigation]);
return pm_chg_ibatmax_set(the_chip, ma);
}
EXPORT_SYMBOL(pm8921_set_max_battery_charge_current);
@@ -1990,16 +1996,18 @@ int set_wireless_power_supply_control(int value)
EXPORT_SYMBOL(set_wireless_power_supply_control);
#endif
int pm8921_set_ext_battery_health(int health)
int pm8921_set_ext_battery_health(int health, int i_limit)
{
if (!the_chip) {
pr_err("called before init\n");
return -EINVAL;
}
the_chip->ext_batt_health = health;
the_chip->ext_batt_health = health;
the_chip->ext_warm_i_limit = i_limit;
pr_debug("health = %d\n", the_chip->ext_batt_health);
pr_debug("health = %d i_decrease = %d\n", the_chip->ext_batt_health,
the_chip->ext_warm_i_limit);
return 0;
}
EXPORT_SYMBOL(pm8921_set_ext_battery_health);
@@ -3252,6 +3260,9 @@ static void set_appropriate_battery_current(struct pm8921_chg_chip *chip)
if (chip->is_bat_warm)
chg_current = min(chg_current, chip->warm_bat_chg_current);
if (chip->ext_warm_i_limit && chip->ext_batt_temp_monitor)
chg_current = min(chg_current, chip->ext_warm_i_limit);
if (thermal_mitigation != 0 && chip->thermal_mitigation)
chg_current = min(chg_current,
chip->thermal_mitigation[thermal_mitigation]);

View File

@@ -295,7 +295,7 @@ int pm8921_is_batfet_closed(void);
int set_wireless_power_supply_control(int value);
#endif
int pm8921_set_ext_battery_health(int health);
int pm8921_set_ext_battery_health(int health, int i_limit);
#else
static inline void pm8921_charger_vbus_draw(unsigned int mA)