rtc: rtc-ds1307: enable support for mcp794xx as a wakeup source without IRQ

Message ID 20170328182204.4fda934e@pixelzero
State Superseded
Headers show

Commit Message

David Lowe March 28, 2017, 5:22 p.m.
This patch extends the fixes for ds1337, ds1339, ds3231 in 8bc2a40730ec
to mcp794xx devices, so that those parts can similarly be used as a wakeup
source without an IRQ to the processor.

Tested on Raspberry Pi ZeroW with MCP79400.

Signed-off-by: David Lowe <dave-lowe@ntlworld.com>
---

Comments

Alexandre Belloni April 22, 2017, 3:54 p.m. | #1
Hi,

On 28/03/2017 at 18:22:04 +0100, David Lowe wrote:
> This patch extends the fixes for ds1337, ds1339, ds3231 in 8bc2a40730ec
> to mcp794xx devices, so that those parts can similarly be used as a wakeup
> source without an IRQ to the processor.
> 
> Tested on Raspberry Pi ZeroW with MCP79400.
> 
> Signed-off-by: David Lowe <dave-lowe@ntlworld.com>
> ---
> --- a/drivers/rtc/rtc-ds1307.c	2017-03-28 16:16:38.158076224 +0100
> +++ b/drivers/rtc/rtc-ds1307.c	2017-03-28 16:16:52.248431799 +0100
> @@ -1487,7 +1487,8 @@ static int ds1307_probe(struct i2c_clien
>  		break;
>  	case mcp794xx:
>  		rtc_ops = &mcp794xx_rtc_ops;
> -		if (ds1307->client->irq > 0 && chip->alarm) {
> +		if (chip->alarm && (ds1307->client->irq > 0 ||
> +
> ds1307_can_wakeup_device)) { irq_handler = mcp794xx_irq;

This seems right but your mailer as mangled the patch. Can you resend?

>  			want_irq = true;
>  		}

Patch

--- a/drivers/rtc/rtc-ds1307.c	2017-03-28 16:16:38.158076224 +0100
+++ b/drivers/rtc/rtc-ds1307.c	2017-03-28 16:16:52.248431799 +0100
@@ -1487,7 +1487,8 @@  static int ds1307_probe(struct i2c_clien
 		break;
 	case mcp794xx:
 		rtc_ops = &mcp794xx_rtc_ops;
-		if (ds1307->client->irq > 0 && chip->alarm) {
+		if (chip->alarm && (ds1307->client->irq > 0 ||
+
ds1307_can_wakeup_device)) { irq_handler = mcp794xx_irq;
 			want_irq = true;
 		}