lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51ADD031.2090808@ti.com>
Date:	Tue, 4 Jun 2013 14:32:01 +0300
From:	Grygorii Strashko <grygorii.strashko@...com>
To:	Kevin Hilman <khilman@...aro.org>
CC:	<rtc-linux@...glegroups.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	<linux-omap@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>,
	<linaro-kernel@...ts.linaro.org>,
	Alessandro Zummo <a.zummo@...ertech.it>,
	Tony Lindgren <tony@...mide.com>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rtc: rtc-twl: ensure IRQ is wakeup enabled

Hi Kevin,

On 06/01/2013 01:37 AM, Kevin Hilman 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.
As I understand, IRQ wake up capabilities are set/clear simultaneously with
IRQ unmasking/masking on OMAP4+ in omap-wakeupgen.c.
So, it should work without this patch on OMAP4+.
But if TWL is used on non OMAP4+ platform then it is needed.
(OMAP3: I haven't found the place where IRQ wakeup capabilities are 
configured,
would be appreciate if you can point me on)
>
> To fix, ensure the RTC IRQ is wakeup enabled whenever the RTC alarm is
> set.
>
> Cc: Alessandro Zummo <a.zummo@...ertech.it>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Tony Lindgren <tony@...mide.com>
> Signed-off-by: Kevin Hilman <khilman@...aro.org>
> ---
>   drivers/rtc/rtc-twl.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 8751a52..bbda0fd 100644
> --- 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;
> +		}
> +	}
>   
>   	return ret;
>   }
twl-rtc has suspend/resume callbacks implemented, so I think it's the 
better place
for this code and twl_rtc_wake_enabled can be dropped.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ