Hi All,
I'm using sabresd board with imx6 Android7.1.2 platform. I'm trying play some audio with command, I'm able to hear on headset and HDMI is not connected on this time. If i connect HDMI i'm not able hear on headset jack.
I think audio routing to HDMI interface.
I want audio output always on Headset jack. How can resolve this issue??
Regards,
Aravinth
Hello, I have similar issue. Please check details and help if you have any suggestion on this issue.
Platform: IMX8M Custom Board
OS: Android 11
Kernel: 5.10.9-678025-gbccc0b2805b7-dirty
Codec: SGTL5000
Problem: Default Sound Audio Output with Line-Out
My problem is about changing default android stream value to lineout. I have successfully play a .wav file by usind tinyplay command. So the codec is working correctly. But when ı play a example video by using gallery app which is am start -n com.android.gallery3d/.app.MovieActivity -d example.mp4, video opened on my lvds screen but ı did not hear voice from lineout. There is no any sound. As you know, we should hear a voice while we trying change alarm sound or notification sound. But there is no any sound when ı click any sound effect on settings. So, problem is in android os itself.
When ı google about this, ı have seen that there is a conf file which is named audio_policy_configuration.xml, ı have changed defaultOutputDevice as lineout as it shown below.
<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<globalConfiguration speaker_drc_enabled="true"/>
<modules>
<module name="primary" halVersion="2.0">
<attachedDevices>
<item>Speaker</item>
<item>Built-In Mic</item>
<item>Line-Out</item>
So when ı build according to this configuraiton, and write the image into sd card, if ı am using dcss-lvds image(which is not working as lineout), ı do not see line routing by checking it dumpsys audio command. But when ı the same issue by using hdmi image, dumsys audio log comes with line routing as ı need. I have realized that when there is a sound card which is named "imx-audio-hdmi", audio routing will be working correctly. But in dcss-lvds image, even ı have enabled imx-audio-hdmi in .dts file, there is no any sound card which is name "imx-audio-hdmi" and audiorouting is not working.
Where can it be problem ? Is there any other configuration parameter except audio_policy_configuration.xml ? Why ı must have imx-audio-hdmi in android ?
Attached file explanations:
audio_policy_configuration.txt: My configuration
dmesg hdmi image .txt: Dmesg log for hdmi image
dumpsys audio_hdmi.txt: Audio service log for hdmi image
dmesg dcss-lvds image.txt : Dmesg for dcss-lvds image. There is no imx-audio-hdmi sound card.
dumpsys audio dcss-lvds.txt: audio service log for dcss lvds image. Check there is no any roting as devices
this is my default device chosing way in xml file.
<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<globalConfiguration speaker_drc_enabled="true"/>
<modules>
<module name="primary" halVersion="2.0">
<attachedDevices>
<item>Speaker</item>
<item>Built-In Mic</item>
<item>Line-Out</item>
</attachedDevices>
<defaultOutputDevice>Line-Out</defaultOutputDevice> <!-- Topkarag it was Speaker Before-->
<mixPorts>
<mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY|AUDOI_OUTPUT_FLAG_DIRECT"> <!-- Flag Direct added by topkarag -->
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>
check txt file for details
Hi,
i found the solution for this, we can choose the output in our android source code.
In default, android will route audio into HDMI, to choose route into speaker:
AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
audioManager .setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.setSpeakerphoneOn(true);
To choose route to HDMI again, set mode to normal:
audioManager.setMode(AudioManager.MODE_NORMAL);
Regards,
Hi Nguyen
Can you give the exact file name and location in android source code.
Can you please attach the modified file also.!
Regards,
Aravinth
Hi Aravinth,
this code does not implement in AOSP, you have to write it in your own android application.
OR you can write one android service run in background, it listens HDMI plugged and then set route audio to speaker automatically.
Regards,
Hello Nguyen,
Is there any way to integrate these changes to the default Android source code, so that audio output is only on headphone irrespective of a HDMI connected to the board neither writing an app nor a background service. If there is a way for implementing this, kindly let me know!!
Regards,
Deexith
Hi Deexith,
In Android 7, i can overlay audio_policy_configuration to change the default audio route path from speaker -> headphone.
Please try to change 'defaultOutputDevice' in file: audio_policy_configurations.xml
Regards,
Hello @Nguyen,
My first approach was same as ur'z!! Since default wm8524-codec configuration file din't have a digital aux support, audio was not routing to headphone. I solved this by adding a digital aux support in wm8524-codec configuration file inside alsa.
Regards,
Deexith V
Hi Deexith,
In Android HAL you can do the modification, to set audio output as headphone all the time.
Regards,
Aravinth
Hello aravinthkumarjayaprakasam,
Can you please be more specific on this, i mean which file to look into and what exactly are the changes.
Regards,
Deexith
Can you please share more details about your hardware, Audio module, Android version,etc.
Regards,
Aravinth
I am porting Android 8.1.0 on i.MX8M EVK which has WM8524 codec support
Regards,
Deexith
Hi Deexith,
Audio path selection will happen on below code.
hardware/imx/alsa/tinyalsa_hal.c
You select which output stream you want.
Regards,
Aravinth
I have the same problem on imx6 android 6.0.1. It routes audio to HDMI when plugged. Don't know where to config output.
You can choose the output with alsamixer.
Have a great day,
Victor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi @Victor Linnik,
Is there any update on this.?
Regards,
Aravinth
Hi Victor,
Thanks for the response. I have checked and tinyalsa layer. But i didn't get what exactly i have to change.
Have give me more about and exact information about it.
Thanks
Aravinth!