From 4075caf8b5b6ef82a331a9af130db833944a0f7d Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Thu, 14 Mar 2024 09:55:16 +0800 Subject: [PATCH] usb: typec: tcpm: husb311: fix resume reset condition Since the BMCIO_OSC_EN bit is enabled automatically when the interrupt occur whether the power is off or on, replace to TCPC_FILTER reg that amended by software in husb311_init. Fixes: f414167ae09b ("usb: typec: husb311: pm process support") Signed-off-by: Frank Wang Change-Id: I5bd0ffa395aae1e007705a791ff03a77ec85034a --- drivers/usb/typec/tcpm/tcpci_husb311.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpci_husb311.c b/drivers/usb/typec/tcpm/tcpci_husb311.c index eb314c111bfa..7b44a2367da6 100644 --- a/drivers/usb/typec/tcpm/tcpci_husb311.c +++ b/drivers/usb/typec/tcpm/tcpci_husb311.c @@ -237,15 +237,18 @@ static int husb311_pm_resume(struct device *dev) { struct husb311_chip *chip = dev->driver_data; int ret = 0; - u8 pwr; + u8 filter; /* * When the power of husb311 is lost or i2c read failed in PM S/R * process, we must reset the tcpm port first to ensure the devices * can attach again. + * + * The TCPC_FILTER we amended its value to 0x0F in husb311_init, so if + * husb311 powered off in suspend, the value would reset to default. */ - ret = husb311_read8(chip, HUSB311_TCPC_POWER, &pwr); - if (pwr & BIT(0) || ret < 0) { + ret = husb311_read8(chip, HUSB311_TCPC_FILTER, &filter); + if (filter != 0x0F || ret < 0) { ret = husb311_sw_reset(chip); if (ret < 0) { dev_err(chip->dev, "fail to soft reset, ret = %d\n", ret);