mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
usb: typec: tcpci_husb311: Support to enable wakeup irq via dts
The husb311 driver disable irq wakeup if vbus is on
(e.g connect with an U Disk), it aimed to avoid wakeup
system from deep sleep immediately by husb311 irq if
the vbus was powered off during deep sleep.
However, some platforms can keep vbus on during deep
sleep, and it may want to support the husb311 irq to
wakeup system from deep sleep, so this patch adds an
option property "wakeup-source" for this scenario.
Fixes: a6a4762e0c ("usb: typec: tcpci_husb311: Refactor irq wakeup")
Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: I3a862b3b3e99fe12c4dbb87e09a0910b4602b92a
This commit is contained in:
@@ -36,6 +36,7 @@ struct husb311_chip {
|
||||
bool vbus_on;
|
||||
bool charge_on;
|
||||
bool suspended;
|
||||
bool wakeup;
|
||||
};
|
||||
|
||||
static int husb311_read8(struct husb311_chip *chip, unsigned int reg, u8 *val)
|
||||
@@ -295,6 +296,7 @@ static int husb311_probe(struct i2c_client *client,
|
||||
return ret;
|
||||
}
|
||||
|
||||
chip->wakeup = device_property_read_bool(chip->dev, "wakeup-source");
|
||||
device_init_wakeup(chip->dev, true);
|
||||
|
||||
return 0;
|
||||
@@ -324,7 +326,7 @@ static int husb311_pm_suspend(struct device *dev)
|
||||
struct husb311_chip *chip = dev->driver_data;
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
|
||||
if (device_may_wakeup(dev) && !chip->vbus_on)
|
||||
if (device_may_wakeup(dev) && (!chip->vbus_on || chip->wakeup))
|
||||
enable_irq_wake(client->irq);
|
||||
else
|
||||
disable_irq(client->irq);
|
||||
@@ -344,7 +346,7 @@ static int husb311_pm_resume(struct device *dev)
|
||||
int ret = 0;
|
||||
u8 filter;
|
||||
|
||||
if (device_may_wakeup(dev) && !chip->vbus_on)
|
||||
if (device_may_wakeup(dev) && (!chip->vbus_on || chip->wakeup))
|
||||
disable_irq_wake(client->irq);
|
||||
else
|
||||
enable_irq(client->irq);
|
||||
|
||||
Reference in New Issue
Block a user