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: Chunmei Cai <ccai@codeaurora.org>
This commit is contained in:
Chunmei Cai 2016-01-25 14:29:56 +08:00 committed by David Keitel
parent 467ced45c8
commit 98433ecb46

View file

@ -326,6 +326,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 {
@ -4402,6 +4403,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)
@ -4639,6 +4641,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));
}