10 #include <linux/rtc.h>
22 #define TEST_SUSPEND_SECONDS 10
24 static unsigned long suspend_test_start_time;
32 suspend_test_start_time =
jiffies;
37 long nj =
jiffies - suspend_test_start_time;
41 pr_info(
"PM: %s took %d.%03d seconds\n", label,
42 msec / 1000, msec % 1000);
53 "Component: %s, time: %u\n", label, msec);
64 KERN_ERR "PM: can't read %s time, err %d\n";
65 static char err_wakealarm [] __initdata =
66 KERN_ERR "PM: can't set %s wakealarm, err %d\n";
67 static char err_suspend[] __initdata =
68 KERN_ERR "PM: suspend test failed, error %d\n";
69 static char info_test[] __initdata =
70 KERN_INFO "PM: test RTC wakeup from '%s' suspend\n";
79 printk(err_readtime, dev_name(&rtc->
dev), status);
84 memset(&alm, 0,
sizeof alm);
90 printk(err_wakealarm, dev_name(&rtc->
dev), status);
105 printk(err_suspend, status);
119 if (!candidate->
ops->set_alarm)
121 if (!device_may_wakeup(candidate->
dev.parent))
124 *(
const char **)name_ptr = dev_name(dev);
135 static char warn_bad_state[] __initdata =
152 printk(warn_bad_state, value);
155 __setup(
"test_suspend", setup_test_suspend);
157 static int __init test_suspend(
void)
159 static char warn_no_rtc[] __initdata =
160 KERN_WARNING "PM: no wakealarm-capable RTC driver is ready\n";