This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x: ADC problem (Kernel-3.2.0-psp04.06.00.11)

Other Parts Discussed in Thread: AM3352

Hello,

I followed the instructions in the wiki on how to configure the ADC so I could use the raw converter in my custom board but the folder /sys/bus/iio/devices/ is empty when I try to list it's content,

I found this topic that seamed to be related, but the given solution didn't work in my case.

Below I'm pasting the two configurations I tried in my board config file, neither the red nor the blue configuration worked so far.

static struct tsc_data am335x_touchscreen_data = {
   .wires = 0,
   .x_plate_resistance = 200,
   .steps_to_configure = 5,
};

static struct adc_data am335x_adc_data = {
   .adc_channels = 8,
};

static struct mfd_tscadc_board tscadc = {
   .tsc_init = &am335x_touchscreen_data,
   .adc_init = &am335x_adc_data,
};

static struct adc_data am335x_adc_data = {

   .adc_channels = 8,

};

static struct mfd_tscadc_board tscadc = {
   .tsc_init = NULL,
   .adc_init = &am335x_adc_data,
};

As the title says, I'm using Kernel-3.2.0-psp04.06.00.11 in an AM3352 processor.

Loading the ADC as a module, I get this message:

ti_adc: module is from the staging directory, the quality is unknown, you have been warned.

And nothings shows under /sys/bus/iio/devices either...

So, does anyone knows why this issue came back to hunt the latest version of the Kernel? Shouldn't it be resolved by now?

Thanks in advance,

DAVI

  • Hi Davi,

    Are there any error messages about the tscadc during kernel boot?

    Can you check if the platform driver has been registered:

    ls -la /sys/devices/platform/omap

    There you are using the TI driver, then there should be a ti_tscadc driver listed.

    Best regards,
    Miroslav

  • No problems are reported in the log when the board boot up. Here is what I get in from the system:

    root@UCC3:~# ls -la /sys/devices/platform/omap
    drwxr-xr-x 38 root root 0 Jan 1 2000 .
    drwxr-xr-x 12 root root 0 Jan 1 2000 ..
    drwxr-xr-x 4 root root 0 Jan 1 2000 am33xx-rtc
    drwxr-xr-x 4 root root 0 Jan 1 2000 cpsw
    drwxr-xr-x 4 root root 0 Jan 1 2000 d_can.1
    drwxr-xr-x 3 root root 0 Jan 1 2000 davinci_mdio.0
    drwxr-xr-x 3 root root 0 Jan 1 2000 edma.0
    drwxr-xr-x 3 root root 0 Jan 1 2000 l3_main.0
    drwxr-xr-x 3 root root 0 Jan 1 2000 mpu.0
    drwxr-xr-x 5 root root 0 Jan 1 2000 musb-ti81xx
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap-gpmc
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap-mailbox
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap2_elm
    drwxr-xr-x 5 root root 0 Jan 1 2000 omap2_mcspi.1
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap2_mcspi.2
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_gpio.0
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_gpio.1
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_gpio.2
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_gpio.3
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_hsmmc.0
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_i2c.1
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.0
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.1
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.2
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.3
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.4
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.5
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.6
    drwxr-xr-x 3 root root 0 Jan 1 2000 omap_timer.7
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_uart.0
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_uart.1
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_uart.2
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_uart.3
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_uart.4
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_uart.5
    drwxr-xr-x 4 root root 0 Jan 1 2000 omap_wdt
    drwxr-xr-x 2 root root 0 Sep 10 18:00 power
    drwxr-xr-x 3 root root 0 Jan 1 2000 ti_tscadc
    -rw-r--r-- 1 root root 4096 Jan 1 2000 uevent


    root@UCC3:~# ls -la /sys/bus/iio/devices/
    drwxr-xr-x 2 root root 0 Jan 1 2000 .
    drwxr-xr-x 4 root root 0 Jan 1 2000 ..

  • A little more information to help figuring out what's going on:

    (I'm using the RED configuration from the 1st post)

    I enabled the DEBUG in arch/arm/plat-omap/omap_device.c and here is what dmesg prints:

    root@UCC3:~# dmesg | grep ti_tscadc
    [ 0.186950] omap_device: ti_tscadc: counted 2 total resources across 1 hwmods
    [ 0.186981] ti_tscadc: omap_device_alloc(): resources allocated from hwmod 2
    [ 0.187011] ti_tscadc: Creating fck -> adc_tsc_fck
    [ 0.187133] omap_device: ti_tscadc: registering

  • Hi Davi,

    The function that creates the iio entries is iio_device_register() located in <linux_dir>/drivers/staging/iio/industrialio-core.c. The iio ti_adc driver is <linux_dir>/drivers/staging/iio/adc/ti_adc.c. The iio_device_register() function is called inside the driver's probe function. I'd suggest you use some prints to investigate what happens there, is the function called and why isn't the device entry created.

    Best regards,
    Miroslav

  • Hi Miroslav,

    I'm just curious, do you use the PSP 04.06.00.11? Does the same thing happens if you disable the touchscreen and try using the ADC?

    DAVI

  • Davi,

    Yes. I'm using the latest PSP 04.06.00.11 from the latest SDK 06.00.00.00. I just disabled the touchscreen from the board config file by doing the following:

    /* TSc controller */
    static struct tsc_data am335x_touchscreen_data  = {
    	.wires  = 0,
    	.x_plate_resistance = 200,
    	.steps_to_configure = 5,
    };
    
    static struct adc_data am335x_adc_data = {
    	.adc_channels = 8,
    };
    
    static struct mfd_tscadc_board tscadc = {
    	.tsc_init = &am335x_touchscreen_data,
    	.adc_init = &am335x_adc_data,
    };

    I recompiled the kernel, then booted the AM335x GP EVM board with the new kernel and I have this working:

    root@am335x-evm:~# ls -la /sys/bus/iio/devices/            
    drwxr-xr-x    2 root     root             0 Jan  1  2000 .
    drwxr-xr-x    4 root     root             0 Jan  1  2000 ..
    lrwxrwxrwx    1 root     root             0 Jan  1  2000 iio:device0 -> ../../../devices/platform/omap/ti_tscadc/tiadc/iio:device0
    root@am335x-evm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
    4083
    root@am335x-evm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage7_raw
    1112

    Are the board file modifications the only modifications you have done regarding the TSC and ADC?

    Best regards,
    Miroslav

  • My board configuration file is completely different from the one EVM uses, basically I copied board-am335xevm.c and added a new entry to arch/arm/mach-omap2/Kconfig file so I could select my own configuration. The main difference between those files is the removal of every trace of multiple profiles because it's easier to work on our design if we only have one default configuration, but regardless there are a lot of minor differences too.

    Regarding specifically the TSC/ADC part of the configuration, I added those structures I pasted before and I call mfd_tscadc_init() before calling evm_nand_init(). In my previous analysis, that would be enough, but doesn't seems that way now...

    Maybe there is another configuration I'm skipping... I'll try using our beaglebone to compare the configuration we use with EVM's, that should work now that I know the core code is not broken...

    Thanks!

    DAVI

  • I've found out what was going on.

    With the BeagleBone, I was able to get everything working. I then compared arch/arm/configs/am335x_evm_defconfig with my configuration file and turns out this options was missing: CONFIG_MFD_TI_TSCADC.

    So I rebuild my image enabling

    -> Device Drivers
      -> Multifunction device drivers
       <*> TI ADC / Touch Screen chip support

    And it worked this time. Shouldn't this information be on the wiki page?

    Anyway, thank you for the support and help!

    DAVI