Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a6b0e5a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: net: can: Add suspend/resume routine for CAN driver"

parents aca3bbe3 5fd72dd9
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -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
@@ -920,11 +921,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,