[Redmi K20 Pro / Xiaomi Mi 9T Pro ROMs, Kernels, Re] haha01haha01:
Hey,

I seem to have an issue with connecting an external 3.5mm microphone, the system recognizes that heaphones/microphone are connected correctly but every attempt to use the microphone (e.g. from a sound recorder) fails with this showing in logcat:

03-19 18:01:35.530 790 16231 E audio_hw_primary: start_input_stream: cannot set hw params: Invalid argument
03-19 18:01:35.530 790 16231 E audio_hw_extn: audio_extn_perf_lock_release: Perf lock release error
03-19 18:01:35.530 790 16231 D audio_hw_primary: disable_audio_route: reset and update mixer path: audio-record headset-mic
03-19 18:01:35.534 790 16231 D soundtrigger: audio_extn_sound_trigger_update_stream_status: uc_info->id 23 of type 1 for Event 2, with Raise=1
03-19 18:01:35.534 790 16231 D soundtrigger: audio_extn_sound_trigger_update_stream_status: send event 12: usecase id 23, type 1
03-19 18:01:35.534 790 16231 I sound_trigger_platform: platform_stdev_check_and_update_concurrency: Received STREAM event, event type 12, usecase type 1
03-19 18:01:35.534 790 16231 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: dedicated path 1, reset backend 1, tx 1, rx 0,concurrency session not allowed
03-19 18:01:35.534 790 16231 D hardware_info: hw_info_append_hw_type : device_name = headset-mic
03-19 18:01:35.534 790 16231 D audio_hw_primary: disable_snd_device: snd_device(178: headset-mic)
03-19 18:01:35.534 790 16231 D msm8974_platform: platform_split_snd_device: snd_device(178) num devices(0) new_snd_devices(0)
03-19 18:01:35.539 790 16231 I soundtrigger: audio_extn_sound_trigger_update_device_status: device 0xb2 of type 1 for Event 0, with Raise=1
03-19 18:01:35.539 790 16231 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: Received DEVICE event, event type 0
03-19 18:01:35.539 790 16231 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: dedicated path 1, reset backend 1, tx 0, rx 0,concurrency session allowed
03-19 18:01:35.590 790 16231 D audio_hw_primary: start_input_stream: exit: status(-5)
03-19 18:01:35.590 790 16231 D audio_hw_primary: in_standby: enter: stream (0xf3146e50) usecase(23: audio-record)
03-19 18:01:35.611 790 16231 D audio_hw_primary: start_input_stream: enter: stream(0xf3146e50)usecase(23: audio-record)
03-19 18:01:35.611 790 16231 E audio_hw_extn: audio_extn_perf_lock_acquire: Incorrect params, Failed to acquire perf lock, err
03-19 18:01:35.611 790 16231 D audio_hw_primary: select_devices for use case (audio-record)
03-19 18:01:35.611 790 16231 D msm8974_platform: platform_get_input_snd_device: enter: out_device(0) in_device(0x80000010) channel_count (1) channel_mask (0x10)
03-19 18:01:35.611 790 16231 D msm8974_platform: platform_get_input_snd_device() select HEADSET_MIC for non sing
03-19 18:01:35.611 790 16231 D audio_hw_primary: select_devices: out_snd_device(0: ) in_snd_device(178: headset-mic)
03-19 18:01:35.611 790 16231 I msm8974_platform: platform_check_and_set_capture_codec_backend_cfg:txbecf: afe: bitwidth 16, samplerate 48000, channel 1 format 1, backend_idx 15 usecase = 23 device (headset-mic)
03-19 18:01:35.611 790 16231 I msm8974_platform: platform_check_capture_codec_backend_cfg:txbecf: afe: Codec selected backend: 15 current bit width: 16 and sample rate: 48000, channels 1 format 1
03-19 18:01:35.611 790 16231 W msm8974_platform: platform_get_backend_index:napb: Invalid device - 0
03-19 18:01:35.611 790 16231 I msm8974_platform: platform_check_capture_codec_backend_cfg:txbecf: afe: current backend bit_width 16 sample_rate 48000 channels 1, format 0
03-19 18:01:35.611 790 16231 I msm8974_platform: platform_check_capture_codec_backend_cfg:txbecf: afe: Codec backend needs to be updated. new bit width: 16 new sample rate: 48000 new channel: 1 new format: 1
03-19 18:01:35.611 790 16231 I msm8974_platform: platform_set_codec_backend_cfg:becf: afe: bitwidth 16, samplerate 48000 channels 1 format 1, backend_idx 15 device (headset-mic)
03-19 18:01:35.611 790 16231 D audio_hw_primary: check_usecases_capture_codec_backend:becf: force routing 0
03-19 18:01:35.612 790 16231 D hardware_info: hw_info_append_hw_type : device_name = headset-mic
03-19 18:01:35.612 790 16231 D msm8974_platform: platform_split_snd_device: snd_device(178) num devices(0) new_snd_devices(0)
03-19 18:01:35.612 790 16231 D audio_hw_primary: enable_snd_device: snd_device(178: headset-mic)
03-19 18:01:35.612 790 16231 D msm8974_platform: platform_get_island_cfg_on_device:island cfg status on snd_device = (headset-mic 0)
03-19 18:01:35.612 790 16231 I soundtrigger: audio_extn_sound_trigger_update_device_status: device 0xb2 of type 1 for Event 1, with Raise=1
03-19 18:01:35.612 790 16231 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: Received DEVICE event, event type 1
03-19 18:01:35.612 790 16231 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: dedicated path 1, reset backend 1, tx 1, rx 0,concurrency session not allowed
03-19 18:01:35.612 790 16231 D audio_route: Apply path: headset-mic
03-19 18:01:35.623 790 16231 D soundtrigger: audio_extn_sound_trigger_update_stream_status: uc_info->id 23 of type 1 for Event 3, with Raise=1
03-19 18:01:35.623 790 16231 D soundtrigger: audio_extn_sound_trigger_update_stream_status: send event 13: usecase id 23, type 1
03-19 18:01:35.623 790 16231 I sound_trigger_platform: platform_stdev_check_and_update_concurrency: Received STREAM event, event type 13, usecase type 1
03-19 18:01:35.623 790 16231 D sound_trigger_platform: platform_stdev_check_and_update_concurrency: dedicated path 1, reset backend 1, tx 1, rx 0,concurrency session not allowed
03-19 18:01:35.623 790 16231 D audio_hw_utils: audio_extn_utils_send_app_type_cfg: usecase->in_snd_device headset-mic
03-19 18:01:35.623 790 16231 D msm8974_platform: platform_split_snd_device: snd_device(178) num devices(0) new_snd_devices(0)
03-19 18:01:35.624 790 16231 D audio_hw_utils: audio_extn_btsco_get_sample_rate:Not a BT SCO device, need not update sampling rate
03-19 18:01:35.624 790 16231 I audio_hw_utils: send_app_type_cfg_for_device CAPTURE app_type 69938, acdb_dev_id 10008, sample_rate 48000, snd_device_be_idx 21
03-19 18:01:35.625 790 16231 D msm8974_platform: platform_split_snd_device: snd_device(178) num devices(1) new_snd_devices(0)
03-19 18:01:35.625 790 16231 D audio_hw_utils: audio_extn_btsco_get_sample_rate:Not a BT SCO device, need not update sampling rate
03-19 18:01:35.625 790 16231 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 10008, path = 1, app id = 0x11132, sample rate = 48000, afe_sample_rate = 48000
03-19 18:01:35.625 790 16231 D ACDB-LOADER: ACDB -> send_asm_topology
03-19 18:01:35.625 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_STREAM_TOPOLOGY_ID
03-19 18:01:35.625 790 16231 D ACDB-LOADER: ACDB -> send_adm_topology
03-19 18:01:35.625 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID
03-19 18:01:35.625 790 16231 D ACDB-LOADER: ACDB -> send_audtable
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_COMMON_TABLE_SIZE
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_COMMON_TABLE
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> AUDIO_SET_AUDPROC_CAL cal_type[11] acdb_id[10008] app_type[69938]
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_STREAM_TABLE_SIZE
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> send_audstrmtable
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_STREAM_TABLE
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> audstrm_cal->cal_type.cal_data.cal_size = 20
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> send_afe_topology
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_TOPOLOGY_ID
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> GET_AFE_TOPOLOGY_ID for adcd_id 10008, Topology Id 112fb
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> send_afe_cal
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_INSTANCE_COMMON_TABLE_SIZE
03-19 18:01:35.626 790 16231 D android.hardware.audio.service: Failed to fetch the lookup information of the device 00002718
03-19 18:01:35.626 790 16231 D ACDB-LOADER: Error: ACDB_CMD_GET_AFE_INSTANCE_COMMON_TABLE_SIZE Returned = -19
03-19 18:01:35.626 790 16231 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AFE_INSTANCE_COMMON_TABLE
03-19 18:01:35.626 790 16231 D android.hardware.audio.service: Failed to fetch the lookup information of the device 00002718
03-19 18:01:35.626 790 16231 D ACDB-LOADER: Error: ACDB AFE returned = -19
03-19 18:01:35.627 790 16231 D ACDB-LOADER: ACDB -> AUDIO_SET_AFE_CAL cal_type[17] acdb_id[10008]
03-19 18:01:35.627 790 16231 D ACDB-LOADER: ACDB -> send_hw_delay : acdb_id = 10008 path = 1
03-19 18:01:35.627 790 16231 D ACDB-LOADER: ACDB -> ACDB_AVSYNC_INFO: ACDB_CMD_GET_DEVICE_PROPERTY
03-19 18:01:35.627 790 16231 D audio_hw_primary: enable_audio_route: apply mixer and update path: audio-record headset-mic
03-19 18:01:35.627 790 16231 D audio_route: Apply path: audio-record headset-mic
03-19 18:01:35.630 790 16231 E send_data_to_xlog: send_misound_data_to_xlog: Invalid sound device 0
03-19 18:01:35.630 790 16231 D audio_hw_primary: select_devices: done
03-19 18:01:35.032 0 0 E : tavil_codec tavil_codec: tavil_get_channel_map: Channel list empty for dai_name = tavil_tx3 dai_id = 5
03-19 18:01:35.032 0 0 E msm_snd_hw_params: failed to get tx codec chan map, err:-22
03-19 18:01:35.032 0 0 E sm8150-asoc-snd soc: qcom,msm-audio-apr:sound-tavil: ASoC: machine hw_params failed: -22
03-19 18:01:35.032 0 0 E SLIMBUS_1_TX: ASoC: hw_params BE failed -22
03-19 18:01:35.032 0 0 E SM8150 Media1: ASoC: hw_params BE failed -22
03-19 18:01:35.032 0 0 E q6asm_callback: cmd = 0x10bcd returned error = 0x1
03-19 18:01:35.032 0 0 E __q6asm_cmd: DSP returned error[ADSP_EFAILED] opcode 68557

(PE+ from 10/3, FW V12.0.5.0.QFKMIXM, I've confirmed that this headphone's microphone works on other devices)

Has anyone encountered anything similar?