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.

Audio codec problem in dm365evm for Android 2.3

Other Parts Discussed in Thread: WL1271

Hi Android developers

                                          I ported android 2.3 on dm365evm, am equipped with all the services(internet,video,usb keyboard) except audio.

ISSUE1: I am unable to play any format audio files on dm365evm.

FYI : I had compiled the kernel 2.3.32 by enabling all sound driver and codec support related to dm365evm , and even i am getting this below messages while kernel loading

------------------------------------------------------------------

ALSA: Restoring mixer settings...

asoc: tlv320aic3x <-> davinci-i2s mapping ok
ALSA device list:
  #0: DaVinci EVM (tlv320aic3x)

----------------------------------------------------------------

Also , if i boot my uImage with the linux RFS , then i am able to get play the audio file by using aplay <file>.

But only when i boot same Uiamge with the android RFS(gingerbread), then m not able to hear any audio.

QUERY1: Is their anything which ineed to add support from the driver side?

can anyone help me on this ?

THANKS AND REGARDS

ROHIT Y SHANBHAG

BANGALORE

  • Hi Rohit,

    You probably need to modifiy Android HAL as per your driver.

    Please refer to below porting guide. It may give you some pointers.

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

    Regards,

    Pankaj Bharadiya

     

  • Hi Pankaj

                         Thanks again for the quick reply as always :)

    Well here is some observation : Kindly spend some minutes on this :

    As in the document :

    I carried out the steps said in document for testing the alsa support .

    ==================================================================================================

       1) ALSA framework as HAL we need to build Rowboat with following options in BoardConfig.mk (This is done sucessfully)

    BOARD_USES_ALSA_AUDIO := true
    BUILD_WITH_ALSA_UTILS := true

    =================================================================================================

    =================================================================================================
    2)In kernel driver configuration , 
    Sound card support and device support is been enabled.
    ALSA for SoC audio support also enabled.

     --- ALSA for SoC audio support                                                                                           
                                                          <*>   SoC Audio for the TI DAVINCI chip                                                                              
                                                        <*>   SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM                                                      
                                                      < >   Build all ASoC CODEC drivers                                                                               

    Its been told to enable McBSP support
    , but for dm365 system type , i dont find any McBSP support.


    =================================================================================================                 

    =================================================================================================
    3) As told , i created the link by running the following command from Android prompt.
    ln -s /system/bin/alsa_aplay /system/bin/alsa_arecord    -------------> and it worked .

    =================================================================================================
    
    
    =================================================================================================
    4)ALso by thinking the Audio capture channels AUXL and AUXR are by default disabled for DM365evm ASoC driver , 
    i tried to enable this by following and it gave me this result :

    alsa_amixer cset name='Analog Left AUXL Capture Switch' 1
    amixer: Cannot find the given element from control default

    alsa_amixer cset name='Analog Right AUXR Capture Switch' 1
    amixer: Cannot find the given element from control default
    =================================================================================================


    =================================================================================================
    5) I Run the following 'alsa_amixer' commands to fix the volume settings: I even think , its codecs are been muted by the driver !!

    # alsa_amixer set 'Headset' 3
    amixer: Unable to find simple control 'Headset',0

    # alsa_amixer set 'Analog' 0
    amixer: Unable to find simple control 'Analog',0
    =================================================================================================


    =================================================================================================
    6)List down all the Audio devices available on target(DM365evm) are :

    # alsa_aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: EVM [DaVinci EVM], device 0: AIC3X tlv320aic3x-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0

    =================================================================================================


    Sould i try to modify the alsa_handle_t _defaults[] or some other solution is their for this settings to set?


    Kindly reply me about this , so that i can proceed further.


    THANKS AND REGARDS
    ROHIT Y SHANBHAG
    BANGALORE








  • Hi Rohit,

    Kernel configuration and Alsa mixer controls mentioned in porting guide is specific to AM37x based devices.

    Please configure kernel and set mixer controls according to your driver.

    Please post logcat output so that we can look into this further.

    Regards,

    Pankaj Bharadiya

  • Hi Pankaj ,

                      Attached is teh logcat . Kindly go through it and need the idea to overcome this alsa issue .

    Anyhow , i am exploring on codes in detail.

    4405.audio_1.txt

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE

  • Hi Rohit,

    I see following log in your logcat. I think audio path is going through audio stub and not the HAL.

    W/AudioHardwareInterface( 1837): Using stubbed audio hardware. No sound will be produced.
    D/AudioHardwareInterface( 1837): setMode(NORMAL)
    I/CameraService( 1837): CameraService started (pid=1837)
    I/AudioFlinger( 1837): AudioFlinger's thread 0xc620 ready to

    Please make sure that

    BOARD_USES_GENERIC_AUDIO := true 
    line is commented in your BoardConfig.mk file.
     
    Regards,
    Pankaj Bharadiya
  • Good Morning Pankaj,

                                                      As per your previous post, We uncommented  " BOARD_USES_GENERIC_AUDIO := true " in our BoardConfig.mk, 

    1) This  is the BoardConfig.mk <FYR>

    ---------------------------------------------------------------------------------------------------------------------------------------------------------

    # DM365EVM configuration

    TARGET_NO_BOOTLOADER := true
    TARGET_NO_KERNEL := true
    TARGET_PROVIDES_INIT_RC := true
    TARGET_NO_RADIOIMAGE := true
    USE_CAMERA_STUB := true
    BOARD_USES_GENERIC_AUDIO := true
    BOARD_USES_ALSA_AUDIO := true
    BUILD_WITH_ALSA_UTILS := true

    ifeq ($(strip $(DSP_PATH)),)
     BUILD_WITHOUT_PV := true
     # If using 2.6.32 kernel then set USES_TI_WL1271 :=true
     # else if using 2.6.37 kernel then set USES_TI_WL1271_COMPAT := true
     #USES_TI_WL1271 := true
    #USES_TI_WL1271_COMPAT := true
     else
     BUILD_WITHOUT_PV := false
    endif

    #BUILD_WITH_FULL_STAGEFRIGHT := true

    #BUILD_PV_VIDEO_ENCODERS := 1

    #BOARD_USES_OMAP3_LIGHTS := true


    # Setup some runtime system properties.
    TARGET_BOARD_PLATFORM := TI
    TARGET_BOOTLOADER_BOARD_NAME := dm365evm
    TARGET_CPU_ABI  := armeabi

    #HARDWARE_OMX := true

    ifdef HARDWARE_OMX
    OMX_JPEG := true
    OMX_VENDOR := ti
    OMX_VENDOR_INCLUDES := \
       hardware/ti/omx/system/src/openmax_il/omx_core/inc \
       hardware/ti/omx/image/src/openmax_il/jpeg_enc/inc
    OMX_VENDOR_WRAPPER := TI_OMX_Wrapper
    BOARD_OPENCORE_LIBRARIES := libOMX_Core
    BOARD_OPENCORE_FLAGS := -DHARDWARE_OMX=1
    endif

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    So, with this as our BoardConfig .mk, we build the RFS and Booted successfully.

    Thus Problem remain same.

     W/AudioHardwareInterface( 1837): Using stubbed audio hardware. No sound will be produced.
    D/AudioHardwareInterface( 1837): setMode(NORMAL)
    I/CameraService( 1837): CameraService started (pid=1837)
     I/AudioFlinger( 1837): AudioFlinger's thread 0xc630 ready to run
     I/SamplingProfilerIntegration( 1836): Profiler is disabled.

    -------------------------------------------------------------------------------------------

    2)From command line console

    # alsa_aplay -l
     **** List of PLAYBACK Hardware Devices ****
     card 0: EVM [DaVinci EVM], device 0: AIC3X tlv320aic3x-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0

    ------------------------------------------------------------------------------------------

    We even tried playing a mp3 and wav format file
    result as below

     #alsa_aplay teri_meri_flute_high.mp3
    Playing raw data 'teri_meri_flute_high.mp3' : Unsigned 8 bit, Rate 8000 Hz, Mono

    < We could hear some noise , till we kill the process>

    When we tried to play the same file from GUI , AUDIO OUTPUT WAS NOT THERE

    3) We also noticed in logcat  :

    ------------------------------------------------------------------------------------------

     I/SystemServer( 1864): Audio Service
     D/AudioHardwareInterface( 1837): setMode(NORMAL)
     W/AudioPolicyManagerBase( 1837): setPhoneState() setting same state 0
    D/dalvikvm( 1864): GC_CONCURRENT freed 568K, 50% free 3598K/7111K, external 716K/1038K, paused 13ms+22ms
     I/SystemServer( 1864): Headset Observer
     W/HeadsetObserver( 1864): This kernel does not have wired headset support
    I/SystemServer( 1864): Dock Observer
     W/DockObserver( 1864): This kernel does not have dock station support
     I/SystemServer( 1864): USB Observer
     W/UsbObserver( 1864): This kernel does not have USB configuration switch support
     E/UsbObserver( 1864):
     E/UsbObserver( 1864): java.lang.NullPointerException
     E/UsbObserver( 1864):     at com.android.server.UsbObserver.init(UsbObserver.java:131)
    E/UsbObserver( 1864):     at com.android.server.UsbObserver.<init>(UsbObserver.java:65)
     E/UsbObserver( 1864):     at com.android.server.ServerThread.run(SystemServer.java:402)

    ----------------------------------------------------------------------------------------------

    Is this the exact issue which is causing for no audio output ! ?

    if yes , then kindly suggest us  modification should be done in kernel .

    <FYR , Kindly find the detail logcat with the attached document. >

    4744.logcat.txt

    THANKS AND REGARDS

    ROHIT Y SHANBHAG
    BANGALORE

  • Rohit Shanbhag said:

    BOARD_USES_GENERIC_AUDIO := true
    BOARD_USES_ALSA_AUDIO := true
    BUILD_WITH_ALSA_UTILS := true

    You need to comment out or delete BOARD_USES_GENERIC_AUDIO := true to get android to use alsa.

  • HI Bhat,

                  We have tried by commenting "BOARD_USES_GENERIC_AUDIO := true" 

    In BoardConfig.mk file , thus we didnt found any audio output.

    On posting this issue , we were told to uncomment this part and to try.

    FYR : Kindly refer our previous post .

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE


  • HI Pankaj / Bhat

    "WAITING FOR REPLY"

                                  my Observation on reading many blogs related to android sound !

    1) Audio players read /system/etc/asound.conf  to get the hardware info.

    I was not having these files, so may be player is sending output stream and am not able to recieve it?

    So player is working fine(it navigates when i play the song/video) but I was not getting any sound.

    2)Where can i find the asound.conf for dm365 ?

    Is this responsible for no audio ?

    From some TI post , i found , we need to change the The file hardware/ti/omap3/modules/alsa/alsa_module.cpp  to reflect the amixer changes.

    I am not getting what to change in this particular code ?
    can anyone suggest on this ?

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE

  • Refer to http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_PortingGuides#Android_Audio_HAL_Configuration

    You need to ensure that the audio HAL is properly configuring the audio setup necessary as per your kernel capabilities. The above link gives the ALSA settings for omap3evm. The ALSA settings for your device may be different and so you need to modify the HAL accordingly.

  • Hi Rohit,

    I understand that your music app shows audio playback, and no sound is produced.

    This could be because the audio stub is still enabled. More over you are able to listen audio with aplay.

    Make sure that you have the following lines in your BoardConfig.mk file.

    #BOARD_USES_GENERIC_AUDIO := true
    BOARD_USES_ALSA_AUDIO := true
    BUILD_WITH_ALSA_UTILS := true

    Also, you need to do a clean build after the above lines are changed. Then only the new andorid-alsa libraries will be built into the file system.

  • Hi Arun,

                      Thanks for your reply!

    well, i changed the BoardConfig.mk file and commented  BOARD_USES_GENERIC_AUDIO := true, clean it and build the sources again .

    but still there is no improvement in sound output!

    Can you please tell, why this issue is raised up ?

    logs are :

    W/AudioHardwareInterface( 1807): Using stubbed audio hardware. No sound will be produced.
    D/AudioHardwareInterface( 1807): setMode(NORMAL)
    I/CameraService( 1807): CameraService started (pid=1807)
    I/AudioFlinger( 1807): AudioFlinger's thread 0xc5d0 ready to run

    detailed log is been attached below :

    7558.02_march_android_sound_rfs.txt

    Kindly reply on thsi and suggest some trick to come  out of thsi issue.

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE

    W/AudioHardwareInterface( 1807): Using stubbed audio hardware. No sound will be produced.
    D/AudioHardwareInterface( 1807): setMode(NORMAL)
    I/CameraService( 1807): CameraService started (pid=1807)
    I/AudioFlinger( 1807): AudioFlinger's thread 0xc5d0 ready to run

  • Hi Rohit,

    At this point of time I assume that you have alsa_aplay working. Also you have the lines I suggested in your BoardConfig.mk.

    Can you check whether you have the alsa.<target platform>.so present in your /system/lib/hw folder?

    If not you need to generate one by compiling

    /data/pm/sources/2.3.4_release/hardware/ti/omap3/modules/alsa for your platform.

    Also you need to add this library in <evm>.mk in device/ti/<evm>

  • Hi arun ,

    1)  Yes,  alsa_aplay is working , that too only i can play .wav file from command line .

    2)Also, i have commented line said , in BoardConfig.mk , cleaned and build.

    3)Yes , in /system/lib/hw , their is no alsa.dm365.so found !

    so you mean to say , i need to alter the alsa_module.cpp  file and build it again right ?

    Thanks for clue !

    will work on it now

    REGARDS

    ROHIT Y SHANBHAG

    BANGALORE

  • Hi Arun THANKS FOR THE QUICK REPLY AND YES WE GOT SOUND ON DM365 android. But we have a minor issue ! we have made all the volume (ringtone , media and notification high), still we get very low sound in headphone ! How to trace this ? i looked in the alsa code in external and hardware folder of main directory. but i am unable to find the solution. Kindly reply for this ! THANKS AND REGARDS ROHIT Y SHANBHAG BANGALORE
  • You may wish to keep the default volume in alsa HAL to maximum (or close to it).

    AFAIK, currently the android volume controls are not fully linked to alsa volume controls

  • HI arun ,

                        Waiting for the reply arun ! , on how to make sound loud in dm365 android !

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE

  • Hi Rohit,

    Are you getting the same volume when you are doing "alsa_aplay" ?

    There must be some volume controls present in amixer. You need to set your amixer volume controls to maximum to get the loudest volume in alsa_aplay.

    Once you identify the right controls you can set the same in alsa_module.cpp.

  • Hi arun

                         THANKS FOR YOUR REPLY .

    the maximum playback limit is 0-127 on setting

    alsa_amixer set PCM 127

    and also it showing the maximum sound playback limit is 0-127.

    MY QUERY : so Is 127 is my maximum playback limit on dm365 ? or can i increase it somewhere in the code ? if so ,then where ?

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE 

  • Hi Rohit,

    Are you able to hear the audio loud (alsa_aplay) when you set your volume to maximum?

    If so, you set the same control in alsa_module.cpp.

    If volume is not being changed when setting the amixer control, then it is not the right control for volume. Please check with the audio driver developer.

  • Hi arun

                   Yes i can hear audio variance once i set the PCM value fro 0-127 using alsa_amixer.

    Well, for 127 , i am getting the maximum loudeness in audio.

    Yes i am modified the code alsa_module.cpp and building the source , will reply you about this in my immediate next post.

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE

  • Hi Arun ,

                        Thanks for the reply on audio codec ISSUE !

    Well now audio is playing much louder than before . but 127 i sthe maximum for dm365 :)

    THANKS AND REGARDS

    ROHIT Y SHANBHAG

    BANGALORE