diff options
author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-12-15 14:14:32 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-12-15 14:14:32 -0800 |
commit | 6897701011333753a6bd1e71488d245ed919a44a (patch) | |
tree | c9744ec31b1f14e0c0eeda0c279ef84cb6d039f1 /drivers/net/can | |
parent | 75bce4cd0b61317153c4da070bd59723de262596 (diff) | |
parent | ec7744ab8c609e87cc936894fba200f8fe831449 (diff) |
Merge "drivers: net: can: Add suspend/resume routine for CAN driver"
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/spi/k61.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/can/spi/k61.c b/drivers/net/can/spi/k61.c index 9ce0ad854caa..84c13a1c04a5 100644 --- a/drivers/net/can/spi/k61.c +++ b/drivers/net/can/spi/k61.c @@ -23,6 +23,7 @@ #include <linux/of_device.h> #include <linux/of_gpio.h> #include <linux/uaccess.h> +#include <linux/pm.h> #define DEBUG_K61 0 #if DEBUG_K61 == 1 @@ -921,11 +922,39 @@ static const struct of_device_id k61_match_table[] = { { } }; +#ifdef CONFIG_PM +static int k61_suspend(struct device *dev) +{ + struct spi_device *spi = to_spi_device(dev); + + enable_irq_wake(spi->irq); + return 0; +} + +static int k61_resume(struct device *dev) +{ + struct spi_device *spi = to_spi_device(dev); + struct k61_can *priv_data = spi_get_drvdata(spi); + + disable_irq_wake(spi->irq); + k61_rx_message(priv_data); + return 0; +} + +static const struct dev_pm_ops k61_dev_pm_ops = { + .suspend = k61_suspend, + .resume = k61_resume, +}; +#endif + static struct spi_driver k61_driver = { .driver = { .name = "k61", .of_match_table = k61_match_table, .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &k61_dev_pm_ops, +#endif }, .probe = k61_probe, .remove = k61_remove, |