Linux RTC
 help / color / mirror / Atom feed
* [rtc-linux] [PATCH 1/2] rtc: m41t80: make it a real error message
@ 2016-07-05 11:53 Stefan Christ
  2016-07-05 11:53 ` [rtc-linux] [PATCH 2/2] rtc: m41t80: add suspend handlers for alarm IRQ Stefan Christ
  2016-07-25 20:30 ` [rtc-linux] Re: [PATCH 1/2] rtc: m41t80: make it a real error message Alexandre Belloni
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Christ @ 2016-07-05 11:53 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni, rtc-linux

It should be a real error message, when the driver cannot enable the IRQ
of the device.

Signed-off-by: Stefan Christ <s.christ@phytec.de>
---
 drivers/rtc/rtc-m41t80.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index d1bf93a..04e8577 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -244,7 +244,7 @@ static int m41t80_alarm_irq_enable(struct device *dev, unsigned int enabled)
 
 	retval = i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_MON, flags);
 	if (retval < 0) {
-		dev_info(dev, "Unable to enable alarm IRQ %d\n", retval);
+		dev_err(dev, "Unable to enable alarm IRQ %d\n", retval);
 		return retval;
 	}
 	return 0;
-- 
1.9.1

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [rtc-linux] [PATCH 2/2] rtc: m41t80: add suspend handlers for alarm IRQ
  2016-07-05 11:53 [rtc-linux] [PATCH 1/2] rtc: m41t80: make it a real error message Stefan Christ
@ 2016-07-05 11:53 ` Stefan Christ
  2016-07-25 20:30   ` [rtc-linux] " Alexandre Belloni
  2016-07-25 20:30 ` [rtc-linux] Re: [PATCH 1/2] rtc: m41t80: make it a real error message Alexandre Belloni
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Christ @ 2016-07-05 11:53 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni, rtc-linux

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

Signed-off-by: Stefan Christ <s.christ@phytec.de>
---
 drivers/rtc/rtc-m41t80.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 04e8577..4f09089 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -337,6 +337,30 @@ static struct rtc_class_ops m41t80_rtc_ops = {
 	.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,
 			  struct device_attribute *attr, char *buf)
 {
@@ -873,6 +897,7 @@ static int m41t80_remove(struct i2c_client *client)
 static struct i2c_driver m41t80_driver = {
 	.driver = {
 		.name = "rtc-m41t80",
+		.pm = &m41t80_pm,
 	},
 	.probe = m41t80_probe,
 	.remove = m41t80_remove,
-- 
1.9.1

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [rtc-linux] Re: [PATCH 1/2] rtc: m41t80: make it a real error message
  2016-07-05 11:53 [rtc-linux] [PATCH 1/2] rtc: m41t80: make it a real error message Stefan Christ
  2016-07-05 11:53 ` [rtc-linux] [PATCH 2/2] rtc: m41t80: add suspend handlers for alarm IRQ Stefan Christ
@ 2016-07-25 20:30 ` Alexandre Belloni
  1 sibling, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2016-07-25 20:30 UTC (permalink / raw)
  To: Stefan Christ; +Cc: a.zummo, rtc-linux

On 05/07/2016 at 13:53:16 +0200, Stefan Christ wrote :
> It should be a real error message, when the driver cannot enable the IRQ
> of the device.
> 
> Signed-off-by: Stefan Christ <s.christ@phytec.de>
> ---
>  drivers/rtc/rtc-m41t80.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [rtc-linux] Re: [PATCH 2/2] rtc: m41t80: add suspend handlers for alarm IRQ
  2016-07-05 11:53 ` [rtc-linux] [PATCH 2/2] rtc: m41t80: add suspend handlers for alarm IRQ Stefan Christ
@ 2016-07-25 20:30   ` Alexandre Belloni
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2016-07-25 20:30 UTC (permalink / raw)
  To: Stefan Christ; +Cc: a.zummo, rtc-linux

On 05/07/2016 at 13:53:17 +0200, Stefan Christ wrote :
> Allow the alarm IRQ of RTC to be used as a wakeup source for the system
> suspend.
> 
> Signed-off-by: Stefan Christ <s.christ@phytec.de>
> ---
>  drivers/rtc/rtc-m41t80.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-25 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-05 11:53 [rtc-linux] [PATCH 1/2] rtc: m41t80: make it a real error message Stefan Christ
2016-07-05 11:53 ` [rtc-linux] [PATCH 2/2] rtc: m41t80: add suspend handlers for alarm IRQ Stefan Christ
2016-07-25 20:30   ` [rtc-linux] " Alexandre Belloni
2016-07-25 20:30 ` [rtc-linux] Re: [PATCH 1/2] rtc: m41t80: make it a real error message Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox