Lines Matching +full:bank +full:- +full:name

2 # SPDX-License-Identifier: GPL-2.0
6 CONFIGFS_DIR="/sys/kernel/config/gpio-sim"
7 MODULE="gpio-sim"
25 BANK=`basename $FILE`
26 if [ "$BANK" = "live" -o "$BANK" = "dev_name" ]; then
30 LINES=`ls $CONFIGFS_DIR/$CHIP/$BANK/ | grep -E ^line`
33 if [ -e $CONFIGFS_DIR/$CHIP/$BANK/$LINE/hog ]; then
34 rmdir $CONFIGFS_DIR/$CHIP/$BANK/$LINE/hog || \
38 rmdir $CONFIGFS_DIR/$CHIP/$BANK/$LINE || \
43 rmdir $CONFIGFS_DIR/$CHIP/$BANK
57 local BANK=$2
59 mkdir $CONFIGFS_DIR/$CHIP/$BANK
64 local BANK=$2
67 echo $LABEL > $CONFIGFS_DIR/$CHIP/$BANK/label || fail "Unable to set the chip label"
72 local BANK=$2
75 echo $NUM_LINES > $CONFIGFS_DIR/$CHIP/$BANK/num_lines || \
81 local BANK=$2
83 local NAME=$4
84 local LINE_DIR=$CONFIGFS_DIR/$CHIP/$BANK/line$OFFSET
86 test -d $LINE_DIR || mkdir $LINE_DIR
87 echo $NAME > $LINE_DIR/name || fail "Unable to set the line name"
111 local BANK=$2
113 cat $CONFIGFS_DIR/$CHIP/$BANK/chip_name 2> /dev/null || \
114 fail "unable to read the chip name from configfs"
121 fail "unable to read the device name from configfs"
126 local BANK=$2
128 $BASE_DIR/gpio-chip-info /dev/`configfs_chip_name $CHIP $BANK` num-lines || \
134 local BANK=$2
136 $BASE_DIR/gpio-chip-info /dev/`configfs_chip_name $CHIP $BANK` label || \
142 local BANK=$2
145 $BASE_DIR/gpio-line-name /dev/`configfs_chip_name $CHIP $BANK` $OFFSET || \
146 fail "unable to read the line name from the character device"
151 local BANK=$2
155 local CHIPNAME=`configfs_chip_name $DEV $BANK`
161 # Load the gpio-sim module. This will pull in configfs if needed too.
162 modprobe gpio-sim || skip "unable to load the gpio-sim module"
165 if [ "$IDX" -eq "5" ]; then
169 mountpoint -q /sys/kernel/config && break
180 echo "1.1. Chip name is communicated to user"
182 create_bank chip bank
184 test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work"
190 create_bank chip bank
191 test "`cat $CONFIGFS_DIR/chip/bank/chip_name`" = "none" || \
195 echo "1.3. Device name is communicated to user"
197 create_bank chip bank
199 test -n `cat $CONFIGFS_DIR/chip/dev_name` || fail "dev_name doesn't work"
207 create_bank chip bank
209 test "`get_chip_num_lines chip bank`" = "1" || fail "default number of lines is not 1"
215 create_bank chip bank
216 set_num_lines chip bank 16
218 test "`get_chip_num_lines chip bank`" = "16" || fail "number of lines is not 16"
224 create_bank chip bank
225 set_label chip bank foobar
227 test "`get_chip_label chip bank`" = "foobar" || fail "label is incorrect"
233 create_bank chip bank
235 test -z "`cat $CONFIGFS_DIR/chip/bank/label`" || fail "label is not empty"
241 create_bank chip bank
242 set_num_lines chip bank 16
243 set_line_name chip bank 0 foo
244 set_line_name chip bank 2 bar
246 test "`get_line_name chip bank 0`" = "foo" || fail "line name is incorrect"
247 test "`get_line_name chip bank 2`" = "bar" || fail "line name is incorrect"
253 create_bank chip bank
254 set_num_lines chip bank 2
255 set_line_name chip bank 5 foobar
257 test "`get_line_name chip bank 0`" = "" || fail "line name is incorrect"
258 test "`get_line_name chip bank 1`" = "" || fail "line name is incorrect"
264 create_bank chip bank
265 mkdir $CONFIGFS_DIR/chip/bank/line12foobar 2> /dev/null && \
266 fail "invalid configfs line name accepted"
267 mkdir $CONFIGFS_DIR/chip/bank/line_no_offset 2> /dev/null && \
268 fail "invalid configfs line name accepted"
275 create_bank $CHIP bank
285 create_bank chip bank
287 echo foobar > $CONFIGFS_DIR/chip/bank/label 2> /dev/null && \
289 echo 8 > $CONFIGFS_DIR/chip/bank/num_lines 2> /dev/null && \
296 create_bank chip bank
298 mkdir $CONFIGFS_DIR/chip/bank/line0 2> /dev/null && fail "Creating line item should fail"
302 echo "2.11. Probe errors are propagated to user-space"
304 create_bank chip bank
305 set_num_lines chip bank 99999
325 create_bank chip bank
326 set_num_lines chip bank 8
327 mkdir -p $CONFIGFS_DIR/chip/bank/line4/hog
329 $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 4 2> /dev/null && \
338 create_bank chip bank
339 set_num_lines chip bank 8
341 sysfs_set_pull chip bank 0 pull-up
342 $BASE_DIR/gpio-mockup-cdev /dev/`configfs_chip_name chip bank` 0
344 sysfs_set_pull chip bank 0 pull-down
345 $BASE_DIR/gpio-mockup-cdev /dev/`configfs_chip_name chip bank` 1
352 create_bank chip bank
353 set_num_lines chip bank 8
356 CHIPNAME=`configfs_chip_name chip bank`
358 test `cat $SYSFS_PATH` = "pull-down" || fail "reading the pull failed"
359 sysfs_set_pull chip bank 0 pull-up
360 test `cat $SYSFS_PATH` = "pull-up" || fail "reading the pull failed"
366 create_bank chip bank
367 set_num_lines chip bank 8
370 CHIPNAME=`configfs_chip_name chip bank`
378 create_bank chip bank
381 CHIPNAME=`configfs_chip_name chip bank`
391 create_bank chip bank
392 set_num_lines chip bank 8
395 CHIPNAME=`configfs_chip_name chip bank`
398 $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 0 &
407 create_bank chip bank
408 set_num_lines chip bank 8
411 CHIPNAME=`configfs_chip_name chip bank`
413 $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0