bone-iio-helper at boot

I have been reading analog inputs for the Beaglebone Black with the most recent debian kernel (Aug 16), but I noticed similar behavior with the most recent Angstrom kernel. If during runtime I do:

echo BB-ADC > /sys/devices/bone_capemgr.8/slots

I get two sets of directories with analog input values:

/sys/devices/ocp.2/helper.15/AIN0 (values in mV) and
/sys/bus/iio/devices/iio:device0/in_voltage0_raw (with counts, 4096 counts = 1800 mV)

Also, there is a message in the log file:

[ 389.802540] bone-iio-helper helper.15: ready

On the other hand, if I add the following to uEnv.txt:

optargs=capemgr.enable_partno=BB-BONE-RTC,BB-ADC

(note, my external real time clock works very well this way)

I get the /sys/bus/iio/devices entry but not the /sys/devices/ocp.2 entry.
Also, I get the following in dmesg:

[ 2.198451] bone-iio-helper helper.10: Could not get AIN0 analog input

Of course, I can use the /sys/bus/iio/devices directories, but is this the
expected behavior?

I saw this blog:

http://beagleboard-gsoc13.blogspot.com/2013/07/sampling-analogue-signals-using-adc-on.html

Is /sys/bus/iio/devices the future, and /sys/devices/ocp.2/helper going away?

Thanks for any help/insight with this.

The dmesg content surrounding the "Could not get AIN0" might prove
enlightening. What's in /sys/devices/bone_capemgr.*/slots for both cases?

I've been using the iio cape, which looks to be pretty much identical to
the BB-ADC overlay except for the name. I haven't had any problems, but
I have always been loading it once the system is up.

Also, have you tried *JUST* loading the BB-ADC cape to see if that works
OK? The BeagleBone specific device-tree overlay stuff is generally
fragile and I don't get the impression it's been through a lot of
testing. It wouldn't surprise me if loading multiple overlays didn't
tickle some bug...

If it's the cape manager that's causing problems, you can create a
custom device tree for your hardware and just load that via uBoot
(replacing the 'stock' BeagleBone Black dtb).

Thanks for the input. I tried removing the RTC overlay, and the behavior is the same with and without it.

Here is the sounding info from dmesg when I load the cape at boot:

[ 2.032227] bone-capemgr bone_capemgr.8: slot #7: Requesting part number/version based 'BB-ADC-00A0.dtbo
[ 2.043038] usbcore: registered new interface driver cdc_acm
[ 2.049023] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 2.057421] Initializing USB Mass Storage driver…
[ 2.062578] bone-capemgr bone_capemgr.8: slot #7: Requesting firmware ‘BB-ADC-00A0.dtbo’ for board-name ‘Override Board Name’, version ‘00A0’
[ 2.075907] bone-capemgr bone_capemgr.8: slot #7: dtbo ‘BB-ADC-00A0.dtbo’ loaded; converting to live tree
[ 2.086081] usbcore: registered new interface driver usb-storage
[ 2.092415] USB Mass Storage support registered.
[ 2.097512] bone-capemgr bone_capemgr.8: slot #7: #1 overlays
[ 2.103747] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
[ 2.112216] bone-iio-helper helper.10: Could not get AIN0 analog input
[ 2.119506] musb-hdrc musb-hdrc.0.auto: pdev->id = 0
[ 2.124765] musb-hdrc musb-hdrc.0.auto: drivers/usb/musb/musb_dsps.c:468 dsps_musb_init: OK
[ 2.133611] bone-capemgr bone_capemgr.8: slot #7: Applied #1 overlays.
[ 2.140482] bone-capemgr bone_capemgr.8: loader: done slot-7 BB-ADC:00A0 (prio 0)

And here it is if I load during runtime:

[ 232.962066] bone-capemgr bone_capemgr.8: part_number ‘BB-ADC’, version ‘N/A’
[ 232.972528] bone-capemgr bone_capemgr.8: slot #7: generic override
[ 232.979555] bone-capemgr bone_capemgr.8: bone: Using override eeprom data at slot 7
[ 232.987739] bone-capemgr bone_capemgr.8: slot #7: ‘Override Board Name,00A0,Override Manuf,BB-ADC’
[ 232.997978] bone-capemgr bone_capemgr.8: slot #7: Requesting part number/version based 'BB-ADC-00A0.dtbo
[ 233.008245] bone-capemgr bone_capemgr.8: slot #7: Requesting firmware ‘BB-ADC-00A0.dtbo’ for board-name ‘Override Board Name’, version ‘00A0’
[ 233.026092] bone-capemgr bone_capemgr.8: slot #7: dtbo ‘BB-ADC-00A0.dtbo’ loaded; converting to live tree
[ 233.038683] bone-capemgr bone_capemgr.8: slot #7: #1 overlays
[ 233.061291] bone-iio-helper helper.14: ready
[ 233.072835] bone-capemgr bone_capemgr.8: slot #7: Applied #1 overlays.

I noticed ‘prio’ numbers. Is there a way to specify a priority number when loading an overlay through uEnv.txt?