Skip to content

Commit 0b631ed

Browse files
Shreeya Patelshuahkh
authored andcommitted
kselftest: cpufreq: Add RTC wakeup alarm
Add RTC wakeup alarm for devices to resume after specific time interval. This improvement in the test will help in enabling this test in the CI systems and will eliminate the need of manual intervention for resuming back the devices after suspend/hibernation. Signed-off-by: Shreeya Patel <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 37ee7d1 commit 0b631ed

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

tools/testing/selftests/cpufreq/cpufreq.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,21 @@ do_suspend()
231231

232232
for i in `seq 1 $2`; do
233233
printf "Starting $1\n"
234+
235+
if [ "$3" = "rtc" ]; then
236+
if ! command -v rtcwake &> /dev/null; then
237+
printf "rtcwake could not be found, please install it.\n"
238+
return 1
239+
fi
240+
241+
rtcwake -m $filename -s 15
242+
243+
if [ $? -ne 0 ]; then
244+
printf "Failed to suspend using RTC wake alarm\n"
245+
return 1
246+
fi
247+
fi
248+
234249
echo $filename > $SYSFS/power/state
235250
printf "Came out of $1\n"
236251

tools/testing/selftests/cpufreq/main.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ helpme()
2424
[-t <basic: Basic cpufreq testing
2525
suspend: suspend/resume,
2626
hibernate: hibernate/resume,
27+
suspend_rtc: suspend/resume back using the RTC wakeup alarm,
28+
hibernate_rtc: hibernate/resume back using the RTC wakeup alarm,
2729
modtest: test driver or governor modules. Only to be used with -d or -g options,
2830
sptest1: Simple governor switch to produce lockdep.
2931
sptest2: Concurrent governor switch to produce lockdep.
@@ -76,7 +78,8 @@ parse_arguments()
7678
helpme
7779
;;
7880

79-
t) # --func_type (Function to perform: basic, suspend, hibernate, modtest, sptest1/2/3/4 (default: basic))
81+
t) # --func_type (Function to perform: basic, suspend, hibernate,
82+
# suspend_rtc, hibernate_rtc, modtest, sptest1/2/3/4 (default: basic))
8083
FUNC=$OPTARG
8184
;;
8285

@@ -121,6 +124,14 @@ do_test()
121124
do_suspend "hibernate" 1
122125
;;
123126

127+
"suspend_rtc")
128+
do_suspend "suspend" 1 rtc
129+
;;
130+
131+
"hibernate_rtc")
132+
do_suspend "hibernate" 1 rtc
133+
;;
134+
124135
"modtest")
125136
# Do we have modules in place?
126137
if [ -z $DRIVER_MOD ] && [ -z $GOVERNOR_MOD ]; then

0 commit comments

Comments
 (0)