Lines Matching +full:gpio +full:- +full:lines
2 # SPDX-License-Identifier: GPL-2.0
6 CONFIGFS_DIR="/sys/kernel/config/gpio-sim"
7 MODULE="gpio-sim"
11 echo "GPIO $MODULE test FAIL"
17 echo "GPIO $MODULE test SKIP"
26 if [ "$BANK" = "live" -o "$BANK" = "dev_name" ]; then
30 LINES=`ls $CONFIGFS_DIR/$CHIP/$BANK/ | egrep ^line`
32 for LINE in $LINES; do
33 if [ -e $CONFIGFS_DIR/$CHIP/$BANK/$LINE/hog ]; then
82 fail "Unable to set the number of lines"
92 test -d $LINE_DIR || mkdir $LINE_DIR
127 $BASE_DIR/gpio-chip-info /dev/`configfs_chip_name $CHIP $BANK` num-lines || \
128 fail "unable to read the number of lines from the character device"
135 $BASE_DIR/gpio-chip-info /dev/`configfs_chip_name $CHIP $BANK` label || \
144 $BASE_DIR/gpio-line-name /dev/`configfs_chip_name $CHIP $BANK` $OFFSET || \
160 # Load the gpio-sim module. This will pull in configfs if needed too.
161 modprobe gpio-sim || skip "unable to load the gpio-sim module"
164 if [ "$IDX" -eq "5" ]; then
168 mountpoint -q /sys/kernel/config && break
183 test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work"
197 test -n `cat $CONFIGFS_DIR/chip/dev_name` || fail "dev_name doesn't work"
202 echo "2.1. Default number of lines is 1"
206 test "`get_chip_num_lines chip bank`" = "1" || fail "default number of lines is not 1"
209 echo "2.2. Number of lines can be specified"
214 test "`get_chip_num_lines chip bank`" = "16" || fail "number of lines is not 16"
229 test -z "`cat $CONFIGFS_DIR/chip/bank/label`" || fail "label is not empty"
243 echo "2.6. Line config can remain unused if offset is greater than number of lines"
280 fail "Setting number of lines of a live chip should fail"
290 echo "2.11. Probe errors are propagated to user-space"
297 echo "2.12. Cannot enable a chip without any GPIO banks"
299 echo 1 > $CONFIGFS_DIR/chip/live 2> /dev/null && fail "Chip enabled without any GPIO banks"
311 echo "2.14. Lines can be hogged"
315 mkdir -p $CONFIGFS_DIR/chip/bank/line4/hog
317 $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 4 2> /dev/null && \
328 sysfs_set_pull chip bank 0 pull-up
329 $BASE_DIR/gpio-mockup-cdev /dev/`configfs_chip_name chip bank` 0
331 sysfs_set_pull chip bank 0 pull-down
332 $BASE_DIR/gpio-mockup-cdev /dev/`configfs_chip_name chip bank` 1
344 test `cat $SYSFS_PATH` = "pull-down" || fail "reading the pull failed"
345 sysfs_set_pull chip bank 0 pull-up
346 test `cat $SYSFS_PATH` = "pull-up" || fail "reading the pull failed"
370 echo "4. Simulated GPIO chips are functional"
381 $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 0 &
392 $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0
396 echo "GPIO $MODULE test PASS"