Lines Matching +full:wakeup +full:- +full:delay
1 // SPDX-License-Identifier: GPL-2.0
15 * control - Report/change current runtime PM setting of the device
30 * wakeup - Report/change current wakeup option for device
32 * Some devices support "wakeup" events, which are hardware signals
34 * devices have one of three values for the sysfs power/wakeup file:
38 * + "\n" for temporary or permanent inability to issue wakeup.
42 * Familiar examples of devices that can issue wakeup events include
44 * "Wake-On-LAN" Ethernet links, GPIO lines, and more. Some events
47 * Some wakeup events use normal IRQ lines; other use special out
51 * wakeup signaling as part of changing device power states, respecting
54 * Devices may not be able to generate wakeup events from all power
57 * active, or which may have wakeup disabled. Some drivers rely on
58 * wakeup events internally (unless they are disabled), keeping
60 * saves runtime power, without requiring system-wide sleep states.
62 * async - Report/change current async suspend setting for the device
64 * Asynchronous suspend and resume of the device during system-wide power
80 * autosuspend_delay_ms - Report/change a device's autosuspend_delay value
92 * wakeup_count - Report the number of wakeup events related to the device
105 dev->power.runtime_auto ? ctrl_auto : ctrl_on); in control_show()
117 n = -EINVAL; in control_store()
155 if (dev->power.runtime_error) { in runtime_status_show()
157 } else if (dev->power.disable_depth) { in runtime_status_show()
160 switch (dev->power.runtime_status) { in runtime_status_show()
174 return -EIO; in runtime_status_show()
186 if (!dev->power.use_autosuspend) in autosuspend_delay_ms_show()
187 return -EIO; in autosuspend_delay_ms_show()
189 return sysfs_emit(buf, "%d\n", dev->power.autosuspend_delay); in autosuspend_delay_ms_show()
195 long delay; in autosuspend_delay_ms_store() local
197 if (!dev->power.use_autosuspend) in autosuspend_delay_ms_store()
198 return -EIO; in autosuspend_delay_ms_store()
200 if (kstrtol(buf, 10, &delay) != 0 || delay != (int) delay) in autosuspend_delay_ms_store()
201 return -EINVAL; in autosuspend_delay_ms_store()
204 pm_runtime_set_autosuspend_delay(dev, delay); in autosuspend_delay_ms_store()
238 return -EINVAL; in pm_qos_resume_latency_us_store()
245 return -EINVAL; in pm_qos_resume_latency_us_store()
248 ret = dev_pm_qos_update_request(dev->power.qos->resume_latency_req, in pm_qos_resume_latency_us_store()
279 return -EINVAL; in pm_qos_latency_tolerance_us_store()
286 return -EINVAL; in pm_qos_latency_tolerance_us_store()
309 return -EINVAL; in pm_qos_no_power_off_store()
312 return -EINVAL; in pm_qos_no_power_off_store()
336 return -EINVAL; in wakeup_store()
343 return -EINVAL; in wakeup_store()
347 static DEVICE_ATTR_RW(wakeup);
355 spin_lock_irq(&dev->power.lock); in wakeup_count_show()
356 if (dev->power.wakeup) { in wakeup_count_show()
357 count = dev->power.wakeup->wakeup_count; in wakeup_count_show()
360 spin_unlock_irq(&dev->power.lock); in wakeup_count_show()
376 spin_lock_irq(&dev->power.lock); in wakeup_active_count_show()
377 if (dev->power.wakeup) { in wakeup_active_count_show()
378 count = dev->power.wakeup->active_count; in wakeup_active_count_show()
381 spin_unlock_irq(&dev->power.lock); in wakeup_active_count_show()
397 spin_lock_irq(&dev->power.lock); in wakeup_abort_count_show()
398 if (dev->power.wakeup) { in wakeup_abort_count_show()
399 count = dev->power.wakeup->wakeup_count; in wakeup_abort_count_show()
402 spin_unlock_irq(&dev->power.lock); in wakeup_abort_count_show()
418 spin_lock_irq(&dev->power.lock); in wakeup_expire_count_show()
419 if (dev->power.wakeup) { in wakeup_expire_count_show()
420 count = dev->power.wakeup->expire_count; in wakeup_expire_count_show()
423 spin_unlock_irq(&dev->power.lock); in wakeup_expire_count_show()
438 spin_lock_irq(&dev->power.lock); in wakeup_active_show()
439 if (dev->power.wakeup) { in wakeup_active_show()
440 active = dev->power.wakeup->active; in wakeup_active_show()
443 spin_unlock_irq(&dev->power.lock); in wakeup_active_show()
459 spin_lock_irq(&dev->power.lock); in wakeup_total_time_ms_show()
460 if (dev->power.wakeup) { in wakeup_total_time_ms_show()
461 msec = ktime_to_ms(dev->power.wakeup->total_time); in wakeup_total_time_ms_show()
464 spin_unlock_irq(&dev->power.lock); in wakeup_total_time_ms_show()
479 spin_lock_irq(&dev->power.lock); in wakeup_max_time_ms_show()
480 if (dev->power.wakeup) { in wakeup_max_time_ms_show()
481 msec = ktime_to_ms(dev->power.wakeup->max_time); in wakeup_max_time_ms_show()
484 spin_unlock_irq(&dev->power.lock); in wakeup_max_time_ms_show()
500 spin_lock_irq(&dev->power.lock); in wakeup_last_time_ms_show()
501 if (dev->power.wakeup) { in wakeup_last_time_ms_show()
502 msec = ktime_to_ms(dev->power.wakeup->last_time); in wakeup_last_time_ms_show()
505 spin_unlock_irq(&dev->power.lock); in wakeup_last_time_ms_show()
515 if (dev->power.wakeup && dev->power.wakeup->dev) in dpm_sysfs_wakeup_change_owner()
516 return device_change_owner(dev->power.wakeup->dev, kuid, kgid); in dpm_sysfs_wakeup_change_owner()
530 spin_lock_irq(&dev->power.lock); in wakeup_prevent_sleep_time_ms_show()
531 if (dev->power.wakeup) { in wakeup_prevent_sleep_time_ms_show()
532 msec = ktime_to_ms(dev->power.wakeup->prevent_sleep_time); in wakeup_prevent_sleep_time_ms_show()
535 spin_unlock_irq(&dev->power.lock); in wakeup_prevent_sleep_time_ms_show()
556 return sysfs_emit(buf, "%d\n", atomic_read(&dev->power.usage_count)); in runtime_usage_show()
564 return sysfs_emit(buf, "%d\n", dev->power.ignore_children ? in runtime_active_kids_show()
565 0 : atomic_read(&dev->power.child_count)); in runtime_active_kids_show()
574 if (dev->power.disable_depth && !dev->power.runtime_auto) in runtime_enabled_show()
576 else if (dev->power.disable_depth) in runtime_enabled_show()
578 else if (!dev->power.runtime_auto) in runtime_enabled_show()
604 return -EINVAL; in async_store()
702 rc = sysfs_create_group(&dev->kobj, &pm_attr_group); in dpm_sysfs_add()
707 rc = sysfs_merge_group(&dev->kobj, &pm_runtime_attr_group); in dpm_sysfs_add()
712 rc = sysfs_merge_group(&dev->kobj, &pm_wakeup_attr_group); in dpm_sysfs_add()
716 if (dev->power.set_latency_tolerance) { in dpm_sysfs_add()
717 rc = sysfs_merge_group(&dev->kobj, in dpm_sysfs_add()
728 sysfs_unmerge_group(&dev->kobj, &pm_qos_latency_tolerance_attr_group); in dpm_sysfs_add()
730 sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); in dpm_sysfs_add()
732 sysfs_unmerge_group(&dev->kobj, &pm_runtime_attr_group); in dpm_sysfs_add()
734 sysfs_remove_group(&dev->kobj, &pm_attr_group); in dpm_sysfs_add()
745 rc = sysfs_group_change_owner(&dev->kobj, &pm_attr_group, kuid, kgid); in dpm_sysfs_change_owner()
751 &dev->kobj, &pm_runtime_attr_group, kuid, kgid); in dpm_sysfs_change_owner()
757 rc = sysfs_group_change_owner(&dev->kobj, &pm_wakeup_attr_group, in dpm_sysfs_change_owner()
767 if (dev->power.set_latency_tolerance) { in dpm_sysfs_change_owner()
769 &dev->kobj, &pm_qos_latency_tolerance_attr_group, kuid, in dpm_sysfs_change_owner()
779 int ret = sysfs_merge_group(&dev->kobj, &pm_wakeup_attr_group); in wakeup_sysfs_add()
782 kobject_uevent(&dev->kobj, KOBJ_CHANGE); in wakeup_sysfs_add()
789 sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); in wakeup_sysfs_remove()
790 kobject_uevent(&dev->kobj, KOBJ_CHANGE); in wakeup_sysfs_remove()
795 return sysfs_merge_group(&dev->kobj, &pm_qos_resume_latency_attr_group); in pm_qos_sysfs_add_resume_latency()
800 sysfs_unmerge_group(&dev->kobj, &pm_qos_resume_latency_attr_group); in pm_qos_sysfs_remove_resume_latency()
805 return sysfs_merge_group(&dev->kobj, &pm_qos_flags_attr_group); in pm_qos_sysfs_add_flags()
810 sysfs_unmerge_group(&dev->kobj, &pm_qos_flags_attr_group); in pm_qos_sysfs_remove_flags()
815 return sysfs_merge_group(&dev->kobj, in pm_qos_sysfs_add_latency_tolerance()
821 sysfs_unmerge_group(&dev->kobj, &pm_qos_latency_tolerance_attr_group); in pm_qos_sysfs_remove_latency_tolerance()
826 sysfs_unmerge_group(&dev->kobj, &pm_runtime_attr_group); in rpm_sysfs_remove()
833 sysfs_unmerge_group(&dev->kobj, &pm_qos_latency_tolerance_attr_group); in dpm_sysfs_remove()
836 sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); in dpm_sysfs_remove()
837 sysfs_remove_group(&dev->kobj, &pm_attr_group); in dpm_sysfs_remove()