Skip to contentSkip to conversation

RTC_DRV_CMOS can break userspace interface

DISCUSSION David Brownell 3 participants 9 messages May 28, 2007 – Jun 12, 2007 3 messages not in the archive ACPI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 7 lines · frank paulsen
Quoted 5 lines · David Brownell
Quoted 3 lines · Matthew Garrett

f5f72b46c349fefcfd4421b2213c6ffb324c5e56 appears to break the userspace interface to the CMOS alarm. This could previously be accessed via /proc/acpi/alarm ...

Quoted 8 lines
Quoted 6 lines

I was a bit surprised the ACPI team didn't have more comments on that issue, myself. Thing is, all of /proc/acpi/* is deprecated (scheduled for removal in barely over one month!) and nobody had found any actual users of that "alarm" file when they searched for them a while ago. I suppose the conclusion then was that there are no applications using it.

sorry for breaking the CC:, but i am currently not subscribed to lkml.

I restored both lkml and linux-acpi to the CC list. :)

Quoted 4 lines

please have a look at at http://www.mythtv.org/wiki/index.php/ACPI_Wakeup

i think there is quite a number of users, but most of them won't ever look into LKML :)

That seems to be true. And those particular users should learn the portable /sys/class/rtc/rtc0/wakealarm syntax ... e.g. using numeric seconds-since-epoch ("date '+%s'") instead of strings the kernel needs to parse. That way, they can start converting usage sooner.

Someone with edit privs on that wiki should update those docs, and tell folk to switch to that interface since the other one is going...

I'm suspecting that there should be a CONFIG_ACPI_SLEEP_PROC_ALARM not the current internal (acpi/sleep/proc.c) HAVE_ACPI_LEGACY_ALARM, and some way should be found that the two interfaces can coexist for a while. But I can't quite make sense of the strategy for getting rid of the /proc/acpi/* files ... for example, I see one entry saying the ACPI procfs as a whole vanishes July 2007, and the next one says that /proc/acpi/button stays until August 2007.

- Dave

#4 lore raw

On Mon, May 28, 2007 at 14:06:52 -0700, David Brownell wrote:

[...]

Quoted 4 lines

That seems to be true. And those particular users should learn the portable /sys/class/rtc/rtc0/wakealarm syntax ... e.g. using numeric seconds-since-epoch ("date '+%s'") instead of strings the kernel needs to parse. That way, they can start converting usage sooner.

Hi,

I use /proc/acpi/alarm a lot and tried to learn how to use /sys/class/rtc/rtc0/wakealarm. However, I have no /sys/class/rtc/rtc0 until I load the rtc-test driver. I tried all RTC drivers that are available in 2.6.21, without success:

$ grep RTC /boot/config-2.6.21
CONFIG_RTC=y
# CONFIG_HPET_RTC_IRQ is not set
# CONFIG_SND_RTCTIMER is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set
# RTC interfaces
CONFIG_RTC_INTF_SYSFS=y
# CONFIG_RTC_INTF_PROC is not set
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# RTC drivers
CONFIG_RTC_DRV_CMOS=y
CONFIG_RTC_DRV_DS1553=m
CONFIG_RTC_DRV_DS1742=m
CONFIG_RTC_DRV_M48T86=m
CONFIG_RTC_DRV_TEST=m
CONFIG_RTC_DRV_V3020=m

In dmesg, I see these messages from RTC_DRV_CMOS:

rtc_cmos 00:09: rtc core: registered rtc_cmos as rtc0
rtc_cmos: probe of 00:09 failed with error -16 drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

So all I can do is to continue to use /proc/acpi/alarm.

Regards,
Tino

#5 lore raw
Quoted 3 lines · Tino Keitel

rtc_cmos 00:09: rtc core: registered rtc_cmos as rtc0
rtc_cmos: probe of 00:09 failed with error -16 drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

Try unsetting CONFIG_RTC - you can't use the legacy driver at the same time as the new one.

Signature · 1 line
Matthew Garrett | [email protected]
#6 lore raw
Quoted 8 lines · Matthew Garrett
Quoted 3 lines · Tino Keitel

rtc_cmos 00:09: rtc core: registered rtc_cmos as rtc0
rtc_cmos: probe of 00:09 failed with error -16 drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

Try unsetting CONFIG_RTC - you can't use the legacy driver at the same time as the new one.

Yes, you are right. I think this issue should be covered by Kconfig.

However:

$ cat wakealarm 
cat: wakealarm: Input/output error

It worked with /proc/acpi/alarm before.

Regards,
Tino

#7 lore raw
Quoted 8 lines · Tino Keitel

Yes, you are right. I think this issue should be covered by Kconfig.

However:

$ cat wakealarm 
cat: wakealarm: Input/output error

It worked with /proc/acpi/alarm before.

Can you do

for i in /sys/bus/pnp/devices/*; do if [ "$(cat $i/id)" = PNP0b00 ]; then cat $i/resources; echo options; cat $i/options; fi; done

and provide the output? It sounds like you have the same problem I do, that is that you have no IRQ listed in the PNP table.

Though, actually, on reading the code:

The code for checking for a platform device only gets included if CONFIG_PNP isn't set! David, surely this should be a runtime thing rather than a compile-time one? Right now building a kernel with PNP support will break horribly if it's then run on a non-PNP system...

Signature · 1 line
Matthew Garrett | [email protected]
#8 lore raw
Quoted 4 lines · Matthew Garrett

The code for checking for a platform device only gets included if CONFIG_PNP isn't set! David, surely this should be a runtime thing rather than a compile-time one? Right now building a kernel with PNP support will break horribly if it's then run on a non-PNP system...

Maybe it should be a runtime thing. But then, on x86 there's nothing to create the platform device for this driver either...

I had posted code to create that platform device at one point, adjacent to what creates the pcspeaker device, but after ACPI changed to require PNPACPI it wasn't needed on any system I could test with. There are probably a bunch of platform_device nodes that should be created automagically on old PNP-less PCs.

- Dave

#9 lore raw
In reply to Matthew Garrett
Quoted 8 lines · Matthew Garrett
Quoted 7 lines · Tino Keitel

Yes, you are right. I think this issue should be covered by Kconfig.

However:

$ cat wakealarm 
cat: wakealarm: Input/output error
Quoted 6 lines
Quoted 1 line

It worked with /proc/acpi/alarm before.

Can you do

for i in /sys/bus/pnp/devices/*; do if [ "$(cat $i/id)" = PNP0b00 ]; then cat $i/resources; echo options; cat $i/options; fi; done

Here it is:

state = active
io 0x70-0x77
options

Regards,
Tino

#10 lore raw

On Mon, Jun 04, 2007 at 11:35:18AM +0200, Tino Keitel wrote:

(By the way, it helps if you Cc: me - it's easy to lose track of things in the LKML noise)

Quoted 5 lines

Here it is:

state = active
io 0x70-0x77
options

Yes, there's no IRQ listed. Can you try current git?

Signature · 1 line
Matthew Garrett | [email protected]
#11 lore raw
Quoted 6 lines · Matthew Garrett

On Mon, Jun 04, 2007 at 11:35:18AM +0200, Tino Keitel wrote:

(By the way, it helps if you Cc: me - it's easy to lose track of things
in the LKML noise)

Quoted 7 lines
Quoted 5 lines

Here it is:

state = active
io 0x70-0x77
options

Yes, there's no IRQ listed. Can you try current git?

OK, it works with git 99f9f3d49cbc7d944476f6fde53a77ec789ab2aa (something after -rc4). I can echo something into /sys/class/rtc/rtc0/wakealarm and the machine will wake up from suspend to RAM.

However, a minor glitch remains:

$ echo 1181672013 > /sys/class/rtc/rtc0/wakealarm

- suspend

- wait for wakeup

After wakeup:

$ cat /sys/class/rtc/rtc0/wakealarm
2051656909

Regards,
Tino