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

Commit b5e31cbe authored by Chunmei Cai's avatar Chunmei Cai Committed by Gerrit - the friendly Code Review server
Browse files

power: qpnp-smbcharger: Hold wake lock for HVDCP detection



If insert HVDCP charger when device in sleep, kernel wakes up by the
interrupt and after DCP being detected, there is a chance that kernel
going to sleep again and hvdcp_det_work won't be run. This causes the
HVDCP detection failure and stay at 5V to be acting as normal DCP.
Hold a wake lock before schedule the hvdcp_det_work, and release the
wakelock after it being detected.

CRs-Fixed: 966430
Change-Id: I7ca503a5656ab9031d409079421a24710f2996e6
Signed-off-by: default avatarChunmei Cai <ccai@codeaurora.org>
parent b535d63d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -322,6 +322,7 @@ enum wake_reason {
	PM_REASON_VFLOAT_ADJUST = BIT(1),
	PM_ESR_PULSE = BIT(2),
	PM_PARALLEL_TAPER = BIT(3),
	PM_DETECT_HVDCP = BIT(4),
};

enum fcc_voters {
@@ -4449,6 +4450,7 @@ static void smbchg_hvdcp_det_work(struct work_struct *work)
			power_supply_changed(&chip->batt_psy);
		smbchg_aicl_deglitch_wa_check(chip);
	}
	smbchg_relax(chip, PM_DETECT_HVDCP);
}

static int set_usb_psy_dp_dm(struct smbchg_chip *chip, int state)
@@ -4670,6 +4672,7 @@ static void handle_usb_insertion(struct smbchg_chip *chip)
	if (!chip->hvdcp_not_supported &&
			(usb_supply_type == POWER_SUPPLY_TYPE_USB_DCP)) {
		cancel_delayed_work_sync(&chip->hvdcp_det_work);
		smbchg_stay_awake(chip, PM_DETECT_HVDCP);
		schedule_delayed_work(&chip->hvdcp_det_work,
					msecs_to_jiffies(HVDCP_NOTIFY_MS));
	}