From 5e320d031053926575166b169ea3c1f28daa2e69 Mon Sep 17 00:00:00 2001 From: Jake Wu Date: Tue, 14 May 2024 15:58:41 +0800 Subject: [PATCH] usb: typec: husb311: set vbus off when shutdown vbus-on will trigger pmic restart when system shutdown. Signed-off-by: Jake Wu Change-Id: I49a610f6a24c6d0ffc33a5bef7dc909f738f1f12 --- drivers/usb/typec/tcpm/tcpci_husb311.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpci_husb311.c b/drivers/usb/typec/tcpm/tcpci_husb311.c index e9f3942afc10..574588e419f5 100644 --- a/drivers/usb/typec/tcpm/tcpci_husb311.c +++ b/drivers/usb/typec/tcpm/tcpci_husb311.c @@ -309,6 +309,16 @@ static void husb311_remove(struct i2c_client *client) tcpci_unregister_port(chip->tcpci); } +static void husb311_shutdown(struct i2c_client *client) +{ + struct husb311_chip *chip = i2c_get_clientdata(client); + + husb311_set_vbus(chip->tcpci, &chip->data, false, false); + + cancel_delayed_work_sync(&chip->pm_work); + tcpci_unregister_port(chip->tcpci); +} + static int husb311_pm_suspend(struct device *dev) { struct husb311_chip *chip = dev->driver_data; @@ -388,6 +398,7 @@ static struct i2c_driver husb311_i2c_driver = { }, .probe = husb311_probe, .remove = husb311_remove, + .shutdown = husb311_shutdown, .id_table = husb311_id, }; module_i2c_driver(husb311_i2c_driver);