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.

Sound on DM3730

Other Parts Discussed in Thread: TPS65930

Hi Titus,

I have got issue with the sound and need some advice on this about how to get that working. I have a variscite SOM and i need to run the following command not sure how I can run this. Can you help on that please.

I need to run this command on target and not sure how I can do that.

alsactl –f asound.state restore

Regards

Ali

  • Hi,


    Just thinking about it would it be that I need to run this command in filesystem of Gingerbread $HOME/rowboat-android/

    as variscite use different TPS than TI's original

    Regards

    Ali

  • Hi Ali,

    Are you working with android filesystem ?

    If yes, then "audio" utilities could be different for android than linux.

    Were you getting any error while you execute "alsactl –f asound.state restore" ?

    I'm not aware this utility on android.

    May be we have to cross compile with android filesystem.

    If I'm not in your track, could you please redirect to correct path.

    Also, please elaborate a bit on your requirement/problem.

  • Hi Titus,

    Right, This is what I have.

    We use Variscite SOM which is based on TI's "TI-Android-GingerBread-2.3.4-DevKit-2.1" I downloaded the source code for Gingerbread from TI's guide and then started working on it and modifying to work with our custom board.

    I went to variscite to find oout why the build using their kernel does not make the sound work. I was told that the SOM uses different TPS than TI's and there is asound.state file against which I need to run the command.

    alsactl –f asound.state restore

    The asound.state file is supplied by variscite.

    To answer your questions, Yes I am using Android File system and Kernel version 2.6.37

    I did get this debug when applying command above "No state is present for card AudioPCI"

    What I am doing is cross compiling the filesystem after running the above utility. The file system is being built at the moment so once done will post something.

    Regards

    Ali

     

  • Hi Ali,

    Could you please share your complete bootup log to check how the audio get initialized.

    alsactl -f /etc/asound.state store

    alsactl -f /etc/asound.state restore


    Try "aplay -l" to list the audio hardwares detected.

  • Hi Titus,

    I have created the file system again on the Host Machine using below

    ali@ubuntu:~/rowboat-android$ alsactl -f asound.state restore
    ali@ubuntu:~/rowboat-android$ make TARGET_PRODUCT=omap3evm clean
    ali@ubuntu:~/rowboat-android$ make TARGET_PRODUCT=omap3evm OMAPES=5.x -j2

    There is no audio.

    In the filesystem on my SD card I don't have the folder /etc/asound.state

    Also the asound.state file is not anywhere on the filesystem (SD Card) created following TI guide from here

    http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_DeveloperGuide#Create_root_filesystem_tarball


    So I am not sure how I can apply those two commands you mentioned above.

    The complete bootlog is attached here

    8863.capture.txt

    Regards

    Ali

  • Hi Ali,

    ali@ubuntu:~/rowboat-android$ alsactl -f asound.state restore
    ali@ubuntu:~/rowboat-android$ make TARGET_PRODUCT=omap3evm clean
    ali@ubuntu:~/rowboat-android$ make TARGET_PRODUCT=omap3evm OMAPES=5.x -j2

    You are executing the "alsactl' command in host machine and not in target (android s/m)

    [    4.003295] asoc: twl4030-hifi <-> omap-mcbsp-dai.1 mapping ok
    [    4.015106] ALSA device list:
    [    4.019470]   #0: omap3evm

    The kernel logs seems to be the audio driver get initialized successfully.

    How about "aplay -l" o/p log from android s/m ?

  • Hi Titus,

    How can I apply it on target.

    Is it at the u-boot command prompt.

    Regards

    Ali

  • Hi Titus,


    I have got terminal going on Android but constantly getting permission denied message

    Regards

    Ali

  • Hi Ali,

    Is it at the u-boot command prompt.

    Every command should be executed at android terminal (bash or simple "#").

    I have got terminal going on Android but constantly getting permission denied message

    Try to give "chmod 777 < your android rootfs dir from SD card : rootfs partition >" at host machine.

  • Hi Titus,

    I have changed permissions to chmod 777 /media/rootfs and still getting the permission denied message.

    The command line also begins with $ sign, It was $ previously as well and not #

    Regards

    Ali

  • Hi Titus,

    Update:

    I had to use -R option with chmod and works now but I get error saying alsactl not found

    Regards

    Ali

  • Hi Ali,

    Had you tried "aplay <media-file-name>.wav " to play wav file on android ?

    Generally, For android fs, "tinymix" ctrl has been used for audio testing.

    Use "tinyplay" command to play any audio file on android and "tinycap" for capture the audio through mic.

    tinyplay <media-file-name>.wav -n 16
    tinycap <capture-file-name>.wav -n 16
  • Hi Titus,

    Just an update on the issue.

    I had to use chmod 777 -R /media/rootfs for permissions.

    The command not found was due to PATH variable not being included.

    so I set the export PATH=/system/bin:$PATH

    Now the commands are little different

    alsactl -> alsa_ctl

    aplay -> alsa_aplay

    On using the alsa_aplay -l I get the message

    "aplay: device_list:217: no soundcard found..."

    On using alsa_ctl -f asound.state restore I get messge

    "alsa_ctl: load_state:1608: no soundcard found"

    With tinyplay and tinycap I get message not found

    Regards

    Ali

  • Hi Titus,

    Any idea's or suggestion on this. I have tried your suggestions above but to no avail. The audio codec device used on SOM is TPS65930.

    Regards


    Ali

  • Hi Ali,

    Sorry for the delayed responses.

    From your kernel logs, the sound card should detect.

    Have you tried linux OS on this board or only Linux ?

    I will check for android and let me update.

  • Hi Titus,


    Thanks for the reply. I have been trying various things in the last few days to see whats wrong but nothing seems to help me at all.

    Yes you are right the kernel log does show that everything should just work. I have not got any further to where I was few days ago. I have also attached the detailed logfile again with more debug.


    To answer your question about Linux OS, I have not tried that. I cannot do that at the moment purely due to company prospective as I have to use android plus the x-loader, u-boot and kernel are downloaded from TI site so I think that should just be a good starting point.


    I have found few things to which the results are.


    In my /proc/asound/ I have list of following folders


    omap3evm
    card0
    pcm
    timers
    hwdep
    cards
    devices
    version

    cat /proc/asound/version
    Linux Version 2.6.37-00009-g77a1ac7-dirty (ali@ubuntu) (gcc version 4.4.3 (GCC))#8 Wed Aug 27 08:10:30 PTD 2014

    cat /proc/asound/devices
    0:[0]      : control
    16:[0 -0] : digital audio playback
    24:[0 -0] : digital audio capture
    33:      : timers

    cat /proc/asoound/cards
    0 [omap3evm] - omap3evm
                   omap3evm

    cat /proc/asoound/hwdep
    This gives nothing

    cat /proc/asound/pcm
    00-00: TWL4030 twl4030-hifi-0 : : playback 1 : capture 1

    cat /proc/asound/card0/id
    omap3evm

    cat /proc/asound/card0/pcm0c/info

    card: 0
    device: 0
    subdevice: 0
    stream: CAPTURE
    id: TWL4030 twl4030-hifi-0
    name:
    subname: subdevice #0
    class: 0
    subclass: 0
    subdevice_count: 1
    subdevice_avail: 1

    cat /proc/asound/card0/pcm0p/info

    card: 0
    device: 0
    subdevice: 0
    stream: PLAYBACK
    id: TWL4030 twl4030-hifi-0
    name:
    subname: subdevice #0
    class: 0
    subclass: 0
    subdevice_count: 1
    subdevice_avail: 1



    cat /proc/asound/omap3evm/id
    omap3evm

    cat /proc/asound/omap3evm/pcm0c/info

    card: 0
    device: 0
    subdevice: 0
    stream: CAPTURE
    id: TWL4030 twl4030-hifi-0
    name:
    subname: subdevice #0
    class: 0
    subclass: 0
    subdevice_count: 1
    subdevice_avail: 1

    cat /proc/asound/omap3evm/pcm0p/info

    card: 0
    device: 0
    subdevice: 0
    stream: PLAYBACK
    id: TWL4030 twl4030-hifi-0
    name:
    subname: subdevice #0
    class: 0
    subclass: 0
    subdevice_count: 1
    subdevice_avail: 1

    All this suggests that everything is fine i think.

    ls in home directory on Android does not show etc folder hence there is no /etc/asound.state

    The alsa.conf file can be found in /system/usr/share/alsa/alsa.conf

    Yet when i use 'alsa_ctl -f /sbin/asound.state restore' I get error 'no soundcard found...' as stated above.

    The same results when i use alsa_aplay -l & alsa_amixer command.

    I think if I can show something in the list of alsa_aplay -l then the problem would be solved as soundcard would be present and I can play with mixer settings to get it to work

    That is all I have got for now

    On some of the commands I get permission denied error for example

    when I do 'logcat -v time -f /mnt/sdcard/logcat.txt' I get error permission denied. When i use 'su logcat -v time -f /mnt/sdcard/logcat.txt' i get error "su:uid 10012 not allowed to su"

    Any help would be great

    Regards

    Ali

    4135.Bootlog.txt

  • Hi Titus,

    I am not sure about this but just noticed in debug logs that

    pop wq checking: HiFi Playback status: inactive waiting: yes

    I wonder if the codec is switched off.

    Regards

    Ali

  • Hi Titus,


    Do you have nay more suggestions on this. What I can see from logs is that soc_codec_close gets called. I am not sure who calls it, but it then closed the PCM substream. which I think is the reason for no audio. I am just trying to find out under what conditions this gets called to backtrack things. Would you give some advice on soc_codec_close.

    Regards

    Ali

  • Hi Ali,

    Sorry for the delayed response.

    I'm trying to reproduce the problem on linux.

    Still, I'm working on it and will get back to you.

  • Hi Titus,

    Thanks for that. I'm waiting in the mean time I'll try from my end to find something.

    Regards

    Ali

  • Hi Titus,

    I have just got a little further now and this is what is happening. The soc_codec_close is fine. The reason that is called is because there is no sound being played.

    I then placed alot of or_deg statements in soc-core to find out what is going on. This was identified.

    Once sound is played, the following debug gets printed.

    [   10.566253] snd_soc_update_bits
    [   10.573059] soc_pcm_hw_free
    [   10.579254] soc_pcm_hw_free
    [   10.583374] soc_codec_close
    [   14.359497] warning: `zygote' uses 32-bit capabilities (legacy support in use)
    [   16.486572] er.ServerThread (1184): /proc/1171/oom_adj is deprecated, please use /proc/1171/oom_score_adj instead.
    [   16.808959] snd_soc_update_bits
    [   60.476379] soc_pcm_open ----------------------------------------> .mp3 file played at this point
    [   60.481048] snd_soc_set_runtime_hwparams
    [   60.486755] soc_pcm_apply_symmetry
    [   60.493469] asoc: twl4030-hifi <-> omap-mcbsp-dai.1 info:
    [   60.500915] asoc: rate mask 0x4fe
    [   60.506164] asoc: min ch 2 max ch 4
    [   60.512268] asoc: min rate 8000 max rate 96000
    [   60.519805] soc_pcm_hw_params
    [   60.524108] snd_soc_dai_set_fmt
    [   60.528808] snd_soc_dai_set_fmt
    [   60.533660] snd_soc_dai_set_sysclk
    [   60.538665] mcbsp_data->bus_id 1
    [   60.544036] dma_data->name Audio Playback
    [   60.549468] soc_pcm_prepare
    [   60.554473] snd_soc_dai_digital_mute
    [   60.559906] soc_pcm_trigger
    [   60.566131] mcbsp_data->bus_id 1, stream subdevice #0

    When i use the alsa_amixer to find the info about the card following happens

    alsa_amixer -D 0 info        ----> error snd_ctl_open_noupdata invalid CTL 0

    alsa_amixer -D omap3evm info --------------> error snd_ctl_open_noupdata invalid CTL omap3evm

    Regards

    Ali

  • Do the device nodes in /dev/snd/ exist? What are their permissions?

  • I dont have anything in /dev/snd/

    Its an empty folder.

    There is no asound.conf present in rootfs nor asound.state.

    The logcat looks like this.

    ++++++++++++++++++++++++++++++++++++++++++++

    8055.logcat.txt

  • All the devices listed in /proc/asound/devices should have a device node in /dev/snd/.

    In kernels that have been compiled with CONFIG_SND_DYNAMIC_MINORS, these nodes must be created by udev.

    However, as far as I know, Android disables that option and requires static device nodes.
    Have a look at the snddevices script to see which device nodes you need to create.
    (Or just run it as "snddevices --dev-dir=/tmp/dev", and copy the needed device nodes to your device's FS.)

  • Hi Ali,

    I agree Clemens's point.

    I'm able to reproduce your problem when I disabled the init scripts which would create device nodes under /dev, /sys, /proc etc.,

    I'm also suspecting that your init.rc file might have miss something related to audio snd deice nodes.

  • I think i lied there. When I looked at the rootfs on ubuntu there was nothing in /dev/snd/

    I started adb shell session on target and this is what I have now.

    ls /dev --->0728.ls_dev.txt

    ls /dev/snd/ ----> 6866.ls_dev_snd.txt

    It seems like they are listed.

    cat /proc/asound/devices
      0: [ 0]   : control
     16: [ 0- 0]: digital audio playback
     24: [ 0- 0]: digital audio capture
     33:        : timer

  • My init.rc looks like this ----> 2500.init.rc.txt

  • Show the output of "ls -l /dev/snd/".

  • Clemens,

    This is what I have got for "ls -l /dev/snd/".

    crw-rw---- system   audio    116,  33 2011-03-27 03:56 timer
    crw-rw---- system   audio    116,   0 2011-03-27 03:56 controlC0
    crw-rw---- system   audio    116,  24 2011-03-27 03:56 pcmC0D0c
    crw-rw---- system   audio    116,  16 2011-03-27 03:56 pcmC0D0p

  • These look correct.

    As what user are you trying to access these? Is this user member of the audio group?

  • Just an update,

    I was using terminal emulator before but now using adb so things are getting better i guess.

    I was going to use alsa_ctl -f asound.state restore but this time I did not get a error saying no sound card found...

    I have a different error which says

    alsa_ctl: parse:1621: Unable to open file '/system/usr/share/alsa/init/00main': No such file or directory

    The directory tree looks like this

    # ls /system/usr/share/alsa/
    cards
    pcm
    alsa.conf
    # alsa_ctl init
    alsa_ctl: parse:1621: Unable to open file '/system/usr/share/alsa/init/00main': No such file or directory
    # ls /system/usr/share/alsa/cards/
    aliases.conf
    # ls /system/usr/share/alsa/pcm/
    front.conf
    dsnoop.conf
    surround50.conf
    iec958.conf
    side.conf
    surround51.conf
    surround40.conf
    dmix.conf
    default.conf
    rear.conf
    surround41.conf
    modem.conf
    dpl.conf
    center_lfe.conf
    surround71.conf

  • I am not sure about the user number there. How will I find this out.

  • Right some update on this,

    adb is kind of working now to get the things moving forward

    alsa_aplay -l shows below

    # alsa_aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: omap3evm [omap3evm], device 0: TWL4030 twl4030-hifi-0 []
      Subdevices: 0/1
      Subdevice #0: subdevice #0

    I un muted the two right and left audio channels

    # alsa_amixer cset name='Analog Left AUXL Capture Switch' 1
    numid=29,iface=MIXER,name='Analog Left AUXL Capture Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=on
    # alsa_amixer cset name='Analog Right AUXR Capture Switch' 1
    numid=26,iface=MIXER,name='Analog Right AUXR Capture Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=on

    The sound coming out from there is very weak can hardly hear it when right next to the speaker.

    I guess mixer setting are incorrect which is why sound is so low. The asound.state file contains the mixer setting, i guess its using the default file which I dont want it to and now mixer setting need to be applied, but the problem I have is alsa_ctl returns error as above

  • Hi Titus and Clemens,


    Final piece of the jigsaw,

    I manually configured the mixer and it seems working fine now. I had to use following settings

    alsa_amixer cset numid=56 on
    alsa_amixer cset numid=57 on
    alsa_amixer cset numid=58 on
    alsa_amixer cset numid=52 on
    alsa_amixer cset numid=53 on
    alsa_amixer cset numid=54 on
    alsa_amixer cset numid=13 3,0
    alsa_amixer cset numid=3 30,30
    alsa_amixer cset numid=5 1,0

    Thanks for all your help. Mixer setting get reset after boot i'll see what I can do in kernel to those put in file or use some shell script.

    Regards

    Ali

  • Hi Titus,

    I lose my mixer settings every time I reboot. I can not see any asound.conf file nor asound.state file in /etc/

    Infact the /etc directory is not created at all. Can you please advise on that

    Thanks

  • Hi Ali,

    I'm glad that you were able to fix it.

    I lose my mixer settings every time I reboot. I can not see any asound.conf file nor asound.state file in /etc/

    You can add these commands into any one of runlevel scripts which you use current runlevel or init.rc

  • Hi Titus,


    I am a little confused on this not sure whats going on, when the android is running on the target and when I do

    adb shell

    ls now retunrs etc directory

    # ls
    d
    data
    wl1271bt_enable
    proc
    cache
    sys
    init
    init.rc
    sdcard
    acct
    system
    default.prop
    debug
    config
    initlogo.rle.bak
    etc
    dev
    ueventd.rc
    ueventd.goldfish.rc
    lost+found
    part-3
    init.goldfish.rc
    sbin
    mnt
    # cd etc
    # ls
    wifi
    ppp
    hosts
    permissions
    security
    vold.fstab
    dbus.conf
    init.goldfish.sh
    firmware
    apns-conf.xml
    NOTICE.html.gz
    bluetooth
    event-log-tags
    dhcpcd

    When I connect the SD card to PC and view there is no etc directory.

  • Hi Ali,

    Attach your complete bootup log.

  • Hi Titus,

    Here is the serial log file 2465.capture.txt

    Here is the adb logcat file 6175.logcat.txt

  • Hi Ali,

    Try to create one test.txt file after boot and then connect that SD card into PC and check whether that test.txt file is there or not.

    If not available, it means the android mounted at different location.

    Your log seems to be you are mounting rootfs on SD card 2nd partition.

    So, do you have any eMMC interface on your board ?

  • Hi Titus,

    I have created the test.txt file from adb and it is present when SD card connected to PC. The android is mounted on SD card.

    Also I do not have eMMC interface on the board.

    Regards

  • Hi Ali,

    I lose my mixer settings every time I reboot.

    Create one script and paste all the audio mixer settings into it and tells to "init.rc" file to call for every boot.

    Ex:

    Append the below "service" line in init.rc

    init.rc

    service script /system/etc/init.d/script_audio
        oneshot

    Where 'script_audio' is the file which mixer settings of audio

  • Hi Titus,


    Thanks for the quick reply on that. I'll try that and post an update. What I have tried so far is modify the file hardware/ti/omap3/modules/alsa/alsa_module.cpp with my mixer settings and rebuild the file system and that is working too. I am not sure if that is the right way to do it or not. This is what I did,

            // Added ALI 08/09/2014
            control.set("PredriveL Mixer AudioL1", 1); //On
            control.set("PredriveL Mixer AudioL2", 1); //On
            control.set("PredriveL Mixer AudioR2", 1); //On

            control.set("PredriveR Mixer AudioR1", 1); //On
            control.set("PredriveR Mixer AudioR2", 1); //On
            control.set("PredriveR Mixer AudioL2", 1); //On

            control.set("PreDriv Playback Volume", 3,0);
            control.set("DAC2 Digital Coarse Playback Volume", 2);
            control.set("DAC2 Digital Fine Playback Volume", 2);

    Another issue related to sound settings is that under setting/sounds menu on android the default selection for "Play sound when making screen selection" is not selected but I have modified the file SoundSettings.java to select the checkbox and there is no sound when I do selection on screen, I have looked in sound_settings.xml and the default value is set to true as well not sure the issue there.

    I'll try your suggestion and post an update. In the mean time please do advise what I did in alsa_module.cpp is correct way or not.


    Regards

  • Hi Titus,

    I was just about to create the script and was wondering, I'll be able to do that manually but how can I make this part of rootfs that when built it is there by default.

    Regards

  • Hi Titus,

    Solved the audio both process work. Shell script and code base. Thanks for all your help and also clemens.

    Regards

    Ali

  • Hi Ali,

    Sounds good.

    Thanks for your update.