[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJE6QhePvy7f4LKW@piout.net>
Date: Tue, 4 May 2021 14:12:50 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Martin Kaiser <martin@...ser.cx>
Cc: Alessandro Zummo <a.zummo@...ertech.it>,
Shawn Guo <shawnguo@...nel.org>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, linux-rtc@...r.kernel.org,
linux-kernel@...r.kernel.org, Stephen Boyd <sboyd@...nel.org>
Subject: Re: [PATCH] rtc: imxdi: add wakeup support
On 04/05/2021 12:08:58+0200, Martin Kaiser wrote:
> Thus wrote Alexandre Belloni (alexandre.belloni@...tlin.com):
>
> > > platform_set_drvdata(pdev, imxdi);
>
> > > + device_set_wakeup_capable(&pdev->dev, true);
>
> > Maybe it makes sense to simply use device_init_wakeup here.
>
> the explanation for device_init_wakeup
>
> "By default, most devices should leave wakeup disabled. The exceptions
> are devices that everyone expects to be wakeup sources: keyboards, power
> buttons, ..."
>
> made me think that device_set_wakeup_capable is more appropriate here. I
> can change this if you want.
>
Doesn't everyone expect the RTC to be a wakeup source? :)
> However, if I compile rtc-imxdi as a module and use device_init_wakeup,
> the module can't be unloaded any more. The reason is that alarmtimer
> (kernel/time/alarmtimer.c) starts using rtc-imxdi as its backing rtc
> device and holds a reference to it. It seems that alarmtimer has no way
> to relinquish its backing rtc device, regardless of any pending alarms.
>
> What is the right approach here? Are there any rtc drivers that act as a
> wakeup source and can still be unloaded if compiled as a module?
>
Yes, when you don't have alarmtimer ;)
I honestly think the RTC selection needs to be a bit more dynamic but at
the same time, it would not be great to change it at suspend time. I
guess the best way would be to allow module unloading and tracking when
the RTC disappears.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists