Lines Matching +full:dev +full:- +full:active +full:- +full:grp
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
25 name_show(struct device *dev, struct device_attribute *attr, char *buf) in name_show() argument
27 return sysfs_emit(buf, "%s %s\n", dev_driver_string(dev->parent), in name_show()
28 dev_name(dev->parent)); in name_show()
33 date_show(struct device *dev, struct device_attribute *attr, char *buf) in date_show() argument
38 retval = rtc_read_time(to_rtc_device(dev), &tm); in date_show()
47 time_show(struct device *dev, struct device_attribute *attr, char *buf) in time_show() argument
52 retval = rtc_read_time(to_rtc_device(dev), &tm); in time_show()
61 since_epoch_show(struct device *dev, struct device_attribute *attr, char *buf) in since_epoch_show() argument
66 retval = rtc_read_time(to_rtc_device(dev), &tm); in since_epoch_show()
75 max_user_freq_show(struct device *dev, struct device_attribute *attr, char *buf) in max_user_freq_show() argument
77 return sysfs_emit(buf, "%d\n", to_rtc_device(dev)->max_user_freq); in max_user_freq_show()
81 max_user_freq_store(struct device *dev, struct device_attribute *attr, in max_user_freq_store() argument
84 struct rtc_device *rtc = to_rtc_device(dev); in max_user_freq_store()
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
103 * @dev: The device that the attribute belongs to.
111 hctosys_show(struct device *dev, struct device_attribute *attr, char *buf) in hctosys_show() argument
115 strcmp(dev_name(&to_rtc_device(dev)->dev), in hctosys_show()
124 wakealarm_show(struct device *dev, struct device_attribute *attr, char *buf) in wakealarm_show() argument
130 * conceptually one-shot, even though some common RTCs (on PCs) 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()
137 retval = rtc_read_alarm(to_rtc_device(dev), &alm); in wakealarm_show()
148 wakealarm_store(struct device *dev, struct device_attribute *attr, in wakealarm_store() argument
155 struct rtc_device *rtc = to_rtc_device(dev); in wakealarm_store()
183 /* Avoid accidentally clobbering active alarms; we can't in wakealarm_store()
185 * locking from the /dev/rtcN api. in wakealarm_store()
195 return -EBUSY; in wakealarm_store()
197 return -EINVAL; in wakealarm_store()
215 offset_show(struct device *dev, struct device_attribute *attr, char *buf) in offset_show() argument
220 retval = rtc_read_offset(to_rtc_device(dev), &offset); in offset_show()
228 offset_store(struct device *dev, struct device_attribute *attr, in offset_store() argument
236 retval = rtc_set_offset(to_rtc_device(dev), offset); in offset_store()
243 range_show(struct device *dev, struct device_attribute *attr, char *buf) in range_show() argument
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()
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()
279 struct device *dev = kobj_to_dev(kobj); in rtc_attr_is_visible() local
280 struct rtc_device *rtc = to_rtc_device(dev); in rtc_attr_is_visible()
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()
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()
345 int rtc_add_group(struct rtc_device *rtc, const struct attribute_group *grp) in rtc_add_group() argument
347 const struct attribute_group *groups[] = { grp, NULL }; in rtc_add_group()