From: Andrew Morton <akpm@linux-foundation.org>
To: Kevin Hilman <khilman@linaro.org>
Cc: rtc-linux@googlegroups.com, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linaro-kernel@lists.linaro.org,
Alessandro Zummo <a.zummo@towertech.it>,
Tony Lindgren <tony@atomide.com>,
linux-kernel@vger.kernel.org (open list)
Subject: Re: [PATCH] rtc: rtc-twl: ensure IRQ is wakeup enabled
Date: Mon, 3 Jun 2013 16:13:03 -0700 [thread overview]
Message-ID: <20130603161303.55e9da049744656541e9048f@linux-foundation.org> (raw)
In-Reply-To: <1370039827-25033-1-git-send-email-khilman@linaro.org>
On Fri, 31 May 2013 15:37:07 -0700 Kevin Hilman <khilman@linaro.org> wrote:
> Currently, the RTC IRQ is never wakeup-enabled so is not capable of
> bringing the system out of suspend.
>
> On OMAP platforms, we have gotten by without this because the TWL RTC
> is on an I2C-connected chip which is capable of waking up the OMAP via
> the IO ring when the OMAP is in low-power states.
>
> However, if the OMAP suspends without hitting the low-power states
> (and the IO ring is not enabled), RTC wakeups will not work because
> the IRQ is not wakeup enabled.
>
> To fix, ensure the RTC IRQ is wakeup enabled whenever the RTC alarm is
> set.
>
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -213,12 +213,24 @@ static int mask_rtc_irq_bit(unsigned char bit)
>
> static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
> {
> + struct platform_device *pdev = to_platform_device(dev);
> + int irq = platform_get_irq(pdev, 0);
> + static bool twl_rtc_wake_enabled;
> int ret;
>
> - if (enabled)
> + if (enabled) {
> ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
> - else
> + if (device_can_wakeup(dev) && !twl_rtc_wake_enabled) {
> + enable_irq_wake(irq);
> + twl_rtc_wake_enabled = true;
> + }
> + } else {
> ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
> + if (twl_rtc_wake_enabled) {
> + disable_irq_wake(irq);
> + twl_rtc_wake_enabled = false;
> + }
> + }
Why do we need this (slightly racy) logic with twl_rtc_wake_enabled?
Other drivers don't do this.
Should we test device_may_wakeup() befre running disable_irq_wake()?
Most drivers seem to do this, but it's all a bit foggy.
next prev parent reply other threads:[~2013-06-03 23:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-31 22:37 Kevin Hilman
2013-06-03 23:13 ` Andrew Morton [this message]
2013-06-04 17:54 ` Kevin Hilman
2013-06-04 11:32 ` Grygorii Strashko
2013-06-04 17:46 ` Kevin Hilman
2013-06-05 14:32 ` Grygorii Strashko
2013-06-05 15:32 ` Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130603161303.55e9da049744656541e9048f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.zummo@towertech.it \
--cc=khilman@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rtc-linux@googlegroups.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®