Lines Matching full:chip
22 local CHIP=$1
24 for FILE in $CONFIGFS_DIR/$CHIP/*; do
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
46 rmdir $CONFIGFS_DIR/$CHIP || fail "Unable to remove the chip"
50 for CHIP in `ls $CONFIGFS_DIR/`; do
51 remove_chip $CHIP
56 local CHIP=$1
58 mkdir $CONFIGFS_DIR/$CHIP
62 local CHIP=$1
65 mkdir $CONFIGFS_DIR/$CHIP/$BANK
69 local CHIP=$1
73 echo $LABEL > $CONFIGFS_DIR/$CHIP/$BANK/label || fail "Unable to set the chip label"
77 local CHIP=$1
81 echo $NUM_LINES > $CONFIGFS_DIR/$CHIP/$BANK/num_lines || \
86 local CHIP=$1
90 local LINE_DIR=$CONFIGFS_DIR/$CHIP/$BANK/line$OFFSET
97 local CHIP=$1
99 echo 1 > $CONFIGFS_DIR/$CHIP/live || fail "Unable to enable the chip"
103 local CHIP=$1
105 echo 0 > $CONFIGFS_DIR/$CHIP/live || fail "Unable to disable the chip"
109 local CHIP=$1
112 cat $CONFIGFS_DIR/$CHIP/$BANK/chip_name 2> /dev/null || \
113 fail "unable to read the chip name from configfs"
117 local CHIP=$1
119 cat $CONFIGFS_DIR/$CHIP/dev_name 2> /dev/null || \
124 local CHIP=$1
127 $BASE_DIR/gpio-chip-info /dev/`configfs_chip_name $CHIP $BANK` num-lines || \
132 local CHIP=$1
135 $BASE_DIR/gpio-chip-info /dev/`configfs_chip_name $CHIP $BANK` label || \
136 fail "unable to read the chip label from the character device"
140 local CHIP=$1
144 $BASE_DIR/gpio-line-name /dev/`configfs_chip_name $CHIP $BANK` $OFFSET || \
179 echo "1.1. Chip name is communicated to user"
180 create_chip chip
181 create_bank chip bank
182 enable_chip chip
183 test -n `cat $CONFIGFS_DIR/chip/bank/chip_name` || fail "chip_name doesn't work"
184 remove_chip chip
186 echo "1.2. chip_name returns 'none' if the chip is still pending"
187 create_chip chip
188 create_bank chip bank
189 test "`cat $CONFIGFS_DIR/chip/bank/chip_name`" = "none" || \
190 fail "chip_name doesn't return 'none' for a pending chip"
191 remove_chip chip
194 create_chip chip
195 create_bank chip bank
196 enable_chip chip
197 test -n `cat $CONFIGFS_DIR/chip/dev_name` || fail "dev_name doesn't work"
198 remove_chip chip
203 create_chip chip
204 create_bank chip bank
205 enable_chip chip
206 test "`get_chip_num_lines chip bank`" = "1" || fail "default number of lines is not 1"
207 remove_chip chip
210 create_chip chip
211 create_bank chip bank
212 set_num_lines chip bank 16
213 enable_chip chip
214 test "`get_chip_num_lines chip bank`" = "16" || fail "number of lines is not 16"
215 remove_chip chip
218 create_chip chip
219 create_bank chip bank
220 set_label chip bank foobar
221 enable_chip chip
222 test "`get_chip_label chip bank`" = "foobar" || fail "label is incorrect"
223 remove_chip chip
226 create_chip chip
227 create_bank chip bank
228 enable_chip chip
229 test -z "`cat $CONFIGFS_DIR/chip/bank/label`" || fail "label is not empty"
230 remove_chip chip
233 create_chip chip
234 create_bank chip bank
235 set_num_lines chip bank 16
236 set_line_name chip bank 0 foo
237 set_line_name chip bank 2 bar
238 enable_chip chip
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"
241 remove_chip chip
244 create_chip chip
245 create_bank chip bank
246 set_num_lines chip bank 2
247 set_line_name chip bank 5 foobar
248 enable_chip chip
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"
251 remove_chip chip
254 create_chip chip
255 create_bank chip bank
256 mkdir $CONFIGFS_DIR/chip/bank/line12foobar 2> /dev/null && \
258 mkdir $CONFIGFS_DIR/chip/bank/line_no_offset 2> /dev/null && \
260 remove_chip chip
264 for CHIP in $CHIPS; do
265 create_chip $CHIP
266 create_bank $CHIP bank
267 enable_chip $CHIP
269 for CHIP in $CHIPS; do
270 remove_chip $CHIP
273 echo "2.9. Can't modify settings when chip is live"
274 create_chip chip
275 create_bank chip bank
276 enable_chip chip
277 echo foobar > $CONFIGFS_DIR/chip/bank/label 2> /dev/null && \
278 fail "Setting label of a live chip should fail"
279 echo 8 > $CONFIGFS_DIR/chip/bank/num_lines 2> /dev/null && \
280 fail "Setting number of lines of a live chip should fail"
281 remove_chip chip
283 echo "2.10. Can't create line items when chip is live"
284 create_chip chip
285 create_bank chip bank
286 enable_chip chip
287 mkdir $CONFIGFS_DIR/chip/bank/line0 2> /dev/null && fail "Creating line item should fail"
288 remove_chip chip
291 create_chip chip
292 create_bank chip bank
293 set_num_lines chip bank 99999
294 echo 1 > $CONFIGFS_DIR/chip/live 2> /dev/null && fail "Probe error was not propagated"
295 remove_chip chip
297 echo "2.12. Cannot enable a chip without any GPIO banks"
298 create_chip chip
299 echo 1 > $CONFIGFS_DIR/chip/live 2> /dev/null && fail "Chip enabled without any GPIO banks"
300 remove_chip chip
302 echo "2.13. Duplicate chip labels are not allowed"
303 create_chip chip
304 create_bank chip bank0
305 set_label chip bank0 foobar
306 create_bank chip bank1
307 set_label chip bank1 foobar
308 echo 1 > $CONFIGFS_DIR/chip/live 2> /dev/null && fail "Duplicate chip labels were not rejected"
309 remove_chip chip
312 create_chip chip
313 create_bank chip bank
314 set_num_lines chip bank 8
315 mkdir -p $CONFIGFS_DIR/chip/bank/line4/hog
316 enable_chip chip
317 $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 4 2> /dev/null && \
319 remove_chip chip
324 create_chip chip
325 create_bank chip bank
326 set_num_lines chip bank 8
327 enable_chip chip
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
334 remove_chip chip
337 create_chip chip
338 create_bank chip bank
339 set_num_lines chip bank 8
340 enable_chip chip
341 DEVNAME=`configfs_dev_name chip`
342 CHIPNAME=`configfs_chip_name chip bank`
345 sysfs_set_pull chip bank 0 pull-up
347 remove_chip chip
350 create_chip chip
351 create_bank chip bank
352 set_num_lines chip bank 8
353 enable_chip chip
354 DEVNAME=`configfs_dev_name chip`
355 CHIPNAME=`configfs_chip_name chip bank`
358 remove_chip chip
361 create_chip chip
362 create_bank chip bank
363 enable_chip chip
364 DEVNAME=`configfs_dev_name chip`
365 CHIPNAME=`configfs_chip_name chip bank`
368 remove_chip chip
373 create_chip chip
374 create_bank chip bank
375 set_num_lines chip bank 8
376 enable_chip chip
377 DEVNAME=`configfs_dev_name chip`
378 CHIPNAME=`configfs_chip_name chip bank`
381 $BASE_DIR/gpio-mockup-cdev -s 1 /dev/`configfs_chip_name chip bank` 0 &
385 remove_chip chip
388 create_chip chip
389 create_bank chip bank
390 set_num_lines chip bank 8
391 enable_chip chip
392 DEVNAME=`configfs_dev_name chip`
393 CHIPNAME=`configfs_chip_name chip bank`
395 $BASE_DIR/gpio-mockup-cdev -b pull-up /dev/`configfs_chip_name chip bank` 0
397 remove_chip chip