Enabling the ADC on the 3.8 BBB Kernel without the cape manager

Hello all,
I’m trying to get in the habit of enabling all the hardware that I need on the beaglebone black via modifying the main device tree file am335x-boneblack.dts which I derive with the dtc from the am335x-boneblack.dtb file available under /boot/dtbs or /boot/uboot/dtbs in a Debian installation. I’m specifically trying to avoid device tree overlays and using the cape manager altogether. I’ve had success with GPIO, SPI, I2C, UART and PWM but I’m unable to get this to work for the ADC.

In the am335x-boneblack.dts file the only section that relates to the ADC is:

713 tscadc@44e0d000 {
714 compatible = “ti,ti-tscadc”;
715 reg = <0x44e0d000 0x1000>;
716 interrupt-parent = <0x1>;
717 interrupts = <0x10>;
718 ti,hwmods = “adc_tsc”;
719 status = “disabled”;
720 linux,phandle = <0x3d>;
721 phandle = <0x3d>;
722 };

For some insight I took a peak at the BB-ADC-00A0.dts (again created from the BB-ADC-00A0.dtb file in /lib/firmware via the dtc)

1 /dts-v1/;
2
3 / {
4 compatible = “ti,beaglebone”, “ti,beaglebone-black”;
5 part-number = “BB-ADC”;
6 exclusive-use = “P9.39”, “P9.40”, “P9.37”, “P9.38”, “P9.33”, “P9.36”, “P9.35”, “tscadc”;
7
8 fragment@0 {
9 target = <0xdeadbeef>;
10
11 overlay {
12 #address-cells = <0x1>;
13 #size-cells = <0x1>;
14
15 tscadc {
16 compatible = “ti,ti-tscadc”;
17 reg = <0x44e0d000 0x1000>;
18 interrupt-parent = <0xdeadbeef>;
19 interrupts = <0x10>;
20 ti,hwmods = “adc_tsc”;
21 status = “okay”;
22
23 adc {
24 ti,adc-channels = <0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7>;
25 };
26 };
27
28 helper {
29 compatible = “bone-iio-helper”;
30 vsense-name = “AIN0”, “AIN1”, “AIN2”, “AIN3”, “AIN4”, “AIN5”, “AIN6”, “AIN7”;
31 vsense-scale = <0x64 0x64 0x64 0x64 0x64 0x64 0x64 0x64>;
32 status = “okay”;
33 linux,phandle = <0x1>;
34 phandle = <0x1>;
35 };
36 };
37 };

In additions to enabling the tscadc section and adding an adc section within the tscadc section, the ADC device overlay seems to create a ‘helper’ section with the ‘bone-iio-helper’ driver. What exactly is the purpose of this section? I’m having trouble integrating this section directly into the main am335x-boneblack.dtb file. Any ideas on how to do this or enable the adc in the main device tree file in general, would be highly appreciated.

Hussam

Figured it out…

To enable the ADC in the global device tree file (am335x-boneblack.dts) I needed to replace this:

713 tscadc@44e0d000 {
714 compatible = “ti,ti-tscadc”;
715 reg = <0x44e0d000 0x1000>;
716 interrupt-parent = <0x1>;
717 interrupts = <0x10>;
718 ti,hwmods = “adc_tsc”;
719 status = “disabled”;
720 linux,phandle = <0x3d>;
721 phandle = <0x3d>;
722 };

with this:

713 tscadc@44e0d000 {
714 compatible = “ti,ti-tscadc”;
715 reg = <0x44e0d000 0x1000>;
716 interrupt-parent = <0x1>;
717 interrupts = <0x10>;
718 ti,hwmods = “adc_tsc”;
719 status = “okay”;
720 linux,phandle = <0x3d>;
721 phandle = <0x3d>;
722
723 adc{
724 ti,adc-channels = <0 1 2 3 4 5 6 7>;
725 };
726 };

basically enable the tsadc peripheral (status = “okay”) and add an adc section listing all channels to be used.