Audio route into headset jack on sabresd

cancel
Showing results for 
Search instead for 
Did you mean: 

Audio route into headset jack on sabresd

1,293 Views
aravinthkumarja
Senior Contributor II

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

0 Kudos
15 Replies

384 Views
nguyenmr
Contributor III

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,

0 Kudos

384 Views
aravinthkumarja
Senior Contributor II

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

0 Kudos

384 Views
nguyenmr
Contributor III

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,

0 Kudos

384 Views
deexithamba
Contributor III

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

0 Kudos

384 Views
nguyenmr
Contributor III

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,

0 Kudos

384 Views
deexithamba
Contributor III

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

0 Kudos

384 Views
aravinthkumarja
Senior Contributor II

Hi Deexith,

In Android HAL you can do the modification, to set audio output as headphone all the time.

Regards,

Aravinth

0 Kudos

384 Views
deexithamba
Contributor III

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

0 Kudos

384 Views
aravinthkumarja
Senior Contributor II

Can you please share more details about your hardware, Audio module, Android version,etc.

Regards,

Aravinth

0 Kudos

384 Views
deexithamba
Contributor III

I am porting Android 8.1.0 on i.MX8M EVK which has WM8524 codec support

Regards,
Deexith

0 Kudos

384 Views
aravinthkumarja
Senior Contributor II

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

0 Kudos

384 Views
nguyenmr
Contributor III

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.

0 Kudos

384 Views
b36401
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

384 Views
aravinthkumarja
Senior Contributor II

Hi @Victor Linnik,

Is there any update on this.?

Regards,

Aravinth

0 Kudos

384 Views
aravinthkumarja
Senior Contributor II

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!

0 Kudos