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

Commit ae036af8 authored by Stefan Christ's avatar Stefan Christ Committed by Alexandre Belloni
Browse files

rtc: m41t80: add suspend handlers for alarm IRQ



Allow the alarm IRQ of RTC to be used as a wakeup source for the system
suspend.

Signed-off-by: default avatarStefan Christ <s.christ@phytec.de>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent e89487fe
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -335,6 +335,30 @@ static struct rtc_class_ops m41t80_rtc_ops = {
	.proc = m41t80_rtc_proc,
	.proc = m41t80_rtc_proc,
};
};


#ifdef CONFIG_PM_SLEEP
static int m41t80_suspend(struct device *dev)
{
	struct i2c_client *client = to_i2c_client(dev);

	if (client->irq >= 0 && device_may_wakeup(dev))
		enable_irq_wake(client->irq);

	return 0;
}

static int m41t80_resume(struct device *dev)
{
	struct i2c_client *client = to_i2c_client(dev);

	if (client->irq >= 0 && device_may_wakeup(dev))
		disable_irq_wake(client->irq);

	return 0;
}
#endif

static SIMPLE_DEV_PM_OPS(m41t80_pm, m41t80_suspend, m41t80_resume);

static ssize_t flags_show(struct device *dev,
static ssize_t flags_show(struct device *dev,
			  struct device_attribute *attr, char *buf)
			  struct device_attribute *attr, char *buf)
{
{
@@ -870,6 +894,7 @@ static int m41t80_remove(struct i2c_client *client)
static struct i2c_driver m41t80_driver = {
static struct i2c_driver m41t80_driver = {
	.driver = {
	.driver = {
		.name = "rtc-m41t80",
		.name = "rtc-m41t80",
		.pm = &m41t80_pm,
	},
	},
	.probe = m41t80_probe,
	.probe = m41t80_probe,
	.remove = m41t80_remove,
	.remove = m41t80_remove,