* [PATCH] rtc: pl031: enable rtc alarm interrupt again
@ 2020-08-13 11:14 ` Amit Singh Tomar
0 siblings, 0 replies; 6+ messages in thread
From: Amit Singh Tomar @ 2020-08-13 11:14 UTC (permalink / raw)
To: andre.przywara, linus.walleij, alexandre.belloni
Cc: linux-arm-kernel, linux-rtc, Amit Singh Tomar
After commit c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/
rtc_tm_to_time64"), it has been observed the rtc alarm interrupt is
no more registered, and due to this waking up the system
(using rtc alarm interrupt) from suspend state is no longer possible.
Besides this, we get broken output from "hwclock".
root@localhost:~# hwclock
hwclock: select() to /dev/rtc to wait for clock tick timed out: No such file or directory
This is due to the fact that call to pl031_alarm_irq_enable(dev, alarm->enabled)
is removed (from pl031_set_alarm()) in commit c8ff5841a90b, and alarm interrupt
never gets enabled.
This commit fixes it by re-introduces the missing
pl031_alarm_irq_enable(dev, alarm->enabled).
Fixes: c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/rtc_tm_to_time64")
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
---
This patch is tested on QEMU ARM64 TCG guest
Without this patch:
root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
39: 0 0 GICv2 34 Level rtc-pl031
With this patch:
root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
39: 1 0 GICv2 34 Level rtc-pl031
root@localhost:~# hwclock
Thu Aug 13 11:00:06 2020 -1.009351 seconds
root@localhost:~# echo +30 > /sys/class/rtc/rtc0/wakealarm
root@localhost:~# echo -n mem > /sys/power/state
root@localhost:~# hwclock -r
Thu Aug 13 08:59:14 2020 -1.010357 seconds
---
drivers/rtc/rtc-pl031.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 40d7450a1ce4..c6b89273feba 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -275,6 +275,7 @@ static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
struct pl031_local *ldata = dev_get_drvdata(dev);
writel(rtc_tm_to_time64(&alarm->time), ldata->base + RTC_MR);
+ pl031_alarm_irq_enable(dev, alarm->enabled);
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] rtc: pl031: enable rtc alarm interrupt again
@ 2020-08-13 11:14 ` Amit Singh Tomar
0 siblings, 0 replies; 6+ messages in thread
From: Amit Singh Tomar @ 2020-08-13 11:14 UTC (permalink / raw)
To: andre.przywara, linus.walleij, alexandre.belloni
Cc: linux-rtc, linux-arm-kernel, Amit Singh Tomar
After commit c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/
rtc_tm_to_time64"), it has been observed the rtc alarm interrupt is
no more registered, and due to this waking up the system
(using rtc alarm interrupt) from suspend state is no longer possible.
Besides this, we get broken output from "hwclock".
root@localhost:~# hwclock
hwclock: select() to /dev/rtc to wait for clock tick timed out: No such file or directory
This is due to the fact that call to pl031_alarm_irq_enable(dev, alarm->enabled)
is removed (from pl031_set_alarm()) in commit c8ff5841a90b, and alarm interrupt
never gets enabled.
This commit fixes it by re-introduces the missing
pl031_alarm_irq_enable(dev, alarm->enabled).
Fixes: c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/rtc_tm_to_time64")
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
---
This patch is tested on QEMU ARM64 TCG guest
Without this patch:
root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
39: 0 0 GICv2 34 Level rtc-pl031
With this patch:
root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
39: 1 0 GICv2 34 Level rtc-pl031
root@localhost:~# hwclock
Thu Aug 13 11:00:06 2020 -1.009351 seconds
root@localhost:~# echo +30 > /sys/class/rtc/rtc0/wakealarm
root@localhost:~# echo -n mem > /sys/power/state
root@localhost:~# hwclock -r
Thu Aug 13 08:59:14 2020 -1.010357 seconds
---
drivers/rtc/rtc-pl031.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 40d7450a1ce4..c6b89273feba 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -275,6 +275,7 @@ static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
struct pl031_local *ldata = dev_get_drvdata(dev);
writel(rtc_tm_to_time64(&alarm->time), ldata->base + RTC_MR);
+ pl031_alarm_irq_enable(dev, alarm->enabled);
return 0;
}
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc: pl031: enable rtc alarm interrupt again
2020-08-13 11:14 ` Amit Singh Tomar
@ 2020-08-13 11:39 ` Alexandre Belloni
-1 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2020-08-13 11:39 UTC (permalink / raw)
To: Amit Singh Tomar
Cc: andre.przywara, linus.walleij, linux-arm-kernel, linux-rtc
Hi,
Thank you for your patch. However, this is already fixed upstream:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/rtc?id=4df2ef85f0efe44505f511ca5e4455585f53a2da
On 13/08/2020 16:44:28+0530, Amit Singh Tomar wrote:
> After commit c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/
> rtc_tm_to_time64"), it has been observed the rtc alarm interrupt is
> no more registered, and due to this waking up the system
> (using rtc alarm interrupt) from suspend state is no longer possible.
>
> Besides this, we get broken output from "hwclock".
>
> root@localhost:~# hwclock
> hwclock: select() to /dev/rtc to wait for clock tick timed out: No such file or directory
>
> This is due to the fact that call to pl031_alarm_irq_enable(dev, alarm->enabled)
> is removed (from pl031_set_alarm()) in commit c8ff5841a90b, and alarm interrupt
> never gets enabled.
>
> This commit fixes it by re-introduces the missing
> pl031_alarm_irq_enable(dev, alarm->enabled).
>
> Fixes: c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/rtc_tm_to_time64")
>
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
> ---
> This patch is tested on QEMU ARM64 TCG guest
>
> Without this patch:
> root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
> 39: 0 0 GICv2 34 Level rtc-pl031
>
> With this patch:
> root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
> 39: 1 0 GICv2 34 Level rtc-pl031
>
> root@localhost:~# hwclock
> Thu Aug 13 11:00:06 2020 -1.009351 seconds
>
> root@localhost:~# echo +30 > /sys/class/rtc/rtc0/wakealarm
> root@localhost:~# echo -n mem > /sys/power/state
> root@localhost:~# hwclock -r
> Thu Aug 13 08:59:14 2020 -1.010357 seconds
>
> ---
> drivers/rtc/rtc-pl031.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
> index 40d7450a1ce4..c6b89273feba 100644
> --- a/drivers/rtc/rtc-pl031.c
> +++ b/drivers/rtc/rtc-pl031.c
> @@ -275,6 +275,7 @@ static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
> struct pl031_local *ldata = dev_get_drvdata(dev);
>
> writel(rtc_tm_to_time64(&alarm->time), ldata->base + RTC_MR);
> + pl031_alarm_irq_enable(dev, alarm->enabled);
>
> return 0;
> }
> --
> 2.7.4
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc: pl031: enable rtc alarm interrupt again
@ 2020-08-13 11:39 ` Alexandre Belloni
0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2020-08-13 11:39 UTC (permalink / raw)
To: Amit Singh Tomar
Cc: linux-rtc, andre.przywara, linus.walleij, linux-arm-kernel
Hi,
Thank you for your patch. However, this is already fixed upstream:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/rtc?id=4df2ef85f0efe44505f511ca5e4455585f53a2da
On 13/08/2020 16:44:28+0530, Amit Singh Tomar wrote:
> After commit c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/
> rtc_tm_to_time64"), it has been observed the rtc alarm interrupt is
> no more registered, and due to this waking up the system
> (using rtc alarm interrupt) from suspend state is no longer possible.
>
> Besides this, we get broken output from "hwclock".
>
> root@localhost:~# hwclock
> hwclock: select() to /dev/rtc to wait for clock tick timed out: No such file or directory
>
> This is due to the fact that call to pl031_alarm_irq_enable(dev, alarm->enabled)
> is removed (from pl031_set_alarm()) in commit c8ff5841a90b, and alarm interrupt
> never gets enabled.
>
> This commit fixes it by re-introduces the missing
> pl031_alarm_irq_enable(dev, alarm->enabled).
>
> Fixes: c8ff5841a90b ("rtc: pl031: switch to rtc_time64_to_tm/rtc_tm_to_time64")
>
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
> ---
> This patch is tested on QEMU ARM64 TCG guest
>
> Without this patch:
> root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
> 39: 0 0 GICv2 34 Level rtc-pl031
>
> With this patch:
> root@localhost:~# echo +10 > /sys/class/rtc/rtc0/wakealarm && sleep 10 && cat /proc/interrupts | grep pl031
> 39: 1 0 GICv2 34 Level rtc-pl031
>
> root@localhost:~# hwclock
> Thu Aug 13 11:00:06 2020 -1.009351 seconds
>
> root@localhost:~# echo +30 > /sys/class/rtc/rtc0/wakealarm
> root@localhost:~# echo -n mem > /sys/power/state
> root@localhost:~# hwclock -r
> Thu Aug 13 08:59:14 2020 -1.010357 seconds
>
> ---
> drivers/rtc/rtc-pl031.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
> index 40d7450a1ce4..c6b89273feba 100644
> --- a/drivers/rtc/rtc-pl031.c
> +++ b/drivers/rtc/rtc-pl031.c
> @@ -275,6 +275,7 @@ static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
> struct pl031_local *ldata = dev_get_drvdata(dev);
>
> writel(rtc_tm_to_time64(&alarm->time), ldata->base + RTC_MR);
> + pl031_alarm_irq_enable(dev, alarm->enabled);
>
> return 0;
> }
> --
> 2.7.4
>
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc: pl031: enable rtc alarm interrupt again
2020-08-13 11:39 ` Alexandre Belloni
@ 2020-08-13 11:57 ` Amit Tomer
-1 siblings, 0 replies; 6+ messages in thread
From: Amit Tomer @ 2020-08-13 11:57 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Andre Przywara, Linus Walleij, linux-arm-kernel, linux-rtc
On Thu, Aug 13, 2020 at 5:09 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> Hi,
>
> Thank you for your patch. However, this is already fixed upstream:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/rtc?id=4df2ef85f0efe44505f511ca5e4455585f53a2da
Sorry, my mistake.
I checked out from the 5.8 tag, and this patch was missing it seems.
Thanks
-Amit
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc: pl031: enable rtc alarm interrupt again
@ 2020-08-13 11:57 ` Amit Tomer
0 siblings, 0 replies; 6+ messages in thread
From: Amit Tomer @ 2020-08-13 11:57 UTC (permalink / raw)
To: Alexandre Belloni
Cc: linux-rtc, Andre Przywara, Linus Walleij, linux-arm-kernel
On Thu, Aug 13, 2020 at 5:09 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> Hi,
>
> Thank you for your patch. However, this is already fixed upstream:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/rtc?id=4df2ef85f0efe44505f511ca5e4455585f53a2da
Sorry, my mistake.
I checked out from the 5.8 tag, and this patch was missing it seems.
Thanks
-Amit
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-13 11:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 11:14 [PATCH] rtc: pl031: enable rtc alarm interrupt again Amit Singh Tomar
2020-08-13 11:14 ` Amit Singh Tomar
2020-08-13 11:39 ` Alexandre Belloni
2020-08-13 11:39 ` Alexandre Belloni
2020-08-13 11:57 ` Amit Tomer
2020-08-13 11:57 ` Amit Tomer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.