Lines Matching +full:line +full:- +full:name
2 # SPDX-License-Identifier: GPL-2.0
6 CONFIGFS_DIR="/sys/kernel/config/gpio-sim"
7 MODULE="gpio-sim"
26 if [ "$BANK" = "live" -o "$BANK" = "dev_name" ]; then
30 LINES=`ls $CONFIGFS_DIR/$CHIP/$BANK/ | grep -E ^line`
32 for LINE in $LINES; do
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 || \
39 fail "Unable to remove the line"
89 local NAME=$4
90 local LINE_DIR=$CONFIGFS_DIR/$CHIP/$BANK/line$OFFSET
92 test -d $LINE_DIR || mkdir $LINE_DIR
93 echo $NAME > $LINE_DIR/name || fail "Unable to set the line name"
113 fail "unable to read the chip name from configfs"
120 fail "unable to read the device name from configfs"
127 $BASE_DIR/gpio-chip-info /dev/`configfs_chip_name $CHIP $BANK` num-lines || \
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 || \
145 fail "unable to read the line name from the character device"
157 echo $PULL > $SYSFS_PATH || fail "Unable to set line pull in sysfs"
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
179 echo "1.1. Chip name is communicated to user"
183 test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work"
193 echo "1.3. Device name is communicated to user"
197 test -n `cat $CONFIGFS_DIR/chip/dev_name` || fail "dev_name doesn't work"
229 test -z "`cat $CONFIGFS_DIR/chip/bank/label`" || fail "label is not empty"
232 echo "2.5. Line names can be configured"
239 test "`get_line_name chip bank 0`" = "foo" || fail "line name is incorrect"
240 test "`get_line_name chip bank 2`" = "bar" || fail "line name is incorrect"
243 echo "2.6. Line config can remain unused if offset is greater than number of lines"
249 test "`get_line_name chip bank 0`" = "" || fail "line name is incorrect"
250 test "`get_line_name chip bank 1`" = "" || fail "line name is incorrect"
253 echo "2.7. Line configfs directory names are sanitized"
257 fail "invalid configfs line name accepted"
259 fail "invalid configfs line name accepted"
283 echo "2.10. Can't create line items when chip is live"
287 mkdir $CONFIGFS_DIR/chip/bank/line0 2> /dev/null && fail "Creating line item should fail"
290 echo "2.11. Probe errors are propagated to user-space"
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 && \
318 fail "Setting the value of a hogged line shouldn't succeed"
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"
381 $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 0 &
395 $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0