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

Commit 8afedfc7 authored by Ashay Jaiswal's avatar Ashay Jaiswal Committed by Harry Yang
Browse files

qcom: battery: fix parallel psy name



Parallel charger registers to power supply framework with name
"parallel" instead of "usb-parallel" thus update all references
of "usb-parallel" with "parallel".
While at it, remove extra NULL pointer check of pl_psy in
parallel enable path.

CRs-Fixed: 2001651
Change-Id: I4150808f7122cef970296553fb70671df12aced9
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 03f7d455
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ enum {
static void split_settled(struct pl_data *chip)
{
	int slave_icl_pct;
	int slave_ua;
	int slave_ua = 0;
	union power_supply_propval pval = {0, };
	int rc;

@@ -94,11 +94,9 @@ static void split_settled(struct pl_data *chip)
	if (chip->pl_mode != POWER_SUPPLY_PARALLEL_USBIN_USBIN)
		return;

	if (chip->main_psy)
	if (!chip->main_psy)
		return;

	slave_ua = 0;

	if (!get_effective_result_locked(chip->pl_disable_votable)) {
		/* read the aicl settled value */
		rc = power_supply_get_property(chip->main_psy,
@@ -375,15 +373,17 @@ static int pl_disable_vote_callback(struct votable *votable,
	if (!pl_disable) { /* enable */
		rerun_election(chip->fv_votable);
		rerun_election(chip->fcc_votable);

		if (chip->pl_psy) {
		/*
		 * Enable will be called with a valid pl_psy always. The
		 * PARALLEL_PSY_VOTER keeps it disabled unless a pl_psy
		 * is seen.
		 */
		pval.intval = 0;
		rc = power_supply_set_property(chip->pl_psy,
				POWER_SUPPLY_PROP_INPUT_SUSPEND, &pval);
		if (rc < 0)
			pr_err("Couldn't change slave suspend state rc=%d\n",
				rc);
		}

		if (chip->pl_mode == POWER_SUPPLY_PARALLEL_USBIN_USBIN)
			split_settled(chip);
@@ -406,6 +406,7 @@ static int pl_disable_vote_callback(struct votable *votable,
		if (chip->pl_mode == POWER_SUPPLY_PARALLEL_USBIN_USBIN)
			split_settled(chip);

		/* pl_psy may be NULL while in the disable branch */
		if (chip->pl_psy) {
			pval.intval = 1;
			rc = power_supply_set_property(chip->pl_psy,
+2 −3
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ static int smblib_notifier_call(struct notifier_block *nb,
			schedule_work(&chg->bms_update_work);
	}

	if (!chg->pl.psy && !strcmp(psy->desc->name, "usb-parallel"))
	if (!chg->pl.psy && !strcmp(psy->desc->name, "parallel"))
		chg->pl.psy = psy;

	return NOTIFY_OK;
@@ -3570,8 +3570,7 @@ int smblib_init(struct smb_charger *chg)
		}

		chg->bms_psy = power_supply_get_by_name("bms");
		chg->pl.psy = power_supply_get_by_name("usb-parallel");

		chg->pl.psy = power_supply_get_by_name("parallel");
		break;
	case PARALLEL_SLAVE:
		break;