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

Commit 22a02d85 authored by Harry Yang's avatar Harry Yang
Browse files

power: smb1390: optimize conditions to enable charger



Currently, SMB1390 always attempts to turn on switcher while a
Type-C source is attached, which can be of any charger type.
However, SMB1390 only works with QC3 and PPS adaptors.

Improve it, by only enabling switcher when SMB1390 SMB_EN pin
is pulled up for QC3 or PPS.

Change-Id: I79acb00c7299fdfad8eefb63f71fc6dc4573b45d
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parent b8900bc7
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -409,18 +409,13 @@ static void smb1390_status_change_work(struct work_struct *work)
		goto out;

	rc = power_supply_get_property(chip->usb_psy,
			POWER_SUPPLY_PROP_TYPEC_MODE, &pval);
			POWER_SUPPLY_PROP_SMB_EN_MODE, &pval);
	if (rc < 0) {
		pr_err("Couldn't get usb present rc=%d\n", rc);
		goto out;
	}

	if (pval.intval != POWER_SUPPLY_TYPEC_SOURCE_DEFAULT
			&& pval.intval != POWER_SUPPLY_TYPEC_SOURCE_MEDIUM
			&& pval.intval != POWER_SUPPLY_TYPEC_SOURCE_HIGH) {
		vote(chip->disable_votable, USB_VOTER, true, 0);
		vote(chip->fcc_votable, CP_VOTER, false, 0);
	} else {
	if (pval.intval == POWER_SUPPLY_CHARGER_SEC_CP) {
		vote(chip->disable_votable, USB_VOTER, false, 0);

		/*
@@ -463,6 +458,9 @@ static void smb1390_status_change_work(struct work_struct *work)
					   &chip->taper_work);
			}
		}
	} else {
		vote(chip->disable_votable, USB_VOTER, true, 0);
		vote(chip->fcc_votable, CP_VOTER, false, 0);
	}

out: