linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Question] rtc wake behavior and sysfs
@ 2020-10-05 13:13 Peter Geis
  2020-10-05 22:29 ` Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Geis @ 2020-10-05 13:13 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni, Rafael J. Wysocki, len.brown, pavel, Greg KH
  Cc: linux-rtc, linux-pm, linux-kernel, linux-tegra

Good Morning,

While testing suspend to ram on the Ouya, I encountered an interesting
issue with the rtc-tps65910 driver.
Attempting to use rtc-wake on the default configuration returned:
rtcwake: /dev/rtc0 not enabled for wakeup events
This is due to:
eb5eba4ef722 drivers/rtc/rtc-tps65910.c: enable/disable wake in suspend/resume
This commit changed this driver's behavior to not enable wakeup by
default, but enables it when entering sleep mode.
This seems to be odd behavior to me.
Looking at a few other rtc drivers show they simply enable themselves
as wakeup sources by default.

I also found the sysfs entries are at /sys/devices/ ..
/tps65910-rtc/power but are missing at /sys/class/rtc/rtc0/power/

I have two questions.
 - Should the sysfs wakeup entries be missing at /sys/class/rtc/rtc0/power/ ?
 - Shouldn't a rtc be enabled as a wakeup source by default?

Thank you for your time.

Very Respectfully,
Peter Geis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Question] rtc wake behavior and sysfs
  2020-10-05 13:13 [Question] rtc wake behavior and sysfs Peter Geis
@ 2020-10-05 22:29 ` Alexandre Belloni
  2020-10-06  1:47   ` Peter Geis
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2020-10-05 22:29 UTC (permalink / raw)
  To: Peter Geis
  Cc: a.zummo, Rafael J. Wysocki, len.brown, pavel, Greg KH, linux-rtc,
	linux-pm, linux-kernel, linux-tegra

On 05/10/2020 09:13:08-0400, Peter Geis wrote:
> Good Morning,
> 
> While testing suspend to ram on the Ouya, I encountered an interesting
> issue with the rtc-tps65910 driver.
> Attempting to use rtc-wake on the default configuration returned:
> rtcwake: /dev/rtc0 not enabled for wakeup events
> This is due to:
> eb5eba4ef722 drivers/rtc/rtc-tps65910.c: enable/disable wake in suspend/resume
> This commit changed this driver's behavior to not enable wakeup by
> default, but enables it when entering sleep mode.
> This seems to be odd behavior to me.
> Looking at a few other rtc drivers show they simply enable themselves
> as wakeup sources by default.
> 
> I also found the sysfs entries are at /sys/devices/ ..
> /tps65910-rtc/power but are missing at /sys/class/rtc/rtc0/power/
> 
> I have two questions.
>  - Should the sysfs wakeup entries be missing at /sys/class/rtc/rtc0/power/ ?

I would be in /sys/class/rtc/rtc0/device/power

>  - Shouldn't a rtc be enabled as a wakeup source by default?
> 

The short answer is no, the reason being that not all RTCs are connected
to an IRQ or a pin that can wakeup or start the platform. What should be
done is enabling wakeup only when interrupts are available or the
wakeup-source property is in the rtc device tree node.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Question] rtc wake behavior and sysfs
  2020-10-05 22:29 ` Alexandre Belloni
@ 2020-10-06  1:47   ` Peter Geis
  2020-10-06  7:03     ` Alexandre Belloni
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Geis @ 2020-10-06  1:47 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: a.zummo, Rafael J. Wysocki, len.brown, pavel, Greg KH, linux-rtc,
	linux-pm, linux-kernel, linux-tegra

On Mon, Oct 5, 2020 at 6:29 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> On 05/10/2020 09:13:08-0400, Peter Geis wrote:
> > Good Morning,
> >
> > While testing suspend to ram on the Ouya, I encountered an interesting
> > issue with the rtc-tps65910 driver.
> > Attempting to use rtc-wake on the default configuration returned:
> > rtcwake: /dev/rtc0 not enabled for wakeup events
> > This is due to:
> > eb5eba4ef722 drivers/rtc/rtc-tps65910.c: enable/disable wake in suspend/resume
> > This commit changed this driver's behavior to not enable wakeup by
> > default, but enables it when entering sleep mode.
> > This seems to be odd behavior to me.
> > Looking at a few other rtc drivers show they simply enable themselves
> > as wakeup sources by default.
> >
> > I also found the sysfs entries are at /sys/devices/ ..
> > /tps65910-rtc/power but are missing at /sys/class/rtc/rtc0/power/
> >
> > I have two questions.
> >  - Should the sysfs wakeup entries be missing at /sys/class/rtc/rtc0/power/ ?
>
> I would be in /sys/class/rtc/rtc0/device/power
>
> >  - Shouldn't a rtc be enabled as a wakeup source by default?
> >
>
> The short answer is no, the reason being that not all RTCs are connected
> to an IRQ or a pin that can wakeup or start the platform. What should be
> done is enabling wakeup only when interrupts are available or the
> wakeup-source property is in the rtc device tree node.

Thank you for your explanation.

So it would seem we have two issues.
- The sysfs wakeup entries are not populating in
/sys/class/rtc/rtc0/power when they are populating in
/sys/devices/<..>/tps65910-rtc/power.
- The wakeup-source property is not being applied to the tps65910-rtc
sub-device when it is applied in the tps65910 devicetree node.

Should wakeup-source handling be the tps65910-rtc driver's
responsibility, or is that a limitation of the driver core that needs
to be fixed?

>
> --
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Question] rtc wake behavior and sysfs
  2020-10-06  1:47   ` Peter Geis
@ 2020-10-06  7:03     ` Alexandre Belloni
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2020-10-06  7:03 UTC (permalink / raw)
  To: Peter Geis
  Cc: a.zummo, Rafael J. Wysocki, len.brown, pavel, Greg KH, linux-rtc,
	linux-pm, linux-kernel, linux-tegra

On 05/10/2020 21:47:01-0400, Peter Geis wrote:
> On Mon, Oct 5, 2020 at 6:29 PM Alexandre Belloni
> <alexandre.belloni@bootlin.com> wrote:
> >
> > On 05/10/2020 09:13:08-0400, Peter Geis wrote:
> > > Good Morning,
> > >
> > > While testing suspend to ram on the Ouya, I encountered an interesting
> > > issue with the rtc-tps65910 driver.
> > > Attempting to use rtc-wake on the default configuration returned:
> > > rtcwake: /dev/rtc0 not enabled for wakeup events
> > > This is due to:
> > > eb5eba4ef722 drivers/rtc/rtc-tps65910.c: enable/disable wake in suspend/resume
> > > This commit changed this driver's behavior to not enable wakeup by
> > > default, but enables it when entering sleep mode.
> > > This seems to be odd behavior to me.
> > > Looking at a few other rtc drivers show they simply enable themselves
> > > as wakeup sources by default.
> > >
> > > I also found the sysfs entries are at /sys/devices/ ..
> > > /tps65910-rtc/power but are missing at /sys/class/rtc/rtc0/power/
> > >
> > > I have two questions.
> > >  - Should the sysfs wakeup entries be missing at /sys/class/rtc/rtc0/power/ ?
> >
> > I would be in /sys/class/rtc/rtc0/device/power
> >
> > >  - Shouldn't a rtc be enabled as a wakeup source by default?
> > >
> >
> > The short answer is no, the reason being that not all RTCs are connected
> > to an IRQ or a pin that can wakeup or start the platform. What should be
> > done is enabling wakeup only when interrupts are available or the
> > wakeup-source property is in the rtc device tree node.
> 
> Thank you for your explanation.
> 
> So it would seem we have two issues.
> - The sysfs wakeup entries are not populating in
> /sys/class/rtc/rtc0/power when they are populating in
> /sys/devices/<..>/tps65910-rtc/power.

I think the rationale here is that the rtc device is not the wakeup
device but the underlying one is hence why it is in
/sys/class/rtc/rtc0/device/power and not in /sys/class/rtc/rtc0/power/.

> - The wakeup-source property is not being applied to the tps65910-rtc
> sub-device when it is applied in the tps65910 devicetree node.
> 
> Should wakeup-source handling be the tps65910-rtc driver's
> responsibility, or is that a limitation of the driver core that needs
> to be fixed?

For now, parsing this property is left to the individual drivers.
You'll have to implement it for the tps65910 and so you can get it from
the parent node if necessary.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-06  7:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 13:13 [Question] rtc wake behavior and sysfs Peter Geis
2020-10-05 22:29 ` Alexandre Belloni
2020-10-06  1:47   ` Peter Geis
2020-10-06  7:03     ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).