enable ADC in device tree

I am trying to enable the ADC of the BBB in the device tree. I had to disable to capemanager because of reasons apparent from this thread: https://groups.google.com/forum/#!category-topic/beagleboard/pru/IKVmIjvXnIs

I have a bit of trouble to wrap my head around how the device tree works. My idea was to extend am335x-boneblack-overlay.dts inside the devicetree directory and rebuild and install it. I wanted to base this on the following cape: https://github.com/beagleboard/devicetree-source/blob/master/arch/arm/boot/dts/cape-bone-iio-00A0.dts

So, I took a wild guess and added

/************************** ADC ***************************/
&ocp{
tscadc {
compatible = “ti,ti-tscadc”;
reg = <0x44e0d000 0x1000>;

interrupt-parent = <&intc>;
interrupts = <16>;
ti,hwmods = “adc_tsc”;
status = “okay”;

adc {
ti,adc-channels = <0 1 2 3 4 5 6 7>;
};
};

test_helper: helper {
compatible = “bone-iio-helper”;
vsense-name = “AIN0”, “AIN1”, “AIN2”, “AIN3”, “AIN4”, “AIN5”, “AIN6”, “AIN7”;
vsense-scale = <100 100 100 100 100 100 100 100>;
status = “okay”;
};
};

at the end of am335x-boneblack-overlay.dts. This compiled fine and I was able to install it and reboot without any apparent errors. But unfortunately, this didn’t add any AIN* devices (the command "find /sys/ - name ‘AIN’ " doesn’t find anything). So, how could I go about enabling the ADC without using the capemanger?

sudo sh -c "echo 'BB-ADC' > /sys/devices/platform/bone_capemgr/slots"

Read the adc values under:

/sys/bus/iio/devices/

Regards,

Robert, thank you very much. Works like charm now.

To get it work with the device tree builder I added the following at the bottome of “am335x-boneblack-overlay.dts”

&tscadc {
status = “okay”;
adc {
ti,adc-channels = <0 1 2 3 4 5 6>;
};
};

Now I can get the adc values as you described:

cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw