Skip to content
Snippets Groups Projects
Commit 6b9c8c0b authored by Jonas Höppner's avatar Jonas Höppner
Browse files

SANTINO_LT I2C Keypad, adapt test scripts

* The testsscripts now handle santino-lt correctly
* refs #30460

Change-Id: I7d9b13daf38d772b736efc929aa16a18f667dc94
parent 53e35c29
No related branches found
No related tags found
No related merge requests found
...@@ -8,16 +8,31 @@ gpio_cs=$(echo 10 6 4) ...@@ -8,16 +8,31 @@ gpio_cs=$(echo 10 6 4)
sysfs_path=/sys/class/gpio/ sysfs_path=/sys/class/gpio/
sysfs_pre=keypad_pin sysfs_pre=keypad_pin
#======== Santino-LT special handling ======== #======== Santino/Santino-lt special handling ========
is_machine_santino_lt(){ is_machine_santino_lt(){
grep -q santino-lt /etc/machine [ x"santino-lt" == x"$(cat /etc/machine)" ]
}
is_machine_santino(){
[ x"santino" == x"$(cat /etc/machine)" ]
}
is_machine_santaro(){
[ x"santaro" == x"$(cat /etc/machine)" ]
}
is_machine_santoka(){
[ x"santoka" == x"$(cat /etc/machine)" ]
} }
if is_machine_santino_lt; if is_machine_santino_lt;
then then
low_pins=$(echo {3..5}) low_pins=$(echo {3..5})
high_pins=$(echo {6..8}) high_pins=$(echo {6..8})
all_pins=$(echo {3..8}) all_pins=$(echo {3..8})
fi
if is_machine_santino;
then
low_pins=$(echo {3..5})
high_pins=$(echo {6..8})
all_pins=$(echo {3..8})
fi fi
...@@ -27,7 +42,6 @@ EAGAIN="11" ...@@ -27,7 +42,6 @@ EAGAIN="11"
#======== Helper Functions ======== #======== Helper Functions ========
# #
get_boot_partition() { get_boot_partition() {
mountpoint=$(mount | grep mmcblk0p2) mountpoint=$(mount | grep mmcblk0p2)
if [ -z "$mountpoint" ]; if [ -z "$mountpoint" ];
...@@ -44,7 +58,9 @@ get_boot_partition() { ...@@ -44,7 +58,9 @@ get_boot_partition() {
} }
set_keypad_vcc() { set_keypad_vcc() {
# Those don't hace a switchable vcc on the keypad
if is_machine_santino_lt;then return 0; fi if is_machine_santino_lt;then return 0; fi
if is_machine_santino;then return 0; fi
echo $1 > ${sysfs_path}keypad_vcc/value echo $1 > ${sysfs_path}keypad_vcc/value
} }
...@@ -60,9 +76,25 @@ remove_keypad_option() { ...@@ -60,9 +76,25 @@ remove_keypad_option() {
} }
get_keypad_option() { get_keypad_option() {
dmesg | grep "Kernel command line" | sed -n 's/.*keypad=\([^ ^$]*\).*/\1/p' sed -n 's/.*keypad=\([^ ^$]*\).*/\1/p' /proc/cmdline
} }
test_keypad_option_or_set_and_reboot() {
KP_OPTION="$1"
if is_machine_santino; then return; fi
if is_machine_santino_lt; then return; fi
if [ x"$KP_OPTION" != x"$(get_keypad_option)" ];
then
echo Wrong options in kernel command line, reboot to start with correct options.
set_keypad_option $KP_OPTION
sync
reboot
exit "$EAGAIN";
fi
}
set_pin() { set_pin() {
echo $2 > ${sysfs_path}${sysfs_pre}$1/value; echo $2 > ${sysfs_path}${sysfs_pre}$1/value;
} }
......
...@@ -24,6 +24,13 @@ test_cmds=( ...@@ -24,6 +24,13 @@ test_cmds=(
"$script_path/test_keypad_spi" "$script_path/test_keypad_spi"
"$script_path/test_keypad_cleanup" "$script_path/test_keypad_cleanup"
) )
if is_machine_santino_lt;then
test_cmds=(
"$script_path/test_keypad_gpio"
"$script_path/test_keypad_i2c"
"$script_path/test_keypad_cleanup"
)
fi
test_cnt=${#test_cmds[@]} test_cnt=${#test_cmds[@]}
echo "Waiting 4 seconds" echo "Waiting 4 seconds"
......
...@@ -11,19 +11,7 @@ outerror() { ...@@ -11,19 +11,7 @@ outerror() {
exit 1 exit 1
} }
# Santino-lt does not have special options test_keypad_option_or_set_and_reboot $KP_OPTION
if ! is_machine_santino_lt;
then
if [ x"$KP_OPTION" != x"$(get_keypad_option)" ];
then
echo Wrong options in kernel command line, reboot to start with correct options.
set_keypad_option $KP_OPTION
sync
reboot
exit "$EAGAIN";
fi
fi
# Setup arrays # Setup arrays
......
...@@ -5,9 +5,9 @@ source /opt/ltp/scripts/functions ...@@ -5,9 +5,9 @@ source /opt/ltp/scripts/functions
KP_OPTION="i2c" KP_OPTION="i2c"
dut=/dev/i2c-1 dut=/dev/i2c-1
if is_machine_santino_lt if is_machine_santino
then then
dut=/dev/i2c-2 dut=/dev/i2c-0
fi fi
TEST_CMD="/opt/ltp/testcases/bin/i2c" TEST_CMD="/opt/ltp/testcases/bin/i2c"
...@@ -19,14 +19,7 @@ outerror() { ...@@ -19,14 +19,7 @@ outerror() {
exit 1 exit 1
} }
if [ x"$KP_OPTION" != x"$(get_keypad_option)" ]; test_keypad_option_or_set_and_reboot $KP_OPTION
then
echo Wrong options in kernel command line, reboot to start with correct options.
set_keypad_option $KP_OPTION
sync
reboot
exit "$EAGAIN";
fi
#All GPIOs as input, VCC on #All GPIOs as input, VCC on
......
...@@ -16,15 +16,7 @@ outerror() { ...@@ -16,15 +16,7 @@ outerror() {
exit 1 exit 1
} }
if [ x"$KP_OPTION" != x"$(get_keypad_option)" ]; test_keypad_option_or_set_and_reboot $KP_OPTION
then
echo Wrong options in kernel command line, reboot to start with correct options.
set_keypad_option $KP_OPTION
sync
reboot
exit "$EAGAIN";
fi
#All GPIOs as input, VCC on #All GPIOs as input, VCC on
set_dir_all in; set_dir_all in;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment