How to correctly configure audio data transfer from i2s to Android apps?

Which system do you use? Android, Ubuntu, OOWOW or others?

Android 11

Which version of system do you use? Khadas official images, self built images, or others?

Self built image (Linux version 5.4.125-android11-2-g602415380f33-dirty)

Please describe your issue below:

I try use my VIM4 with external audio codec. Codec connected to I2S_1. Sound playback works without problems, but there are problems with audio capturing. When I use tinycap for TDM B I get a wav file with audio from the codec. It’s work fine. But all android app try captured built in micro. I disable built in micro in dts, but it don’t help me. I add dirty hack in hardware/amlogic/audio/audio_hal/audio_hw.c

/** audio_stream_in implementation **/
static unsigned int select_port_by_device(struct aml_stream_in *in)
{
    ALOGW("FORCE USE PORT_I2S\n");
    return PORT_I2S;
}

After that, Android apps began capture correct interface. In console:

[ 8009.144997@2]  aml_set_tdm_mclk:set mpll_freq: 491520000
[ 8009.145579@2]  asoc-aml-card auge_sound: tdm prepare capture
[ 8009.146694@2]  asoc-aml-card auge_sound: TDM[1] Capture enable

But apps don’t receive data, only silence.

How to correctly configure audio data transfer from i2s to Android apps? Thank you.

@EvgenSen You can refer to this submission for similar modifications. You can add the corresponding print information and then add the code you want to control based on the print information.

hardware/amlogic/audio$ git log -p 4ee13e15f17ad2dba8933f2bf91f7ef9bb0a5f6a
commit 4ee13e15f17ad2dba8933f2bf91f7ef9bb0a5f6a
Date:   Thu Apr 28 09:45:01 2022 +0000

    audio:set pcm in to pdm
    
diff --git a/utils/alsa_device_parser.c b/utils/alsa_device_parser.c
index 0edeed4..7e448c0 100644
--- a/utils/alsa_device_parser.c
+++ b/utils/alsa_device_parser.c
@@ -449,7 +449,11 @@ int alsa_device_update_pcm_index(int alsaPORT, int stream)
 
        ALOGD("auge sound card, pAdd=%p fix alsaPORT:%d to :%d\n",pADD, alsaPORT, new_port);
        /* dump_alsa_device_desc(p_info); */
-
+       //Set MIC to PDM
+       if(alsaPORT == PORT_BUILTINMIC){
+               new_port = 3;
+       }
+       //add end
        return new_port;
 }

I revert my changes and modify file:

@@ -451,7 +454,7 @@ int alsa_device_update_pcm_index(int alsaPORT, int stream)
        /* dump_alsa_device_desc(p_info); */
        //Set MIC to PDM
        if(alsaPORT == PORT_BUILTINMIC){
-               new_port = 3;
+               new_port = 1;
        }

based on:

/*
 * alsaPORT is kept same with meson sound card
 * cat /proc/asound/pcm
 * 00-00: TDM-A-dummy-alsaPORT-pcm multicodec-0 :  : playback 1 : capture 1
 * 00-01: TDM-B-dummy-alsaPORT-i2s multicodec-1 :  : playback 1 : capture 1
 * 00-02: TDM-C-dummy multicodec-2 :  : playback 1 : capture 1
 * 00-03: PDM-dummy-alsaPORT-pdm dummy-3 :	: capture 1
 * 00-04: SPDIF-dummy-alsaPORT-spdif dummy-4 :	: playback 1 : capture 1
 * 00-05: SPDIF-B-dummy-alsaPORT-hdmi dummy-5 :  : playback 1
 */
int alsa_device_update_pcm_index(int alsaPORT, int stream)

Now I have same situation. In log i see “TDM[1] Capture enable”, but no sound.

@EvgenSen How do you determine that the data source being hunted is built in mic?
I suggest you use the following command to grab the recording log and post it for viewing.

logcat -s audio_hw_primary

Send me your recording APK for verification, or try me to verify the OK recording APK.
The following is the log information that I verified as OK:

06-16 01:09:03.154   383   383 I audio_hw_primary: ++[adev_set_audio_port_config:9539] audio_port id:2, role:SINK, type:DEVICE
06-16 01:09:03.154   383   383 I audio_hw_primary: patch found mix->dev patch id:1, sink id:2, patchset:0xeef42020
06-16 01:09:03.154   383   383 I audio_hw_primary:  - set sink device[0x2](outport:SPEAKER): volume_Mb[-3200], gain[0.025119]
06-16 01:09:03.154   383   383 I audio_hw_primary:  - now the sink gains are:
06-16 01:09:03.154   383   383 I audio_hw_primary:      - OUTPORT_SPEAKER->gain[0.025119]
06-16 01:09:03.154   383   383 I audio_hw_primary:      - OUTPORT_HDMI_ARC->gain[1.000000]
06-16 01:09:03.154   383   383 I audio_hw_primary:      - OUTPORT_HEADPHONE->gain[1.000000]
06-16 01:09:03.154   383   383 I audio_hw_primary:      - OUTPORT_HDMI->gain[1.000000]
06-16 01:09:03.154   383   383 I audio_hw_primary:      - OUTPORT_ANLG_DOCK_HEADSET->gain[1.000000]
06-16 01:09:03.154   383   383 I audio_hw_primary:      - active outport is: SPEAKER
06-16 01:09:03.157   383   480 D audio_hw_primary: adev_open_input_stream: enter: devices(0x80000004) channel_mask(0x10) rate(48000) format(0x3) source(1)
06-16 01:09:03.157   383   480 D audio_hw_primary: check_input_parameters(sample_rate=48000, format=3, channel_count=1, devices = 80000004)
06-16 01:09:03.157   383   480 D audio_hw_primary: adev_open_input_stream: exit
06-16 01:09:03.157   383  1854 I audio_hw_primary: ++++[usecase_change_validate_l:7666],continuous:0 dev masks:0,out masks:0,out usecase:PCM_NORMAL,aml_out:0xf1040540
06-16 01:09:03.157   383  1854 I audio_hw_primary: [usecase_change_validate_l:7712],1 process_buffer_write
06-16 01:09:03.157   383  1854 I audio_hw_primary: ----[usecase_change_validate_l:7741], continuous:0 dev masks:0x1, out masks:0x1, out usecase:PCM_NORMAL
06-16 01:09:03.157   383  1854 I audio_hw_primary: process_buffer_write(), standby to unstandby
06-16 01:09:03.158   383   480 D audio_hw_primary: in_get_buffer_size: enter: channel_mask(0x10) rate(48000) format(0x3)
06-16 01:09:03.158   383   480 D audio_hw_primary: in_get_buffer_size: exit: buffer_size = 4096
06-16 01:09:03.159   383   480 D audio_hw_primary: in_get_buffer_size: enter: channel_mask(0x10) rate(48000) format(0x3)
06-16 01:09:03.159   383   480 D audio_hw_primary: in_get_buffer_size: exit: buffer_size = 4096
06-16 01:09:03.160   383  1854 I audio_hw_primary: hw_write, aml_out 0xf1040540 alsa open output_format 0x1
06-16 01:09:03.160   383   480 D audio_hw_primary: in_standby: enter: stream(0xedbc1b90)
06-16 01:09:03.160   383   480 D audio_hw_primary: do_input_standby(0xedbc1b90) in->standby = 1
06-16 01:09:03.160   383   480 D audio_hw_primary: in_standby: exit
06-16 01:09:03.160   383  1854 I audio_hw_primary:
06-16 01:09:03.160   383  1854 I audio_hw_primary: +aml_alsa_output_open stream 0xf1040540,device 0
06-16 01:09:03.160   383  1854 I audio_hw_primary: aml_alsa_output_open pcm 0x0
06-16 01:09:03.160   383  1854 I audio_hw_primary: aml_alsa_output_open, audio open card(0), device(1)
06-16 01:09:03.160   383  1854 I audio_hw_primary: ALSA open configs: channels 8 format 1 period_count 6 period_size 512 rate 48000
06-16 01:09:03.160   383  1854 I audio_hw_primary: ALSA open configs: threshold start 0 stop 0 silence 0 silence_size 0 avail_min 0
06-16 01:09:03.160   383  1854 I audio_hw_primary: pcm_open: flag = 0, card = 0, device = 1
06-16 01:09:03.160   383   480 D audio_hw_primary: in_standby: enter: stream(0xedbc1b90)
06-16 01:09:03.161   383   480 D audio_hw_primary: do_input_standby(0xedbc1b90) in->standby = 1
06-16 01:09:03.161   383   480 D audio_hw_primary: in_standby: exit
06-16 01:09:03.170   383   480 I audio_hw_primary: [adev_create_audio_patch:8912] sources:1 sinks:1 DEVICE->MIX new id:3 patch_src:INVAL
06-16 01:09:03.170   383   480 I audio_hw_primary: [adev_create_audio_patch:9103] dev(BUILTIN_MIC) -> mix(46) patch, patch_src:INVAL, in dev:0x80000004
06-16 01:09:03.178   383  4466 D audio_hw_primary: *start_input_stream, open alsa_card(0 11) alsa_device(3), in_device:0x4
06-16 01:09:03.178   383  4466 I audio_hw_primary: pcm_open: flag = 10000018, card = 0, device = 3
06-16 01:09:03.226   383  1854 I audio_hw_primary: -aml_alsa_output_open, audio out(0xf1040540) device(0) refs(1) is_normal_pcm 1, handle 0xf0e41d20
06-16 01:09:03.226   383  1854 I audio_hw_primary:
06-16 01:09:03.226   383  1854 I audio_hw_primary: +aml_alsa_output_open, adev->pcm_handle[0] 0xf0e41d20
06-16 01:09:03.227   383  4466 D audio_hw_primary: pcm_open in: card(0), port(11)
06-16 01:09:03.227   383  4466 D audio_hw_primary: start_input_stream: device(4) channels=1 period_size=1024 rate=48000 requested_rate=48000 mode= 0
06-16 01:09:03.372   383  1854 I audio_hw_primary: aml_alsa_output_write alsa_running_status[0xf1040540] change from 0 to 1

When app capturing sound from built in mic, in dmesg i see:

[  137.270302@2]  asoc-aml-card auge_sound: PDM Capture start

When app capturing sound from I2S (external codec), in dmesg i see:

[  268.061761@4]  asoc-aml-card auge_sound: TDM[1] Capture enable

I use your apk and get the following logs.
logcat:

06-19 11:00:12.026   402   481 D audio_hw_primary: adev_get_input_buffer_size: enter: channel_mask(0x10) rate(44100) format(0x1)
06-19 11:00:12.026   402   481 D audio_hw_primary: check_input_parameters(sample_rate=44100, format=1, channel_count=1, devices = 0)
06-19 11:00:12.026   402   481 D audio_hw_primary: adev_get_input_buffer_size: exit: buffer_size = 1881
06-19 11:00:12.026   402   402 I audio_hw_primary: ++[adev_set_audio_port_config:9565] audio_port id:2, role:SINK, type:DEVICE
06-19 11:00:12.026   402   402 I audio_hw_primary: patch found mix->dev patch id:1, sink id:2, patchset:0xf2e46040
06-19 11:00:12.026   402   402 I audio_hw_primary:  - set sink device[0x2](outport:SPEAKER): volume_Mb[-3200], gain[0.025119]
06-19 11:00:12.026   402   402 I audio_hw_primary:  - now the sink gains are:
06-19 11:00:12.026   402   402 I audio_hw_primary: 	- OUTPORT_SPEAKER->gain[0.025119]
06-19 11:00:12.026   402   402 I audio_hw_primary: 	- OUTPORT_HDMI_ARC->gain[1.000000]
06-19 11:00:12.026   402   402 I audio_hw_primary: 	- OUTPORT_HEADPHONE->gain[1.000000]
06-19 11:00:12.026   402   402 I audio_hw_primary: 	- OUTPORT_HDMI->gain[1.000000]
06-19 11:00:12.026   402   402 I audio_hw_primary: 	- OUTPORT_ANLG_DOCK_HEADSET->gain[1.000000]
06-19 11:00:12.026   402   402 I audio_hw_primary: 	- active outport is: SPEAKER
06-19 11:00:12.030   402  2223 I audio_hw_primary: ++++[usecase_change_validate_l:7684],continuous:0 dev masks:0,out masks:0,out usecase:PCM_NORMAL,aml_out:0xf5003920
06-19 11:00:12.031   402  2223 I audio_hw_primary: [usecase_change_validate_l:7730],1 process_buffer_write 
06-19 11:00:12.031   402  2223 I audio_hw_primary: ----[usecase_change_validate_l:7759], continuous:0 dev masks:0x1, out masks:0x1, out usecase:PCM_NORMAL
06-19 11:00:12.031   402  2223 I audio_hw_primary: process_buffer_write(), standby to unstandby
06-19 11:00:12.033   402  2223 I audio_hw_primary: hw_write, aml_out 0xf5003920 alsa open output_format 0x1
06-19 11:00:12.033   402  2223 I audio_hw_primary: 
06-19 11:00:12.033   402  2223 I audio_hw_primary: +aml_alsa_output_open stream 0xf5003920,device 0
06-19 11:00:12.033   402  2223 I audio_hw_primary: aml_alsa_output_open pcm 0x0
06-19 11:00:12.033   402  2223 I audio_hw_primary: aml_alsa_output_open, audio open card(0), device(1)
06-19 11:00:12.033   402  2223 I audio_hw_primary: ALSA open configs: channels 8 format 1 period_count 6 period_size 512 rate 48000
06-19 11:00:12.033   402  2223 I audio_hw_primary: ALSA open configs: threshold start 0 stop 0 silence 0 silence_size 0 avail_min 0
06-19 11:00:12.033   402  2223 I audio_hw_primary: pcm_open: flag = 0, card = 0, device = 1
06-19 11:00:12.039   402   402 D audio_hw_primary: adev_open_input_stream: enter: devices(0x80000004) channel_mask(0x10) rate(48000) format(0x3) source(1)
06-19 11:00:12.039   402   402 D audio_hw_primary: check_input_parameters(sample_rate=48000, format=3, channel_count=1, devices = 80000004)
06-19 11:00:12.039   402   402 D audio_hw_primary: adev_open_input_stream: exit
06-19 11:00:12.041   402   480 D audio_hw_primary: in_get_buffer_size: enter: channel_mask(0x10) rate(48000) format(0x3)
06-19 11:00:12.041   402   480 D audio_hw_primary: in_get_buffer_size: exit: buffer_size = 4096
06-19 11:00:12.041   402   480 D audio_hw_primary: in_get_buffer_size: enter: channel_mask(0x10) rate(48000) format(0x3)
06-19 11:00:12.041   402   480 D audio_hw_primary: in_get_buffer_size: exit: buffer_size = 4096
06-19 11:00:12.042   402   480 D audio_hw_primary: in_standby: enter: stream(0xf1bc1b90)
06-19 11:00:12.042   402   480 D audio_hw_primary: do_input_standby(0xf1bc1b90) in->standby = 1
06-19 11:00:12.042   402   480 D audio_hw_primary: in_standby: exit
06-19 11:00:12.044   402   480 D audio_hw_primary: in_standby: enter: stream(0xf1bc1b90)
06-19 11:00:12.044   402   480 D audio_hw_primary: do_input_standby(0xf1bc1b90) in->standby = 1
06-19 11:00:12.044   402   480 D audio_hw_primary: in_standby: exit
06-19 11:00:12.052   402  2223 I audio_hw_primary: -aml_alsa_output_open, audio out(0xf5003920) device(0) refs(1) is_normal_pcm 1, handle 0xf4ec0a60
06-19 11:00:12.052   402  2223 I audio_hw_primary: 
06-19 11:00:12.052   402  2223 I audio_hw_primary: +aml_alsa_output_open, adev->pcm_handle[0] 0xf4ec0a60
06-19 11:00:12.064   402   480 I audio_hw_primary: [adev_create_audio_patch:8933] sources:1 sinks:1 DEVICE->MIX new id:2 patch_src:INVAL
06-19 11:00:12.064   402   480 I audio_hw_primary: aml_audio_input_routing: switch from TUNER to BUILTIN_MIC
06-19 11:00:12.064   402   480 I audio_hw_primary: [adev_create_audio_patch:9127] dev(BUILTIN_MIC) -> mix(38) patch, patch_src:INVAL, in dev:0x80000004
06-19 11:00:12.068   402  3189 D audio_hw_primary: *start_input_stream, open alsa_card(0 11) alsa_device(1), in_device:0x4
06-19 11:00:12.068   402  3189 I audio_hw_primary: pcm_open: flag = 10000018, card = 0, device = 1
06-19 11:00:12.099   402  2223 I audio_hw_primary: aml_alsa_output_write alsa_running_status[0xf5003920] change from 0 to 1
06-19 11:00:12.115   402  3189 D audio_hw_primary: pcm_open in: card(0), port(11)
06-19 11:00:12.115   402  3189 D audio_hw_primary: start_input_stream: device(4) channels=1 period_size=1024 rate=48000 requested_rate=48000 mode= 0
06-19 11:00:15.127   402   480 D audio_hw_primary: out_standby_new: enter
06-19 11:00:15.128   402   480 I audio_hw_primary: [do_output_standby_l:5338] stream usecase:PCM_NORMAL , continuous:0
06-19 11:00:15.128   402   480 I audio_hw_primary: do_output_standby_l aml_out(0xf5003920)standby close
06-19 11:00:15.128   402   480 I audio_hw_primary: 
06-19 11:00:15.128   402   480 I audio_hw_primary: +aml_alsa_output_close() stream 0xf5003920
06-19 11:00:15.128   402   480 I audio_hw_primary: +aml_alsa_output_close, pcm handle 0xf4ec0a60 aml_out->pcm 0xf4ec0a60
06-19 11:00:15.128   402   480 I audio_hw_primary: +aml_alsa_output_close, adev->pcm_handle[0] 0xf4ec0a60
06-19 11:00:15.128   402   480 I audio_hw_primary: +aml_alsa_output_close, audio out(0xf5003920) device(0), refs(0) is_normal_pcm 1,handle 0xf4ec0a60
06-19 11:00:15.128   402   480 I audio_hw_primary: aml_alsa_output_close(), pcm_close audio device[0] pcm handle 0xf4ec0a60
06-19 11:00:15.129   402   480 I audio_hw_primary: -aml_alsa_output_close()
06-19 11:00:15.129   402   480 I audio_hw_primary: 
06-19 11:00:15.129   402   480 I audio_hw_primary: ++[usecase_change_validate_l:7619], dev masks:0x1, is_standby:1, out usecase:PCM_NORMAL
06-19 11:00:15.129   402   480 I audio_hw_primary: --[usecase_change_validate_l:7656], dev masks:0, is_standby:1, out usecase PCM_NORMAL
06-19 11:00:15.129   402   480 I audio_hw_primary: out_standby_new exit

dmesg:

[  267.971306@5]  audio_ddr_mngr: frddrs[0] registered by device fe330000.audiobus:tdm@1
[  267.972713@5]  aml_set_tdm_mclk:set mpll_freq: 491520000
[  267.973368@5]  master_mode(1), binv(1), finv(1) out_skew(2), in_skew(3)
[  267.988174@5]  aml_set_tdm_mclk:set mpll_freq: 491520000
[  267.997304@5]  aml_set_tdm_mclk:set mpll_freq: 491520000
[  268.001140@0]  update audio atmos flag! audio_type = 0
[  268.035834@4]  aml_set_tdm_mclk:set mpll_freq: 491520000
[  268.036497@4]  master_mode(1), binv(1), finv(1) out_skew(2), in_skew(3)
[  268.051239@4]  aml_set_tdm_mclk:set mpll_freq: 491520000
[  268.060055@4]  aml_set_tdm_mclk:set mpll_freq: 491520000
[  268.060750@4]  asoc-aml-card auge_sound: tdm prepare capture
[  268.061761@4]  asoc-aml-card auge_sound: TDM[1] Capture enable
[  271.065455@5]  audio_ddr_mngr: frddrs[0] released by device fe330000.audiobus:tdm@1

Device is correct. But the received file does not contain sound.
When I try to capture with tinycap the resulting file contains sound.

VIM4:/data # tinycap rec.wav -D 0 -d 1                                                                                                                                                                    
Capturing sample: 2 ch, 44100 hz, 16 bit
^CCaptured 630784 frames
VIM4:/data # 

Addition.
After starting the system, I run tinicap, it works, there is sound from the codec.
After that i run your app, there is no sound.
After that I start tinicap again, there is no sound anymore.
Sound from the codec will work only after a reboot.

@EvgenSen I have made the following modifications on my end, connecting to external codes and using the APK recording I uploaded is no problem. The following is the corresponding log information.

device/khadas$ git diff
diff --git a/kvim4/files/mixer_paths.xml b/kvim4/files/mixer_paths.xml
index 38f94cf..236adf8 100644
--- a/kvim4/files/mixer_paths.xml
+++ b/kvim4/files/mixer_paths.xml
@@ -38,7 +38,7 @@
   </path>
 
   <path name="main_mic">
-    <ctl name="TDMIN_B source select" value="acodec_adc" />
+    <ctl name="TDMIN_B source select" value="tdmin_b" />
   </path>
 
   <path name="headset-mic">
hardware/amlogic/audio$ git diff
diff --git a/utils/alsa_device_parser.c b/utils/alsa_device_parser.c
index bf0a110..c86b697 100644
--- a/utils/alsa_device_parser.c
+++ b/utils/alsa_device_parser.c
@@ -447,11 +447,12 @@ int alsa_device_update_pcm_index(int alsaPORT, int stream)
        if (pADD)
                new_port = pADD->mPcmIndex;
 
-       ALOGD("auge sound card, pAdd=%p fix alsaPORT:%d to :%d\n",pADD, alsaPORT, new_port);
+       ALOGD("hlm--00---auge sound card, pAdd=%p fix alsaPORT:%d to :%d\n",pADD, alsaPORT, new_port);
        /* dump_alsa_device_desc(p_info); */
        //Set MIC to PDM
        if(alsaPORT == PORT_BUILTINMIC){
-               new_port = 3;
+               new_port = 1;
+               ALOGD("hlm-----auge sound card, pAdd=%p fix alsaPORT:%d to :%d\n",pADD, alsaPORT, new_port);
        }
06-20 07:45:10.279   397   474 I audio_hw_primary: ++[adev_set_audio_port_config:9539] audio_port id:2, role:SINK, type:DEVICE
06-20 07:45:10.279   397   474 I audio_hw_primary: patch found mix->dev patch id:1, sink id:2, patchset:0xf2700010
06-20 07:45:10.279   397   474 I audio_hw_primary:  - set sink device[0x2](outport:SPEAKER): volume_Mb[-3200], gain[0.025119]
06-20 07:45:10.279   397   474 I audio_hw_primary:  - now the sink gains are:
06-20 07:45:10.279   397   474 I audio_hw_primary:      - OUTPORT_SPEAKER->gain[0.025119]
06-20 07:45:10.279   397   474 I audio_hw_primary:      - OUTPORT_HDMI_ARC->gain[1.000000]
06-20 07:45:10.279   397   474 I audio_hw_primary:      - OUTPORT_HEADPHONE->gain[1.000000]
06-20 07:45:10.279   397   474 I audio_hw_primary:      - OUTPORT_HDMI->gain[1.000000]
06-20 07:45:10.279   397   474 I audio_hw_primary:      - OUTPORT_ANLG_DOCK_HEADSET->gain[1.000000]
06-20 07:45:10.279   397   474 I audio_hw_primary:      - active outport is: SPEAKER
06-20 07:45:10.281   397  2317 I audio_hw_primary: ++++[usecase_change_validate_l:7666],continuous:0 dev masks:0,out masks:0,out usecase:PCM_NORMAL,aml_out:0xf4740fa0
06-20 07:45:10.281   397  2317 I audio_hw_primary: [usecase_change_validate_l:7712],1 process_buffer_write
06-20 07:45:10.281   397  2317 I audio_hw_primary: ----[usecase_change_validate_l:7741], continuous:0 dev masks:0x1, out masks:0x1, out usecase:PCM_NORMAL
06-20 07:45:10.281   397  2317 I audio_hw_primary: process_buffer_write(), standby to unstandby
06-20 07:45:10.281   397  2317 D audio_hw_utils: aml_audio_data_handle remaining_size:8192,  out->audio_data_handle_status:1
06-20 07:45:10.281   397  2317 D audio_hw_utils: aml_audio_data_handle  detected the nonzero data, remaining_size:8192  detected_size:0
06-20 07:45:10.281   397  2317 D audio_hw_utils: aml_audio_data_handle remaining_size:8192,  out->audio_data_handle_status:3
06-20 07:45:10.281   397  2317 D audio_hw_utils: aml_audio_data_handle remaining_size:8192,  out->audio_data_handle_status:4
06-20 07:45:10.281   677  2903 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
06-20 07:45:10.281   397  2317 D audio_hw_utils: aml_audio_data_handle remaining_size:8192,  out->audio_data_handle_status:5
06-20 07:45:10.281   397   474 D audio_hw_primary: adev_get_input_buffer_size: enter: channel_mask(0x10) rate(44100) format(0x1)
06-20 07:45:10.281   397   474 D audio_hw_primary: check_input_parameters(sample_rate=44100, format=1, channel_count=1, devices = 0)
06-20 07:45:10.282   397   474 D audio_hw_primary: adev_get_input_buffer_size: exit: buffer_size = 1881
06-20 07:45:10.282   397  2317 D audio_hw_utils: aml_audio_data_handle  easing_time:42, audio_stream_ease->ease_time:40
06-20 07:45:10.282   677  2903 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
06-20 07:45:10.284   397  2317 I audio_hw_primary: hw_write, aml_out 0xf4740fa0 alsa open output_format 0x1
06-20 07:45:10.284   397  2317 I audio_hw_primary:
06-20 07:45:10.284   397  2317 I audio_hw_primary: +aml_alsa_output_open stream 0xf4740fa0,device 0
06-20 07:45:10.284   397  2317 I audio_hw_primary: aml_alsa_output_open pcm 0x0
06-20 07:45:10.284   397  2317 D AudioALSADeviceParser: hlm--00---auge sound card, pAdd=0xf2541410 fix alsaPORT:0 to :1
06-20 07:45:10.284   397  2317 I audio_hw_primary: aml_alsa_output_open, audio open card(0), device(1)
06-20 07:45:10.284   397  2317 I audio_hw_primary: ALSA open configs: channels 8 format 1 period_count 6 period_size 512 rate 48000
06-20 07:45:10.284   397  2317 I audio_hw_primary: ALSA open configs: threshold start 0 stop 0 silence 0 silence_size 0 avail_min 0
06-20 07:45:10.284   397  2317 I audio_hw_primary: pcm_open: flag = 0, card = 0, device = 1
06-20 07:45:10.287     0     0 I [  280.596106@6]  audio_ddr_mngr: frddrs[0] registered by device fe330000.audiobus:tdm@1
06-20 07:45:10.287   425   524 W ServiceManager: Permission failure: android.permission.CAPTURE_AUDIO_OUTPUT from uid=10062 pid=4790
06-20 07:45:10.287   425   524 D PermissionCache: checking android.permission.CAPTURE_AUDIO_OUTPUT for uid=10062 => denied (527 us)
06-20 07:45:10.289   425   524 W ServiceManager: Permission failure: android.permission.CAPTURE_AUDIO_HOTWORD from uid=10062 pid=4790
06-20 07:45:10.289   425   524 D PermissionCache: checking android.permission.CAPTURE_AUDIO_HOTWORD for uid=10062 => denied (385 us)
06-20 07:45:10.290   397   474 D audio_hw_primary: adev_open_input_stream: enter: devices(0x80000004) channel_mask(0x10) rate(48000) format(0x3) source(1)
06-20 07:45:10.290   397   474 D audio_hw_primary: check_input_parameters(sample_rate=48000, format=3, channel_count=1, devices = 80000004)
06-20 07:45:10.290   397   474 D audio_hw_primary: adev_open_input_stream: exit
06-20 07:45:10.291   397   474 D audio_hw_primary: in_get_buffer_size: enter: channel_mask(0x10) rate(48000) format(0x3)
06-20 07:45:10.291   397   474 D audio_hw_primary: in_get_buffer_size: exit: buffer_size = 4096
06-20 07:45:10.292   397   474 D audio_hw_primary: in_get_buffer_size: enter: channel_mask(0x10) rate(48000) format(0x3)
06-20 07:45:10.292   397   474 D audio_hw_primary: in_get_buffer_size: exit: buffer_size = 4096
06-20 07:45:10.292   425  4901 I AudioFlinger: AudioFlinger's thread 0xb4000074f72a1040 tid=4901 ready to run
06-20 07:45:10.292   397   474 D audio_hw_primary: in_standby: enter: stream(0xf1344a50)
06-20 07:45:10.292   397   474 D audio_hw_primary: do_input_standby(0xf1344a50) in->standby = 1
06-20 07:45:10.292   397   474 D audio_hw_primary: in_standby: exit
06-20 07:45:10.296   397   474 D audio_hw_primary: in_standby: enter: stream(0xf1344a50)
06-20 07:45:10.296   397   474 D audio_hw_primary: do_input_standby(0xf1344a50) in->standby = 1
06-20 07:45:10.296   397   474 D audio_hw_primary: in_standby: exit
06-20 07:45:10.296   677  2903 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
06-20 07:45:10.296   677  2903 I chatty  : uid=1000(system) Binder:677_E identical 1 line
06-20 07:45:10.297   677  2903 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
06-20 07:45:10.310   397   474 I audio_hw_primary: [adev_create_audio_patch:8912] sources:1 sinks:1 DEVICE->MIX new id:2 patch_src:INVAL
06-20 07:45:10.310   397   474 I audio_hw_primary: aml_audio_input_routing: switch from TUNER to BUILTIN_MIC
06-20 07:45:10.310   397   474 D audio_route: Apply path: main_mic
06-20 07:45:10.311   397   474 I audio_hw_primary: [adev_create_audio_patch:9103] dev(BUILTIN_MIC) -> mix(38) patch, patch_src:INVAL, in dev:0x80000004
06-20 07:45:10.311  1601  1802 D UEventObserver: change@/devices/platform/auge_sound/sound/card0/controlC0纮ACTION=change纮DEVPATH=/devices/platform/auge_sound/sound/card0/controlC0纮SUBSYSTEM=sound纮AUDIO_FORMAT=0纮MAJOR=116纮MINOR=15纮DEVNAME=snd/controlC0纮SEQNUM=3720纮
06-20 07:45:10.311   677  4412 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
06-20 07:45:10.312     0     0 I         : [  280.621219@5]  update audio atmos flag! audio_type = 0
06-20 07:45:10.312   677  4412 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
06-20 07:45:10.318   677  2192 I SoundTriggerMiddlewareLogging: setCaptureState[this=com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl@665d3ac, caller=1041/425](true)
06-20 07:45:10.319   397   474 E FMQ     : grantorIdx must be less than 3
06-20 07:45:10.319   397   474 E FMQ     : grantorIdx must be less than 3
06-20 07:45:10.320   425  4901 E FMQ     : grantorIdx must be less than 3
06-20 07:45:10.320   425  4901 E FMQ     : grantorIdx must be less than 3
06-20 07:45:10.320   397  4904 D AudioALSADeviceParser: hlm--00---auge sound card, pAdd=0xf2540970 fix alsaPORT:11 to :3
06-20 07:45:10.320   397  4904 D AudioALSADeviceParser: hlm-----auge sound card, pAdd=0xf2540970 fix alsaPORT:11 to :1
06-20 07:45:10.320   397  4904 D audio_hw_primary: *start_input_stream, open alsa_card(0 11) alsa_device(1), in_device:0x4
06-20 07:45:10.320   397  4904 I audio_hw_primary: pcm_open: flag = 10000018, card = 0, device = 1
06-20 07:45:10.352     0     0 D [  280.661176@4]  audio_ddr_mngr: toddrs[0] registered by device fe330000.audiobus:tdm@1
06-20 07:45:10.354   397  2317 I audio_hw_primary: -aml_alsa_output_open, audio out(0xf4740fa0) device(0) refs(1) is_normal_pcm 1, handle 0xf4602860
06-20 07:45:10.354   397  2317 I audio_hw_primary:
06-20 07:45:10.354   397  2317 I audio_hw_primary: +aml_alsa_output_open, adev->pcm_handle[0] 0xf4602860
06-20 07:45:10.357     0     0 I [  280.662916@6]  aml_set_tdm_mclk: set mpll_freq: 491520000
06-20 07:45:10.357     0     0 D         : [  280.662960@6]  set mclk:12288000, mpll:491520000, get mclk:12287939, mpll:491517535
06-20 07:45:10.357     0     0 D         : [  280.662969@6]  aml_tdm_set_fmt...0x4011, id(1), clksel(1)
06-20 07:45:10.357     0     0 I         : [  280.662984@6]  master_mode(1), binv(1), finv(1) out_skew(2), in_skew(3)
06-20 07:45:10.357     0     0 D         : [  280.663740@6]  dump_pcm_setting...(0000000000000000)
06-20 07:45:10.357     0     0 D         : [  280.663747@6]     pcm_mode(1)
06-20 07:45:10.357     0     0 D         : [  280.663753@6]     sysclk(12288000)
06-20 07:45:10.357     0     0 D         : [  280.663758@6]     sysclk_bclk_ratio(4)
06-20 07:45:10.357     0     0 D         : [  280.663764@6]     bclk(3072000)
06-20 07:45:10.357     0     0 D         : [  280.663770@6]     bclk_lrclk_ratio(64)
06-20 07:45:10.358     0     0 D         : [  280.663775@6]     lrclk(48000)
06-20 07:45:10.358     0     0 D         : [  280.663781@6]     tx_mask(0x3)
06-20 07:45:10.358     0     0 D         : [  280.663787@6]     rx_mask(0x3)
06-20 07:45:10.358     0     0 D         : [  280.663792@6]     slots(2)
06-20 07:45:10.358     0     0 D         : [  280.663798@6]     slot_width(32)
06-20 07:45:10.358     0     0 D         : [  280.663804@6]     lane_mask_in(0xf)
06-20 07:45:10.358     0     0 D         : [  280.663809@6]     lane_mask_out(0xf)
06-20 07:45:10.358     0     0 I [  280.663815@6]  aml_set_tdm_mclk: set mpll_freq: 491520000
06-20 07:45:10.358     0     0 D         : [  280.664374@6]  set mclk:12288000, mpll:491520000, get mclk:12287939, mpll:491517535
06-20 07:45:10.358     0     0 D         : [  280.664381@6]  aml_tdm_set_clkdiv, div 4, clksel(1)
06-20 07:45:10.358     0     0 D         : [  280.664388@6]  aml_set_bclk_ratio, select I2S mode
06-20 07:45:10.358     0     0 I [  280.664434@4]  aml_set_tdm_mclk: set mpll_freq: 491520000
06-20 07:45:10.358     0     0 D         : [  280.665439@4]  set mclk:12288000, mpll:491520000, get mclk:12287939, mpll:491517535
06-20 07:45:10.358     0     0 D         : [  280.665448@4]  aml_tdm_set_fmt...0x4011, id(1), clksel(1)
06-20 07:45:10.358     0     0 I         : [  280.665460@4]  master_mode(1), binv(1), finv(1) out_skew(2), in_skew(3)
06-20 07:45:10.358     0     0 D         : [  280.666209@4]  dump_pcm_setting...(0000000000000000)
06-20 07:45:10.358     0     0 D         : [  280.666216@4]     pcm_mode(1)
06-20 07:45:10.358     0     0 D         : [  280.666278@4]     sysclk(12288000)
06-20 07:45:10.358     0     0 D         : [  280.666285@4]     sysclk_bclk_ratio(4)
06-20 07:45:10.358     0     0 D         : [  280.666290@4]     bclk(3072000)
06-20 07:45:10.358     0     0 D         : [  280.666296@4]     bclk_lrclk_ratio(64)
06-20 07:45:10.358     0     0 D         : [  280.666301@4]     lrclk(48000)
06-20 07:45:10.358     0     0 D         : [  280.666307@4]     tx_mask(0x3)
06-20 07:45:10.358     0     0 D         : [  280.666312@4]     rx_mask(0x3)
06-20 07:45:10.358     0     0 D         : [  280.666317@4]     slots(2)
06-20 07:45:10.356   397  4904 D audio_hw_primary: pcm_open in: card(0), port(11)
06-20 07:45:10.356   397  4904 D audio_hw_primary: start_input_stream: device(4) channels=1 period_size=1024 rate=48000 requested_rate=48000 mode= 0
06-20 07:45:10.358     0     0 D         : [  280.666323@4]     slot_width(32)
06-20 07:45:10.358     0     0 D         : [  280.666328@4]     lane_mask_in(0xf)
06-20 07:45:10.358     0     0 D         : [  280.666334@4]     lane_mask_out(0xf)
06-20 07:45:10.358     0     0 I [  280.666341@4]  aml_set_tdm_mclk: set mpll_freq: 491520000
06-20 07:45:10.358     0     0 D         : [  280.666520@4]  set mclk:12288000, mpll:491520000, get mclk:12287939, mpll:491517535
06-20 07:45:10.358     0     0 D         : [  280.666526@4]  aml_tdm_set_clkdiv, div 4, clksel(1)
06-20 07:45:10.358     0     0 D         : [  280.666534@4]  aml_set_bclk_ratio, select I2S mode
06-20 07:45:10.358     0     0 D         : [  280.666570@6]  aml_tdm_prepare(), reset fddr
06-20 07:45:10.358     0     0 D         : [  280.666593@6]  dump_pcm_setting...(0000000000000000)
06-20 07:45:10.358     0     0 D         : [  280.666599@6]     pcm_mode(1)
06-20 07:45:10.358     0     0 D         : [  280.666604@6]     sysclk(12288000)
06-20 07:45:10.358     0     0 D         : [  280.666610@6]     sysclk_bclk_ratio(4)
06-20 07:45:10.358     0     0 D         : [  280.666615@6]     bclk(3072000)
06-20 07:45:10.358     0     0 D         : [  280.666621@6]     bclk_lrclk_ratio(64)
06-20 07:45:10.358     0     0 D         : [  280.666626@6]     lrclk(48000)
06-20 07:45:10.358     0     0 D         : [  280.666631@6]     tx_mask(0x3)
06-20 07:45:10.358     0     0 D         : [  280.666637@6]     rx_mask(0x3)
06-20 07:45:10.358     0     0 D         : [  280.666673@6]     slots(2)
06-20 07:45:10.358     0     0 D         : [  280.666679@6]     slot_width(32)
06-20 07:45:10.359     0     0 D         : [  280.666685@6]     lane_mask_in(0xf)
06-20 07:45:10.359     0     0 D         : [  280.666690@6]     lane_mask_out(0xf)
06-20 07:45:10.359     0     0 I [  280.666697@6]  aml_set_tdm_mclk: set mpll_freq: 491520000
06-20 07:45:10.359     0     0 D         : [  280.667181@6]  set mclk:12288000, mpll:491520000, get mclk:12287939, mpll:491517535
06-20 07:45:10.359     0     0 D         : [  280.667187@6]  aml_tdm_set_clkdiv, div 4, clksel(1)
06-20 07:45:10.359     0     0 D         : [  280.667194@6]  aml_set_bclk_ratio, select I2S mode
06-20 07:45:10.359     0     0 D         : [  280.667207@6]  ss_prepare() 245, lvl 1
06-20 07:45:10.359     0     0 D         : [  280.667217@6]  spdif_a fifo ctrl, frddr:0 type:3, 32 bits, chmask 0xff, swap 0x10
06-20 07:45:10.359     0     0 D [  280.667229@6]  iec_info: rate: 48000, codec_type:0x0, channel status L:0x2000100, R:0x2000100
06-20 07:45:10.359     0     0 D [  280.667244@6]  audio_ddr_mngr: frddr_set_sharebuffer_enable share lvl: 1, dst_src: 3
06-20 07:45:10.359     0     0 D         : [  280.667252@6]  ss_prepare() 245, lvl 2
06-20 07:45:10.359     0     0 D         : [  280.667260@6]  spdif_b fifo ctrl, frddr:0 type:3, 32 bits, chmask 0xff, swap 0x10
06-20 07:45:10.359     0     0 D [  280.667270@6]  iec_info: rate: 48000, codec_type:0x0, channel status L:0x2000100, R:0x2000100
06-20 07:45:10.359     0     0 D [  280.667278@6]  audio_ddr_mngr: frddr_set_sharebuffer_enable share lvl: 2, dst_src: 4
06-20 07:45:10.499   397  2317 I audio_hw_primary: aml_alsa_output_write alsa_running_status[0xf4740fa0] change from 0 to 1
06-20 07:45:10.499     0     0 D         : [  280.806676@6]  tdm playback mute: 0, lane_cnt = 4
06-20 07:45:10.499     0     0 D         : [  280.806718@4]  dump_pcm_setting...(0000000000000000)
06-20 07:45:10.499     0     0 D         : [  280.806724@4]     pcm_mode(1)
06-20 07:45:10.499     0     0 D         : [  280.806728@4]     sysclk(12288000)
06-20 07:45:10.499     0     0 D         : [  280.806733@4]     sysclk_bclk_ratio(4)
06-20 07:45:10.500     0     0 D         : [  280.806737@4]     bclk(3072000)
06-20 07:45:10.500     0     0 D         : [  280.806741@4]     bclk_lrclk_ratio(64)
06-20 07:45:10.500     0     0 D         : [  280.806745@4]     lrclk(48000)
06-20 07:45:10.500     0     0 D         : [  280.806749@4]     tx_mask(0x3)
06-20 07:45:10.500     0     0 D         : [  280.806753@4]     rx_mask(0x3)
06-20 07:45:10.500     0     0 D         : [  280.806757@4]     slots(2)
06-20 07:45:10.500     0     0 D         : [  280.806762@6]  asoc-aml-card auge_sound: TDM[1] Playback enable
06-20 07:45:10.500     0     0 D         : [  280.806767@4]     slot_width(32)
06-20 07:45:10.500     0     0 D         : [  280.806771@4]     lane_mask_in(0xf)
06-20 07:45:10.500     0     0 D         : [  280.806775@4]     lane_mask_out(0xf)
06-20 07:45:10.500     0     0 D         : [  280.806780@6]  ss_trigger() ss 3
06-20 07:45:10.500     0     0 I [  280.806784@4]  aml_set_tdm_mclk: set mpll_freq: 491520000
06-20 07:45:10.500     0     0 D         : [  280.806793@4]  set mclk:12288000, mpll:491520000, get mclk:12287939, mpll:491517535
06-20 07:45:10.500     0     0 D         : [  280.806812@4]  aml_tdm_set_clkdiv, div 4, clksel(1)
06-20 07:45:10.500     0     0 D         : [  280.806815@6]  spdif_a is set to enable
06-20 07:45:10.500     0     0 D         : [  280.806821@4]  aml_set_bclk_ratio, select I2S mode
06-20 07:45:10.500     0     0 D         : [  280.806824@6]  ss_trigger() ss 4
06-20 07:45:10.500     0     0 D         : [  280.806828@6]  spdif_b is set to enable
06-20 07:45:10.500     0     0 I         : [  280.806835@4]  asoc-aml-card auge_sound: tdm prepare capture
06-20 07:45:10.500     0     0 D         : [  280.806942@6]  ss_mute() 363, mute 0, id 0
06-20 07:45:10.500     0     0 D         : [  280.807473@6]  ss_mute() 363, mute 0, id 1
06-20 07:45:10.500     0     0 D         : [  280.807487@4]  tdm capture mute: 0
06-20 07:45:10.500     0     0 I         : [  280.807509@4]  asoc-aml-card auge_sound: TDM[1] Capture enable
06-20 07:45:10.735   677  4412 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
06-20 07:45:10.735   425   520 W APM::AudioPolicyEngine: getDevicesForStrategy() unknown strategy: -1
1 Like

Yes, it helped, thanks a lot!

1 Like