power: smb1398: Handle USB power path suspension appropriately

Unsuspend USB power path (turn off USB-path front-porch FET) before
enabling, and suspend it upon disabling SMB1398.

Change-Id: I319c215861f82cb2fb96504c38993c6eb03c38a7
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
This commit is contained in:
Guru Das Srinagesh 2021-01-12 12:37:41 -08:00
commit 084fe9ff3c

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "SMB1398: %s: " fmt, __func__
@ -724,6 +724,14 @@ static int smb1398_div2_cp_switcher_en(struct smb1398_chip *chip, bool en)
{
int rc;
rc = smb1398_masked_write(chip, MISC_USB_WLS_SUSPEND_REG,
USB_SUSPEND, en ? 0 : USB_SUSPEND);
if (rc < 0) {
dev_err(chip->dev, "Couldn't write USB_WLS_SUSPEND_REG, rc=%d\n",
rc);
return rc;
}
rc = smb1398_masked_write(chip, MISC_SL_SWITCH_EN_REG,
EN_SWITCHER, en ? EN_SWITCHER : 0);
if (rc < 0) {