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

Commit 803dd89d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb1390: Fix taper condition for VPH configuration"

parents cad5c55d 0413d928
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -204,10 +204,10 @@ struct smb1390 {
	int			cp_isns_slave;
	int			cp_ilim;
	int			die_temp;
	int			min_ilim_ua;
	bool			suspended;
	bool			disabled;
	u32			debug_mask;
	u32			min_ilim_ua;
	u32			max_temp_alarm_degc;
	u32			max_cutoff_soc;
	u32			pl_output_mode;
@@ -1244,7 +1244,7 @@ static void smb1390_taper_work(struct work_struct *work)
{
	struct smb1390 *chip = container_of(work, struct smb1390, taper_work);
	union power_supply_propval pval = {0, };
	int rc, fcc_uA, delta_fcc_uA, main_fcc_ua = 0;
	int rc, fcc_uA, delta_fcc_uA, main_fcc_ua = 0, fcc_cp_ua;

	if (!is_psy_voter_available(chip))
		goto out;
@@ -1294,7 +1294,21 @@ static void smb1390_taper_work(struct work_struct *work)
				goto out;
			}

			if ((fcc_uA - main_fcc_ua) < (chip->min_ilim_ua * 2)) {
			/*
			 * fcc and fcc_main are the same for VPH config, hence
			 * reduce fcc_main from fcc only in VBAT (output config)
			 * where fcc_main is a portion of full-fcc.
			 */
			fcc_cp_ua = fcc_uA;
			if (chip->pl_output_mode == POWER_SUPPLY_PL_OUTPUT_VBAT)
				fcc_cp_ua = fcc_uA - main_fcc_ua;

			smb1390_dbg(chip, PR_INFO,
				"Taper: fcc_ua=%d fcc_cp_ua=%d fcc_main_ua=%d min_ilim_ua(x2) = %u\n",
				fcc_uA, fcc_cp_ua, main_fcc_ua,
				(chip->min_ilim_ua*2));

			if (fcc_cp_ua < (chip->min_ilim_ua * 2)) {
				vote(chip->disable_votable, TAPER_END_VOTER,
								true, 0);
				/*