Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\suspend_test.c Create Date:2022-07-28 09:58:33
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:To test system suspend, we need a hands-off mechanism to resume the* system. RTCs wake alarms are a common self-contained mechanism.

Proto:static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)

Type:void

Parameter:

TypeParameterName
struct rtc_device *rtc
suspend_state_tstate
64  static char err_readtime[] __initdata = r conditions  "PM: can't read %s time, err %d\n"
66  static char err_wakealarm[] __initdata = r conditions  "PM: can't set %s wakealarm, err %d\n"
68  static char err_suspend[] __initdata = r conditions  "PM: suspend test failed, error %d\n"
70  static char info_test[] __initdata = formational  "PM: test RTC wakeup from '%s' suspend\n"
78  repeat :
79  status = rtc_read_time(rtc, & ime the alarm is set to )
80  If status < 0 Then
81  printk(err_readtime, dev_name( & dev), status)
82  Return
84  rtc_tm_to_time( & ime the alarm is set to , & now)
86  memset( & alm, 0, sizeofalm)
87  rtc_time_to_tm(now + We test the system suspend code by setting an RTC wakealarm a short* time in the future, then suspending, & ime the alarm is set to )
88  0 = alarm disabled, 1 = alarm enabled = true
90  status = rtc_set_alarm(rtc, & alm)
91  If status < 0 Then
92  printk(err_wakealarm, dev_name( & dev), status)
93  Return
96  If state == PM_SUSPEND_MEM Then
97  printk(info_test, pm_states[state])
98  status = pm_suspend - Externally visible function for suspending the system.*@state: System sleep state to enter.* Check if the value of @state represents one of the supported states,* execute enter_state() and update system suspend statistics.
99  If status == -ENODEV Then state = PM_SUSPEND_STANDBY
102  If state == PM_SUSPEND_STANDBY Then
103  printk(info_test, pm_states[state])
104  status = pm_suspend - Externally visible function for suspending the system.*@state: System sleep state to enter.* Check if the value of @state represents one of the supported states,* execute enter_state() and update system suspend statistics.
105  If status < 0 Then state = PM_SUSPEND_TO_IDLE
108  If state == PM_SUSPEND_TO_IDLE Then
109  printk(info_test, pm_states[state])
110  status = pm_suspend - Externally visible function for suspending the system.*@state: System sleep state to enter.* Check if the value of @state represents one of the supported states,* execute enter_state() and update system suspend statistics.
113  If status < 0 Then printk(err_suspend, status)
116  test_repeat_count_current++
117  If test_repeat_count_current < test_repeat_count_max Then Go to repeat
124  0 = alarm disabled, 1 = alarm enabled = false
125  rtc_set_alarm(rtc, & alm)
Caller
NameDescribe
test_suspend