Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e117705 authored by yangfangbiao's avatar yangfangbiao Committed by hecaiqiang
Browse files

Optimize temperature region charge termination current

Change-Id: I3dc7cbc4433fe666e66d989cbec47402775a44a0
parent 87e9f62d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -362,6 +362,7 @@
	ibatmax-cool-thr-ma = <1000>;
	ibatmax-cool-ma = <1450>;
	ibatmax-warm-ma = <1050>;
	op,little_cold_term_current = <250>;
};

&mtp_batterydata {
+4 −0
Original line number Diff line number Diff line
@@ -483,6 +483,10 @@ static int smb5_parse_dt(struct smb5 *chip)
		chg->sw_iterm_ma = 150;
	pr_info("sw_iterm_ma=%d,check_batt_full_by_sw=%d",
				chg->sw_iterm_ma, chg->check_batt_full_by_sw);
	rc = of_property_read_u32(node,
					"op,little_cold_term_current",
					&chg->little_cold_iterm_ma);
	pr_info("little_cold_iterm_ma=%d", chg->little_cold_iterm_ma);
/*yangfb@bsp, 20171023 otg-icl set 1A if battery lower than 15%*/
	chg->OTG_ICL_CTRL = of_property_read_bool(node,
						"op,otg-icl-ctrl-enable");
+7 −1
Original line number Diff line number Diff line
@@ -7745,6 +7745,7 @@ static bool op_check_vbat_is_full_by_sw(struct smb_charger *chg)
	static int vbat_counts_hw;
	int vbatt_full_vol_sw;
	int vbatt_full_vol_hw;
	int term_current;
	int tbatt_status, icharging, batt_volt;

	if (!chg->check_batt_full_by_sw)
@@ -7780,12 +7781,17 @@ static bool op_check_vbat_is_full_by_sw(struct smb_charger *chg)
		ret_hw = 0;
		return false;
	}
	if (chg->little_cold_iterm_ma > 0
		&& (tbatt_status == BATT_TEMP_LITTLE_COLD))
		term_current = chg->little_cold_iterm_ma;
	else
		term_current =  chg->sw_iterm_ma;

	batt_volt = get_prop_batt_voltage_now(chg) / 1000;
	icharging = get_prop_batt_current_now(chg) / 1000;
	/* use SW Vfloat to check */
	if (batt_volt > vbatt_full_vol_sw) {
		if (icharging < 0 && (icharging * -1) <= chg->sw_iterm_ma) {
		if (icharging < 0 && (icharging * -1) <= term_current) {
			vbat_counts_sw++;
			if (vbat_counts_sw > FULL_COUNTS_SW) {
				vbat_counts_sw = 0;
+1 −0
Original line number Diff line number Diff line
@@ -562,6 +562,7 @@ struct smb_charger {
	int			default_icl_ua;
	int			otg_cl_ua;
	int			sw_iterm_ma;
	int			little_cold_iterm_ma;
	bool			check_batt_full_by_sw;
	bool			OTG_ICL_CTRL;
	int			OTG_LOW_BAT;