From ab23ab8211ca5e51184ee9420e0771a5f65d01d5 Mon Sep 17 00:00:00 2001 From: Nicholas Troast Date: Fri, 28 Oct 2016 11:02:03 -0700 Subject: [PATCH] qpnp-smb2: force HVDCP to 5V before reboot When the MSM resets the USB data lines are pulled low. If an HVDCP adapter is attached and operating at >5V, and the phone reboots then the HVDCP adapter will be in a bad state and the USB input will be suspended. Fix this by forcing the HVDCP adapter to 5V in the shutdown path. Change-Id: I953d42418f90398bd4248f8b761cf63943ce5532 Signed-off-by: Nicholas Troast --- drivers/power/qcom-charger/qpnp-smb2.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c index f9d76c56aa2e..17d77b7ed873 100644 --- a/drivers/power/qcom-charger/qpnp-smb2.c +++ b/drivers/power/qcom-charger/qpnp-smb2.c @@ -1746,6 +1746,16 @@ static int smb2_remove(struct platform_device *pdev) return 0; } +static void smb2_shutdown(struct platform_device *pdev) +{ + struct smb2 *chip = platform_get_drvdata(pdev); + struct smb_charger *chg = &chip->chg; + + smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, + HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT, 0); + smblib_write(chg, CMD_HVDCP_2_REG, FORCE_5V_BIT); +} + static const struct of_device_id match_table[] = { { .compatible = "qcom,qpnp-smb2", }, { }, @@ -1759,6 +1769,7 @@ static struct platform_driver smb2_driver = { }, .probe = smb2_probe, .remove = smb2_remove, + .shutdown = smb2_shutdown, }; module_platform_driver(smb2_driver);