Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) #!/bin/bash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) # SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) # udelay() test script
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) # Test is executed by writing and reading to /sys/kernel/debug/udelay_test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) # and exercises a variety of delays to ensure that udelay() is delaying
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) # at least as long as requested (as compared to ktime).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # Copyright (C) 2014 Google, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) MODULE_NAME=udelay_test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) UDELAY_PATH=/sys/kernel/debug/udelay_test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) setup()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	/sbin/modprobe -q $MODULE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	tmp_file=`mktemp`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) test_one()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	delay=$1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	echo $delay > $UDELAY_PATH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	tee -a $tmp_file < $UDELAY_PATH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) cleanup()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	if [ -f $tmp_file ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		rm $tmp_file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	/sbin/modprobe -q -r $MODULE_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) trap cleanup EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) # Delay for a variety of times.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) # 1..200, 200..500 (by 10), 500..2000 (by 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) for (( delay = 1; delay < 200; delay += 1 )); do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	test_one $delay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) for (( delay = 200; delay < 500; delay += 10 )); do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	test_one $delay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) for (( delay = 500; delay <= 2000; delay += 100 )); do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	test_one $delay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) # Search for failures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) count=`grep -c FAIL $tmp_file`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) if [ $? -eq "0" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	echo "ERROR: $count delays failed to delay long enough"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	retcode=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) exit $retcode