Lines Matching +full:wakeup +full:- +full:parent
1 // SPDX-License-Identifier: GPL-2.0
3 * Wakeup statistics in sysfs
6 * Copyright (c) 2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 return sysfs_emit(buf, "%lu\n", ws->_name); \
43 ws->active ? ktime_sub(ktime_get(), ws->last_time) : 0; in active_time_ms_show()
54 ktime_t total_time = ws->total_time; in total_time_ms_show()
56 if (ws->active) { in total_time_ms_show()
57 active_time = ktime_sub(ktime_get(), ws->last_time); in total_time_ms_show()
70 ktime_t max_time = ws->max_time; in max_time_ms_show()
72 if (ws->active) { in max_time_ms_show()
73 active_time = ktime_sub(ktime_get(), ws->last_time); in max_time_ms_show()
87 return sysfs_emit(buf, "%lld\n", ktime_to_ms(ws->last_time)); in last_change_ms_show()
96 return sysfs_emit(buf, "%s\n", ws->name); in name_show()
105 ktime_t prevent_sleep_time = ws->prevent_sleep_time; in prevent_suspend_time_ms_show()
107 if (ws->active && ws->autosleep_enabled) { in prevent_suspend_time_ms_show()
109 ktime_sub(ktime_get(), ws->start_prevent_time)); in prevent_suspend_time_ms_show()
136 static struct device *wakeup_source_device_create(struct device *parent, in wakeup_source_device_create() argument
144 retval = -ENOMEM; in wakeup_source_device_create()
149 dev->devt = MKDEV(0, 0); in wakeup_source_device_create()
150 dev->class = wakeup_class; in wakeup_source_device_create()
151 dev->parent = parent; in wakeup_source_device_create()
152 dev->groups = wakeup_source_groups; in wakeup_source_device_create()
153 dev->release = device_create_release; in wakeup_source_device_create()
157 retval = dev_set_name(dev, "wakeup%d", ws->id); in wakeup_source_device_create()
173 * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs.
174 * @parent: Device given wakeup source is associated with (or NULL if virtual).
175 * @ws: Wakeup source to be added in sysfs.
177 int wakeup_source_sysfs_add(struct device *parent, struct wakeup_source *ws) in wakeup_source_sysfs_add() argument
181 dev = wakeup_source_device_create(parent, ws); in wakeup_source_sysfs_add()
184 ws->dev = dev; in wakeup_source_sysfs_add()
190 * pm_wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs
192 * @parent: Device given wakeup source is associated with
194 int pm_wakeup_source_sysfs_add(struct device *parent) in pm_wakeup_source_sysfs_add() argument
196 if (!parent->power.wakeup || parent->power.wakeup->dev) in pm_wakeup_source_sysfs_add()
199 return wakeup_source_sysfs_add(parent, parent->power.wakeup); in pm_wakeup_source_sysfs_add()
203 * wakeup_source_sysfs_remove - Remove wakeup_source attributes from sysfs.
204 * @ws: Wakeup source to be removed from sysfs.
208 device_unregister(ws->dev); in wakeup_source_sysfs_remove()
213 wakeup_class = class_create(THIS_MODULE, "wakeup"); in wakeup_sources_sysfs_init()