Lines Matching +full:bank +full:- +full:number

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"
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
54 local BANK=$2
55 local CHIP_NAME=$(cat "$CONFIGFS_SIM_DIR/$CHIP/$BANK/chip_name" 2> /dev/null) || \
58 $BASE_DIR/gpio-chip-info "/dev/$CHIP_NAME" label || \
62 # gpio-aggregator
72 find "$CONFIGFS_AGG_DIR/$CHIP/" -depth -type d -exec rmdir {} \; || \
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
175 ) || fail "Unable to read the number of lines from the character device"
177 fail "Discrepancy between two sources for the number of 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"
237 echo "${CHIP}_${BANK}" > "$CONFIGFS_SIM_DIR/$CHIP/$BANK/label" || \
239 echo 16 > "$CONFIGFS_SIM_DIR/$CHIP/$BANK/num_lines" || \
240 fail "unable to set the number of lines"
242 LINE_NAME="${CHIP}${BANK}_${IDX}"
243 LINE_DIR="$CONFIGFS_SIM_DIR/$CHIP/$BANK/line$IDX"
244 mkdir -p $LINE_DIR
265 test "$(agg_get_chip_num_lines agg0)" = "1" || fail "number of lines is not 1"
293 test "$(agg_get_chip_num_lines agg0)" = "4" || fail "number of lines is not 1"
350 test "$(agg_get_chip_num_lines _sysfs.0)" = "1" || fail "number of lines is not 1"
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"
362 test "$(agg_get_chip_num_lines _sysfs.0)" = "3" || fail "number of lines is not 3"
367 test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
368 test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
381 test "$(agg_get_chip_num_lines _sysfs.0)" = "1" || fail "number of lines is not 1"
384 test -d $CONFIGFS_AGG_DIR/_sysfs.0 && fail "_sysfs.0 unexpectedly remains"
385 test -d /dev/${CHIPNAME} && fail "/dev/${CHIPNAME} unexpectedly remains"
420 test "$(agg_get_chip_num_lines agg0)" = "3" || fail "number of lines is not 1"
449 echo "2.1.1.5. Can re-enable a chip after valid reconfiguration"
460 test "$(agg_get_chip_num_lines agg0)" = "3" || fail "number of lines is not 1"
463 echo "2.1.1.7. Can't re-enable a chip with invalid reconfiguration"
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
660 CHIP=$(echo "$SETTING" | cut -d: -f1)
661 BANK=$(echo "$SETTING" | cut -d: -f2)
662 LINE=$(echo "$SETTING" | cut -d: -f3)
664 agg_set_key agg0 "line${OFFSET}" "$(sim_get_chip_label "$CHIP" "$BANK")"
678 CHIP=$(echo "$SETTING" | cut -d: -f1)
679 BANK=$(echo "$SETTING" | cut -d: -f2)
680 LINE=$(echo "$SETTING" | cut -d: -f3)
682 CHIPNAME=$(cat "$CONFIGFS_SIM_DIR/$CHIP/$BANK/chip_name")
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)
702 CHIPNAME=$(cat "$CONFIGFS_SIM_DIR/$CHIP/$BANK/chip_name")
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