aboutsummaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-sysfs.c
AgeCommit message (Collapse)AuthorFilesLines
2013-07-29rtc: convert class code to use dev_groupsGreg Kroah-Hartman1-24/+24
The dev_attrs field of struct class is going away soon, dev_groups should be used instead. This converts the rtc class code to use the correct field. Acked-by: Alessandro Zummo <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-07-03rtc: add ability to push out an existing wakealarm using sysfsBernie Thompson1-5/+15
This adds the ability for the rtc sysfs code to handle += characters at the beginning of a wakealarm setting string. This will allow the user to attempt to push out an existing wakealarm by a provided amount. In the case that the += characters are provided but the alarm is not active -EINVAL is returned. his is useful, at least for my purposes in suspend/resume testing. The basic test goes something like: 1. Set a wake alarm from userspace 5 seconds in the future 2. Start the suspend process (echo mem > /sys/power/state) 3. After ~2.5 seconds if userspace is still running (using another thread to check this), move the wake alarm 5 more seconds If the "move" involves an unset of the wakealarm then there's a period of time where the system is midway through suspending but has no wake alarm. It will get stuck. We'd rather not remove the "move" since the idea is to avoid a cancelled suspend when the alarm fires _during_ suspend. It is difficult for the test to tell the difference between a suspend that was cancelled because the alarm fired too early and a suspend that was Signed-off-by: Bernie Thompson <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Doug Anderson <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-10-06rtc_sysfs_show_hctosys(): display 0 if resume failedDavid Fries1-0/+6
Without this patch /sys/class/rtc/$CONFIG_RTC_HCTOSYS_DEVICE/hctosys contains a 1 (meaning "This rtc was used to initialize the system clock") even if setting the time by do_settimeofday() at bootup failed. The RTC can also be used to set the clock on resume, if it did 1, otherwise 0. Previously there was no indication if the RTC was used to set the clock in resume. This uses only CONFIG_RTC_HCTOSYS_DEVICE for conditional compilation instead of it and CONFIG_RTC_HCTOSYS to be more consistent. rtc_hctosys_ret was moved to class.c so class.c no longer depends on hctosys.c. [[email protected]: fix build] Signed-off-by: David Fries <[email protected]> Cc: Matthew Garrett <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Uwe Kleine-König <[email protected]> Signed-off-by: Stephen Rothwell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2010-03-12rtc/hctosys: only claim the RTC provided the system time if it didUwe Kleine-König1-2/+3
Without this patch /sys/class/rtc/$CONFIG_RTC_HCTOSYS_DEVICE/hctosys contains a 1 (meaning "This rtc was used to initialize the system clock") even if reading the time at bootup failed. Moreover change error handling in rtc_hctosys() to use goto and so reduce the indention level. Signed-off-by: Uwe Kleine-König <[email protected]> Cc: Paul Gortmaker <[email protected]> Acked-by: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-09-23rtc: add boot_timesource sysfs attributeMatthew Garrett1-0/+14
CONFIG_RTC_HCTOSYS allows the kernel to read the system time from the RTC at boot and resume, avoiding the need for userspace to do so. Unfortunately userspace currently has no way to know whether this configuration option is enabled and thus cannot sensibly choose whether to run hwclock itself or not. Add a hctosys sysfs attribute which indicates whether a given RTC set the system clock. Signed-off-by: Matthew Garrett <[email protected]> Acked-by: Alessandro Zummo <[email protected]> Cc: Mark Brown <[email protected]> Cc: David Brownell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-04-28rtc: add the support for alarm time relative to current time in sysfsZhao Yakui1-1/+11
In current kernel if we want to set the alarm time, the absolute time the seconds relative to 1970-01-01 00:00:00) should be written into /sys/class/rtc/rtc0/wakealarm. It is not convenient. It is more reasonable to add the support for the alarm time relative to current RTC time.(the unit is second) For example: If the RTC is required to generate alarm after 2 minutes, the following will be OK. echo +120 > /sys/class/rtc/rtc0/wakealarm or echo +0x78 > /sys/class/rtc/rtc0/wakealarm Signed-off-by: Zhao Yakui <[email protected]> Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: David Brownell <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-02-06rtc-cmos alarm acts as oneshotDavid Brownell1-6/+13
Start making the rtc-cmos alarm act more like a oneshot alarm by disabling that alarm after its IRQ fires. (ACPI hooks are also needed.) The Linux RTC framework has previously been a bit vague in this area, but any other behavior is problematic and not very portable. RTCs with full YYYY-MM-DD HH:MM[:SS] alarms won't have a problem here. Only ones with partial match criteria, with the most visible example being the PC RTC, get confused. (Because the criteria will match repeatedly.) Update comments relating to that oneshot behavior and timezone handling. (Timezones are another issue that's mostly visible with rtc-cmos. That's because PCs often dual-boot MS-Windows, which likes its RTC to match local wall-clock time instead of UTC.) Signed-off-by: David Brownell <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-18Add missing newlines to some uses of dev_<level> messagesJoe Perches1-3/+2
Found these while looking at printk uses. Add missing newlines to dev_<level> uses Add missing KERN_<level> prefixes to multiline dev_<level>s Fixed a wierd->weird spelling typo Added a newline to a printk Signed-off-by: Joe Perches <[email protected]> Cc: "Luck, Tony" <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Mark M. Hoffman <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Tilman Schmidt <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Jeff Garzik <[email protected]> Cc: Stephen Hemminger <[email protected]> Cc: Greg KH <[email protected]> Cc: Jeremy Fitzhardinge <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: David Brownell <[email protected]> Cc: James Smart <[email protected]> Cc: Andrew Vasquez <[email protected]> Cc: "Antonino A. Daplas" <[email protected]> Cc: Evgeniy Polyakov <[email protected]> Cc: Russell King <[email protected]> Cc: Jaroslav Kysela <[email protected]> Cc: Takashi Iwai <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-10-16rtc: add max_user_freq to sysfsBryan Kadzban1-0/+24
drivers/char/rtc.c exposed a sysctl to change the maximum frequency at which a non-root user could ask the RTC to generate interrupts (via the RTC_IRQP_SET ioctl). This value is no longer available under the new RTC subsystem, so add it to sysfs for each RTC device. Works for me on x86_64 (both reads and writes), using rtc-cmos. Signed-off-by: Bryan Kadzban <[email protected]> Acked-by: Alessandro Zummo <[email protected]> Cc: David Brownell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-05-08rtc: remove rest of class_deviceDavid Brownell1-15/+23
Finish converting the RTC framework so it no longer uses class_device. Signed-off-by: David Brownell <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-By: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-05-08rtc: simplified rtc sysfs attribute handlingDavid Brownell1-64/+23
This simplifies the RTC sysfs support by removing the class_interface that hooks it into the rtc core. If it's configured, then sysfs support is now part of the RTC core, and is never a separate module. It's another step towards being able to remove "struct class_device". Signed-off-by: David Brownell <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-By: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-05-08rtc: rtc interfaces don't use class_deviceDavid Brownell1-7/+11
This patch removes class_device from the programming interface that the RTC framework exposes to the rest of the kernel. Now an rtc_device is passed, which is more type-safe and streamlines all the relevant code. Signed-off-by: David Brownell <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-By: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-02-12[PATCH] RTC gets sysfs wakealarm attributeDavid Brownell1-2/+101
This adds a new "wakealarm" sysfs attribute to RTC class devices which support alarm operations and are wakeup-capable: - It reads as either empty, or the scheduled alarm time as seconds since the POSIX epoch. (That time may already have passed, since nothing currently enforces one-shot alarm semantics.) - It can be written with an alarm time in the future, again seconds since the POSIX epoch, which enables the alarm. - It can be written with an alarm time not in the future (such as 0, the start of the POSIX epoch) to disable the alarm. Usage examples (some need GNU date) after "cd /sys/class/rtc/rtcN": alarm after 10 minutes: # echo $(( $(cat since_epoch) + 10 * 60 )) > wakealarm alarm tuesday evening 10pm: # date -d '10pm tuesday' "+%s" > wakealarm disable alarm: # echo 0 > wakealarm This resembles the /proc/acpi/alarm file in that nothing happens when the alarm triggers ... except possibly waking the system from sleep. It's also like that in a nasty way: not much can be done to prevent one task from clobbering another task's alarm settings. It differs from that file in that there's no in-kernel date parser. Note that a few RTCs ignore rtc_wkalrm.enabled when setting alarms, or aren't set up correctly, so they won't yet behave with this attribute. Signed-off-by: David Brownell <[email protected]> Acked-by: Pavel Machek <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-01-26[PATCH] remove __devinit markings from rtc_sysfs_add_device()Mike Frysinger1-1/+1
rtc_sysfs_add_device is needed even after dev initialization, so drop __devinit. Signed-off-by: Mike Frysinger <[email protected]> Acked-by: Alessandro Zummo <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-12-13[PATCH] rtc: remove syslog spam on registrationDavid Brownell1-1/+1
This removes some syslog spam as RTC drivers register; debug messages shouldn't come out at "info" level. Signed-off-by: David Brownell <[email protected]> Acked-by: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-01[PATCH] rtc-sysfs fixAndrew Morton1-1/+1
It's not clear how this thinko got through.. Cc: Olaf Hering <[email protected]> Cc: David Brownell <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-10-01[PATCH] RTC class uses subsys_initDavid Brownell1-1/+1
This makes RTC core components use "subsys_init" instead of "module_init", as appropriate for subsystem infrastructure. This is mostly useful for statically linking drivers in other parts of the tree that may provide an RTC interface as a secondary functionality (e.g. part of a multifunction chip); they won't need to worry so much about drivers/Makefile link order. Signed-off-by: David Brownell <[email protected]> Cc: Alessandro Zummo <[email protected]> Acked-by: Oleg Verych <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-03-27[PATCH] RTC subsystem: sysfs interfaceAlessandro Zummo1-0/+124
This patch adds the sysfs interface to the RTC subsystem. Each RTC client will have his own entry under /sys/classs/rtc/rtcN . Within this entry some attributes are exported by the subsystem, like date and time. Signed-off-by: Alessandro Zummo <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>