Re: [PATCH 4/8] usb: typec: fusb302: switch to devm_pm_set_wake_irq

From: Heikki Krogerus

Date: Tue Nov 17 2026 - 08:21:05 EST


On Fri, Nov 13, 2026 at 05:42:40PM +0100, Sebastian Reichel wrote:
> Use the modern device managed wake IRQ helper provided by the PM layer
> instead of directly calling the interrupt wake enable/disable functions.
>
> This results in the wake capability only being enabled once system suspend
> is entered as its not supposed to be set while the system is running
> normally. Also it now properly reacts to device_may_wakeup().
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>

Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

> ---
> drivers/usb/typec/tcpm/fusb302.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index a7a1dce6cf86..8b83414c5819 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -19,6 +19,7 @@
> #include <linux/mutex.h>
> #include <linux/of.h>
> #include <linux/pinctrl/consumer.h>
> +#include <linux/pm_wakeirq.h>
> #include <linux/proc_fs.h>
> #include <linux/regulator/consumer.h>
> #include <linux/sched/clock.h>
> @@ -1804,16 +1805,11 @@ static int fusb302_probe(struct i2c_client *client)
> if (ret)
> return ret;
>
> - enable_irq_wake(chip->gpio_int_n_irq);
> -
> - return ret;
> -}
> -
> -static void fusb302_remove(struct i2c_client *client)
> -{
> - struct fusb302_chip *chip = i2c_get_clientdata(client);
> + ret = devm_device_init_wakeup(chip->dev);
> + if (ret)
> + return ret;
>
> - disable_irq_wake(chip->gpio_int_n_irq);
> + return devm_pm_set_wake_irq(chip->dev, chip->gpio_int_n_irq);
> }
>
> static int fusb302_pm_suspend(struct device *dev)
> @@ -1870,7 +1866,6 @@ static struct i2c_driver fusb302_driver = {
> .of_match_table = of_match_ptr(fusb302_dt_match),
> },
> .probe = fusb302_probe,
> - .remove = fusb302_remove,
> .id_table = fusb302_i2c_device_id,
> };
> module_i2c_driver(fusb302_driver);
>
> --
> 2.53.0
>

--
heikki