Lines Matching +full:gpio +full:- +full:key
2 # SPDX-License-Identifier: GPL-2.0
7 CONFIGFS_SIM_DIR="/sys/kernel/config/gpio-sim"
8 CONFIGFS_AGG_DIR="/sys/kernel/config/gpio-aggregator"
9 SYSFS_AGG_DIR="/sys/bus/platform/drivers/gpio-aggregator"
10 MODULE="gpio-aggregator"
14 echo "GPIO $MODULE test FAIL"
20 echo "GPIO $MODULE test SKIP"
24 # gpio-sim
38 local NOCHECK=${1:-0}
41 [ -d "$CHIP_DIR" ] || continue
43 find "$CHIP_DIR" -depth -type d -exec rmdir {} \;
45 [ "$NOCHECK" -eq 1 ] && return;
46 remaining=$(find "$CONFIGFS_SIM_DIR" -mindepth 1 -type d 2> /dev/null)
47 if [ -n "$remaining" ]; then
58 $BASE_DIR/gpio-chip-info "/dev/$CHIP_NAME" label || \
62 # gpio-aggregator
72 find "$CONFIGFS_AGG_DIR/$CHIP/" -depth -type d -exec rmdir {} \; || \
93 local KEY=$3
95 echo "$KEY" > "$CONFIGFS_AGG_DIR/$CHIP/$LINE/key" || fail "Unable to set the lookup key"
128 local NOCHECK=${1:-0}
131 [ -d "$CHIP_DIR" ] || continue
133 find "$CHIP_DIR" -depth -type d -exec rmdir {} \;
135 [ "$NOCHECK" -eq 1 ] && return;
136 remaining=$(find "$CONFIGFS_AGG_DIR" -mindepth 1 -type d 2> /dev/null)
137 if [ -n "$remaining" ]; then
153 -maxdepth 1 -type d -name "gpiochip[0-9]*" 2> /dev/null)
154 local CHIP_COUNT=$(echo "$CHIP_LIST" | wc -l)
156 if [ -z "$CHIP_LIST" ]; then
158 elif [ "$CHIP_COUNT" -ne 1 ]; then
166 local N_DIR=$(ls -d $CONFIGFS_AGG_DIR/$CHIP/line[0-9]* 2> /dev/null | wc -l)
173 $BASE_DIR/gpio-chip-info \
174 "/dev/$(agg_configfs_chip_name "$CHIP")" num-lines
186 $BASE_DIR/gpio-chip-info "/dev/$(agg_configfs_chip_name "$CHIP")" label || \
200 $BASE_DIR/gpio-line-name \
212 modprobe gpio-sim || skip "unable to load the gpio-sim module"
213 modprobe gpio-aggregator || skip "unable to load the gpio-aggregator module"
217 if [ "$IDX" -eq "5" ]; then
221 mountpoint -q /sys/kernel/config && break
232 # Use gpio-sim chips as the test backend
233 for CHIP in $(seq -f "chip%g" 0 1); do
235 for BANK in $(seq -f "bank%g" 0 1); do
236 mkdir -p "$CONFIGFS_SIM_DIR/$CHIP/$BANK"
244 mkdir -p $LINE_DIR
251 echo "1. GPIO aggregator creation/deletion"
353 test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
354 test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
357 echo "chip0bank0_0 chip1_bank1 10-11" > "$SYSFS_AGG_DIR/new_device"
367 test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
368 test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
384 test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
385 test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
392 echo "2. GPIO aggregator configuration"
423 echo "2.1.1.2. Line key can be modified"
449 echo "2.1.1.5. Can re-enable a chip after valid reconfiguration"
463 echo "2.1.1.7. Can't re-enable a chip with invalid reconfiguration"
483 echo "2.1.2.2. Can't modify line key"
485 echo "chip1_bank1" > "$CONFIGFS_AGG_DIR/agg0/line0/key" 2> /dev/null && \
486 fail "lookup key unexpectedly updated"
523 echo "2.2.1.3. Can't modify line key"
525 echo "chip1_bank1" > "$CONFIGFS_AGG_DIR/_sysfs.0/line0/key" 2> /dev/null && \
526 fail "lookup key unexpectedly updated"
551 echo "2.2.2.2. Can't modify line key"
554 echo "chip1_bank1" > "$CONFIGFS_AGG_DIR/_sysfs.0/line0/key" 2> /dev/null && \
555 fail "lookup key unexpectedly updated"
592 echo "2.2.3.2. Line key can be modified"
618 echo "2.2.3.5. Can re-enable a chip with valid reconfiguration"
628 echo "2.2.3.6. Can't re-enable a chip with invalid reconfiguration"
644 modprobe -r gpio-aggregator 2> /dev/null
645 test -d /sys/module/gpio_aggregator || fail "module unexpectedly unloaded"
650 modprobe -r gpio-aggregator 2> /dev/null
651 test -d /sys/module/gpio_aggregator && fail "module unexpectedly remains to be loaded"
652 modprobe gpio-aggregator 2> /dev/null
654 echo "4. GPIO forwarder functional"
660 CHIP=$(echo "$SETTING" | cut -d: -f1)
661 BANK=$(echo "$SETTING" | cut -d: -f2)
662 LINE=$(echo "$SETTING" | cut -d: -f3)
678 CHIP=$(echo "$SETTING" | cut -d: -f1)
679 BANK=$(echo "$SETTING" | cut -d: -f2)
680 LINE=$(echo "$SETTING" | cut -d: -f3)
685 $BASE_DIR/gpio-mockup-cdev -s 1 "/dev/$(agg_configfs_chip_name agg0)" "$OFFSET" &
698 CHIP=$(echo "$SETTING" | cut -d: -f1)
699 BANK=$(echo "$SETTING" | cut -d: -f2)
700 LINE=$(echo "$SETTING" | cut -d: -f3)
704 $BASE_DIR/gpio-mockup-cdev -b pull-up "/dev/$(agg_configfs_chip_name agg0)" "$OFFSET"
720 while kill -0 "$writer_pid" 2> /dev/null; do
722 modprobe gpio-aggregator
723 modprobe -r gpio-aggregator
727 echo "GPIO $MODULE test PASS"