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

Commit 26fafd7e authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-smbcharger: adjust the float voltage of parallel charger



Currently, when the float voltage of the main charger is
modified through voltage_max property, float voltage of the
parallel charger is not being adjusted accordingly. Add support
to adjust the float voltage of parallel charger as well.

CRs-Fixed: 782125
Change-Id: Id99838551f32409876d025f03e00b6d04883627a
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 8bcee50a
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -1712,7 +1712,7 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip)
	struct power_supply *parallel_psy = get_parallel_psy(chip);
	union power_supply_propval pval = {0, };
	int current_limit_ma, parallel_cl_ma, total_current_ma;
	int new_parallel_cl_ma, min_current_thr_ma;
	int new_parallel_cl_ma, min_current_thr_ma, rc;

	if (!parallel_psy)
		return;
@@ -1777,6 +1777,12 @@ static void smbchg_parallel_usb_enable(struct smbchg_chip *chip)

	taper_irq_en(chip, true);
	chip->parallel.current_max_ma = new_parallel_cl_ma;
	rc = power_supply_set_voltage_limit(parallel_psy, chip->vfloat_mv + 50);
	if (rc) {
		dev_err(chip->dev, "Couldn't set float voltage on parallel psy rc: %d\n",
			rc);
		goto disable_parallel;
	}
	power_supply_set_present(parallel_psy, true);
	smbchg_set_fastchg_current(chip, chip->target_fastchg_current_ma / 2);
	pval.intval = chip->target_fastchg_current_ma * 1000 / 2;
@@ -2332,6 +2338,7 @@ static int smbchg_float_voltage_comp_set(struct smbchg_chip *chip, int code)
#define VHIGH_RANGE_FLOAT_STEP_MV	20
static int smbchg_float_voltage_set(struct smbchg_chip *chip, int vfloat_mv)
{
	struct power_supply *parallel_psy = get_parallel_psy(chip);
	int rc, delta;
	u8 temp;

@@ -2361,6 +2368,14 @@ static int smbchg_float_voltage_set(struct smbchg_chip *chip, int vfloat_mv)
		vfloat_mv -= delta % VHIGH_RANGE_FLOAT_STEP_MV;
	}

	if (parallel_psy) {
		rc = power_supply_set_voltage_limit(parallel_psy,
				vfloat_mv + 50);
		if (rc)
			dev_err(chip->dev, "Couldn't set float voltage on parallel psy rc: %d\n",
				rc);
	}

	rc = smbchg_sec_masked_write(chip, chip->chgr_base + VFLOAT_CFG_REG,
			VFLOAT_MASK, temp);