Lines Matching +full:no +full:- +full:alarm
1 // SPDX-License-Identifier: GPL-2.0
13 #include "rtc-core.h"
19 * ideally UTC. However, PCs that also boot to MS-Windows normally use
27 return sysfs_emit(buf, "%s %s\n", dev_driver_string(dev->parent), in name_show()
28 dev_name(dev->parent)); in name_show()
77 return sysfs_emit(buf, "%d\n", to_rtc_device(dev)->max_user_freq); in max_user_freq_show()
93 return -EINVAL; in max_user_freq_store()
95 rtc->max_user_freq = (int)val; in max_user_freq_store()
102 * hctosys_show - indicate if the given RTC set the system time
115 strcmp(dev_name(&to_rtc_device(dev)->dev), in hctosys_show()
130 * conceptually one-shot, even though some common RTCs (on PCs) in wakealarm_show()
133 * NOTE: RTC implementations where the alarm doesn't match an in wakealarm_show()
134 * exact YYYY-MM-DD HH:MM[:SS] date *must* disable their RTC in wakealarm_show()
135 * alarms after they trigger, to ensure one-shot semantics. in wakealarm_show()
152 time64_t now, alarm; in wakealarm_store() local
177 retval = kstrtos64(buf_ptr, 0, &alarm); in wakealarm_store()
181 alarm += now; in wakealarm_store()
182 if (alarm > now || push) { in wakealarm_store()
193 alarm += push; in wakealarm_store()
195 return -EBUSY; in wakealarm_store()
197 return -EINVAL; in wakealarm_store()
202 /* Provide a valid future alarm time. Linux isn't EFI, in wakealarm_store()
203 * this time won't be ignored when disabling the alarm. in wakealarm_store()
205 alarm = now + 300; in wakealarm_store()
207 rtc_time64_to_tm(alarm, &alm.time); in wakealarm_store()
245 return sysfs_emit(buf, "[%lld,%llu]\n", to_rtc_device(dev)->range_min, in range_show()
246 to_rtc_device(dev)->range_max); in range_show()
263 /* The reason to trigger an alarm with no process watching it (via sysfs)
264 * is its side effect: waking from a system state like suspend-to-RAM or
265 * suspend-to-disk. So: no attribute unless that side effect is possible.
270 if (!device_can_wakeup(rtc->dev.parent)) in rtc_does_wakealarm()
273 return !!test_bit(RTC_FEATURE_ALARM, rtc->features); in rtc_does_wakealarm()
281 umode_t mode = attr->mode; in rtc_attr_is_visible()
287 if (!rtc->ops->set_offset) in rtc_attr_is_visible()
290 if (!(rtc->range_max - rtc->range_min)) in rtc_attr_is_visible()
316 /* No need to modify current groups if nothing new is provided */ in rtc_add_groups()
320 return -EINVAL; in rtc_add_groups()
323 groups = rtc->dev.groups; in rtc_add_groups()
329 groups = devm_kcalloc(&rtc->dev, new_cnt, sizeof(*groups), GFP_KERNEL); in rtc_add_groups()
331 return -ENOMEM; in rtc_add_groups()
332 memcpy(groups, rtc->dev.groups, old_cnt * sizeof(*groups)); in rtc_add_groups()
336 old = rtc->dev.groups; in rtc_add_groups()
337 rtc->dev.groups = groups; in rtc_add_groups()
339 devm_kfree(&rtc->dev, old); in rtc_add_groups()