Loading hal/audio_hw.c +6 −1 Original line number Diff line number Diff line Loading @@ -3083,6 +3083,10 @@ int start_output_stream(struct stream_out *out) } } if (out->realtime) platform_set_stream_channel_map(adev->platform, out->channel_mask, out->pcm_device_id, &out->channel_map_param.channel_map[0]); while (1) { ATRACE_BEGIN("pcm_open"); out->pcm = pcm_open(adev->snd_card, out->pcm_device_id, Loading Loading @@ -3111,6 +3115,7 @@ int start_output_stream(struct stream_out *out) } break; } if (!out->realtime) platform_set_stream_channel_map(adev->platform, out->channel_mask, out->pcm_device_id, &out->channel_map_param.channel_map[0]); Loading hal/msm8916/platform.c +60 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ /* Query external audio device connection status */ #define AUDIO_PARAMETER_KEY_EXT_AUDIO_DEVICE "ext_audio_device" #define AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP "spkr_device_chmap" #define EVENT_EXTERNAL_SPK_1 "qc_ext_spk_1" #define EVENT_EXTERNAL_SPK_2 "qc_ext_spk_2" #define EVENT_EXTERNAL_MIC "qc_ext_mic" Loading Loading @@ -307,6 +308,12 @@ struct platform_data { bool is_asrc_supported; struct listnode acdb_meta_key_list; bool use_generic_handset; struct spkr_device_chmap *spkr_ch_map; }; struct spkr_device_chmap { int num_ch; char chmap[AUDIO_CHANNEL_COUNT_MAX]; }; static bool is_external_codec = false; Loading Loading @@ -2281,6 +2288,7 @@ void *platform_init(struct audio_device *adev) my_data->is_wsa_speaker = false; my_data->hw_dep_fd = -1; my_data->mono_speaker = SPKR_1; my_data->spkr_ch_map = NULL; be_dai_name_table = NULL; Loading Loading @@ -2789,6 +2797,11 @@ void platform_deinit(void *platform) my_data->adev->mixer = NULL; } if (my_data->spkr_ch_map) { free(my_data->spkr_ch_map); my_data->spkr_ch_map = NULL; } int32_t idx; for (idx = 0; idx < MAX_CODEC_BACKENDS; idx++) { Loading Loading @@ -5050,6 +5063,46 @@ done_key_audcal: if(dptr != NULL) free(dptr); } static void platform_spkr_device_set_params(struct platform_data *platform, struct str_parms *parms, char *value, int len) { int err = 0, i = 0, num_ch = 0; char *test_r = NULL; char *opts = NULL; char *ch_count = NULL; err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP, value, len); if (err >= 0) { platform->spkr_ch_map = calloc(1, sizeof(struct spkr_device_chmap)); if (!platform->spkr_ch_map) { ALOGE("%s: failed to allocate mem for adm channel map\n", __func__); str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return ; } ch_count = strtok_r(value, ", ", &test_r); if (ch_count == NULL) { ALOGE("%s: incorrect ch_map\n", __func__); free(platform->spkr_ch_map); platform->spkr_ch_map = NULL; str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return; } num_ch = atoi(ch_count); if ((num_ch > 0) && (num_ch <= AUDIO_CHANNEL_COUNT_MAX) ) { platform->spkr_ch_map->num_ch = num_ch; for (i = 0; i < num_ch; i++) { opts = strtok_r(NULL, ", ", &test_r); platform->spkr_ch_map->chmap[i] = strtoul(opts, NULL, 16); } } str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); } } int platform_set_parameters(void *platform, struct str_parms *parms) { struct platform_data *my_data = (struct platform_data *)platform; Loading Loading @@ -5174,6 +5227,7 @@ int platform_set_parameters(void *platform, struct str_parms *parms) audio_extn_hfp_set_parameters(my_data->adev, parms); true_32_bit_set_params(parms, value, len); audio_extn_ffv_set_parameters(my_data->adev, parms); platform_spkr_device_set_params(platform, parms, value, len); ALOGV("%s: exit with code(%d)", __func__, ret); return ret; } Loading Loading @@ -6346,6 +6400,7 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, int i, num_devices = 1; struct audio_backend_cfg backend_cfg; bool ret = false; struct platform_data *my_data = (struct platform_data *)adev->platform; backend_idx = platform_get_backend_index(snd_device); Loading Loading @@ -6385,6 +6440,11 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, backend_cfg.sample_rate, backend_cfg.channels, backend_idx, usecase->id, platform_get_snd_device_name(snd_device)); if ((my_data->spkr_ch_map != NULL) && (platform_get_backend_index(snd_device) == DEFAULT_CODEC_BACKEND)) platform_set_channel_map(my_data, my_data->spkr_ch_map->num_ch, my_data->spkr_ch_map->chmap, -1); if (platform_split_snd_device(adev->platform, snd_device, &num_devices, new_snd_devices) < 0) new_snd_devices[0] = snd_device; Loading hal/msm8974/platform.c +59 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ * device for voice usecase */ #define AUDIO_PARAMETER_KEY_DP_FOR_VOICE_USECASE "dp_for_voice" #define AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP "spkr_device_chmap" #define EVENT_EXTERNAL_SPK_1 "qc_ext_spk_1" #define EVENT_EXTERNAL_SPK_2 "qc_ext_spk_2" Loading Loading @@ -283,6 +284,12 @@ struct platform_data { bool is_asrc_supported; struct listnode acdb_meta_key_list; bool use_generic_handset; struct spkr_device_chmap *spkr_ch_map; }; struct spkr_device_chmap { int num_ch; char chmap[AUDIO_CHANNEL_COUNT_MAX]; }; static int pcm_device_table[AUDIO_USECASE_MAX][2] = { Loading Loading @@ -2075,6 +2082,7 @@ void *platform_init(struct audio_device *adev) my_data->hw_dep_fd = -1; my_data->mono_speaker = SPKR_1; my_data->speaker_lr_swap = false; my_data->spkr_ch_map = NULL; be_dai_name_table = NULL; Loading Loading @@ -2593,6 +2601,11 @@ void platform_deinit(void *platform) my_data->adev->mixer = NULL; } if (my_data->spkr_ch_map) { free(my_data->spkr_ch_map); my_data->spkr_ch_map = NULL; } int32_t idx; for (idx = 0; idx < MAX_CODEC_BACKENDS; idx++) { Loading Loading @@ -4941,6 +4954,46 @@ static void perf_lock_set_params(struct platform_data *platform, } } static void platform_spkr_device_set_params(struct platform_data *platform, struct str_parms *parms, char *value, int len) { int err = 0, i = 0, num_ch = 0; char *test_r = NULL; char *opts = NULL; char *ch_count = NULL; err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP, value, len); if (err >= 0) { platform->spkr_ch_map = calloc(1, sizeof(struct spkr_device_chmap)); if (!platform->spkr_ch_map) { ALOGE("%s: failed to allocate mem for adm channel map\n", __func__); str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return ; } ch_count = strtok_r(value, ", ", &test_r); if (ch_count == NULL) { ALOGE("%s: incorrect ch_map\n", __func__); free(platform->spkr_ch_map); platform->spkr_ch_map = NULL; str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return; } num_ch = atoi(ch_count); if ((num_ch > 0) && (num_ch <= AUDIO_CHANNEL_COUNT_MAX) ) { platform->spkr_ch_map->num_ch = num_ch; for (i = 0; i < num_ch; i++) { opts = strtok_r(NULL, ", ", &test_r); platform->spkr_ch_map->chmap[i] = strtoul(opts, NULL, 16); } } str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); } } int platform_set_parameters(void *platform, struct str_parms *parms) { struct platform_data *my_data = (struct platform_data *)platform; Loading Loading @@ -5082,6 +5135,7 @@ int platform_set_parameters(void *platform, struct str_parms *parms) audio_extn_hfp_set_parameters(adev, parms); perf_lock_set_params(platform, parms, value, len); true_32_bit_set_params(parms, value, len); platform_spkr_device_set_params(platform, parms, value, len); done: ALOGV("%s: exit with code(%d)", __func__, ret); if(kv_pairs != NULL) Loading Loading @@ -6276,6 +6330,11 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, backend_cfg.sample_rate, backend_cfg.channels, backend_idx, usecase->id, platform_get_snd_device_name(snd_device)); if ((my_data->spkr_ch_map != NULL) && (platform_get_backend_index(snd_device) == DEFAULT_CODEC_BACKEND)) platform_set_channel_map(my_data, my_data->spkr_ch_map->num_ch, my_data->spkr_ch_map->chmap, -1); if (platform_split_snd_device(my_data, snd_device, &num_devices, new_snd_devices) < 0) new_snd_devices[0] = snd_device; Loading Loading
hal/audio_hw.c +6 −1 Original line number Diff line number Diff line Loading @@ -3083,6 +3083,10 @@ int start_output_stream(struct stream_out *out) } } if (out->realtime) platform_set_stream_channel_map(adev->platform, out->channel_mask, out->pcm_device_id, &out->channel_map_param.channel_map[0]); while (1) { ATRACE_BEGIN("pcm_open"); out->pcm = pcm_open(adev->snd_card, out->pcm_device_id, Loading Loading @@ -3111,6 +3115,7 @@ int start_output_stream(struct stream_out *out) } break; } if (!out->realtime) platform_set_stream_channel_map(adev->platform, out->channel_mask, out->pcm_device_id, &out->channel_map_param.channel_map[0]); Loading
hal/msm8916/platform.c +60 −0 Original line number Diff line number Diff line Loading @@ -163,6 +163,7 @@ /* Query external audio device connection status */ #define AUDIO_PARAMETER_KEY_EXT_AUDIO_DEVICE "ext_audio_device" #define AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP "spkr_device_chmap" #define EVENT_EXTERNAL_SPK_1 "qc_ext_spk_1" #define EVENT_EXTERNAL_SPK_2 "qc_ext_spk_2" #define EVENT_EXTERNAL_MIC "qc_ext_mic" Loading Loading @@ -307,6 +308,12 @@ struct platform_data { bool is_asrc_supported; struct listnode acdb_meta_key_list; bool use_generic_handset; struct spkr_device_chmap *spkr_ch_map; }; struct spkr_device_chmap { int num_ch; char chmap[AUDIO_CHANNEL_COUNT_MAX]; }; static bool is_external_codec = false; Loading Loading @@ -2281,6 +2288,7 @@ void *platform_init(struct audio_device *adev) my_data->is_wsa_speaker = false; my_data->hw_dep_fd = -1; my_data->mono_speaker = SPKR_1; my_data->spkr_ch_map = NULL; be_dai_name_table = NULL; Loading Loading @@ -2789,6 +2797,11 @@ void platform_deinit(void *platform) my_data->adev->mixer = NULL; } if (my_data->spkr_ch_map) { free(my_data->spkr_ch_map); my_data->spkr_ch_map = NULL; } int32_t idx; for (idx = 0; idx < MAX_CODEC_BACKENDS; idx++) { Loading Loading @@ -5050,6 +5063,46 @@ done_key_audcal: if(dptr != NULL) free(dptr); } static void platform_spkr_device_set_params(struct platform_data *platform, struct str_parms *parms, char *value, int len) { int err = 0, i = 0, num_ch = 0; char *test_r = NULL; char *opts = NULL; char *ch_count = NULL; err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP, value, len); if (err >= 0) { platform->spkr_ch_map = calloc(1, sizeof(struct spkr_device_chmap)); if (!platform->spkr_ch_map) { ALOGE("%s: failed to allocate mem for adm channel map\n", __func__); str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return ; } ch_count = strtok_r(value, ", ", &test_r); if (ch_count == NULL) { ALOGE("%s: incorrect ch_map\n", __func__); free(platform->spkr_ch_map); platform->spkr_ch_map = NULL; str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return; } num_ch = atoi(ch_count); if ((num_ch > 0) && (num_ch <= AUDIO_CHANNEL_COUNT_MAX) ) { platform->spkr_ch_map->num_ch = num_ch; for (i = 0; i < num_ch; i++) { opts = strtok_r(NULL, ", ", &test_r); platform->spkr_ch_map->chmap[i] = strtoul(opts, NULL, 16); } } str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); } } int platform_set_parameters(void *platform, struct str_parms *parms) { struct platform_data *my_data = (struct platform_data *)platform; Loading Loading @@ -5174,6 +5227,7 @@ int platform_set_parameters(void *platform, struct str_parms *parms) audio_extn_hfp_set_parameters(my_data->adev, parms); true_32_bit_set_params(parms, value, len); audio_extn_ffv_set_parameters(my_data->adev, parms); platform_spkr_device_set_params(platform, parms, value, len); ALOGV("%s: exit with code(%d)", __func__, ret); return ret; } Loading Loading @@ -6346,6 +6400,7 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, int i, num_devices = 1; struct audio_backend_cfg backend_cfg; bool ret = false; struct platform_data *my_data = (struct platform_data *)adev->platform; backend_idx = platform_get_backend_index(snd_device); Loading Loading @@ -6385,6 +6440,11 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, backend_cfg.sample_rate, backend_cfg.channels, backend_idx, usecase->id, platform_get_snd_device_name(snd_device)); if ((my_data->spkr_ch_map != NULL) && (platform_get_backend_index(snd_device) == DEFAULT_CODEC_BACKEND)) platform_set_channel_map(my_data, my_data->spkr_ch_map->num_ch, my_data->spkr_ch_map->chmap, -1); if (platform_split_snd_device(adev->platform, snd_device, &num_devices, new_snd_devices) < 0) new_snd_devices[0] = snd_device; Loading
hal/msm8974/platform.c +59 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ * device for voice usecase */ #define AUDIO_PARAMETER_KEY_DP_FOR_VOICE_USECASE "dp_for_voice" #define AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP "spkr_device_chmap" #define EVENT_EXTERNAL_SPK_1 "qc_ext_spk_1" #define EVENT_EXTERNAL_SPK_2 "qc_ext_spk_2" Loading Loading @@ -283,6 +284,12 @@ struct platform_data { bool is_asrc_supported; struct listnode acdb_meta_key_list; bool use_generic_handset; struct spkr_device_chmap *spkr_ch_map; }; struct spkr_device_chmap { int num_ch; char chmap[AUDIO_CHANNEL_COUNT_MAX]; }; static int pcm_device_table[AUDIO_USECASE_MAX][2] = { Loading Loading @@ -2075,6 +2082,7 @@ void *platform_init(struct audio_device *adev) my_data->hw_dep_fd = -1; my_data->mono_speaker = SPKR_1; my_data->speaker_lr_swap = false; my_data->spkr_ch_map = NULL; be_dai_name_table = NULL; Loading Loading @@ -2593,6 +2601,11 @@ void platform_deinit(void *platform) my_data->adev->mixer = NULL; } if (my_data->spkr_ch_map) { free(my_data->spkr_ch_map); my_data->spkr_ch_map = NULL; } int32_t idx; for (idx = 0; idx < MAX_CODEC_BACKENDS; idx++) { Loading Loading @@ -4941,6 +4954,46 @@ static void perf_lock_set_params(struct platform_data *platform, } } static void platform_spkr_device_set_params(struct platform_data *platform, struct str_parms *parms, char *value, int len) { int err = 0, i = 0, num_ch = 0; char *test_r = NULL; char *opts = NULL; char *ch_count = NULL; err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP, value, len); if (err >= 0) { platform->spkr_ch_map = calloc(1, sizeof(struct spkr_device_chmap)); if (!platform->spkr_ch_map) { ALOGE("%s: failed to allocate mem for adm channel map\n", __func__); str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return ; } ch_count = strtok_r(value, ", ", &test_r); if (ch_count == NULL) { ALOGE("%s: incorrect ch_map\n", __func__); free(platform->spkr_ch_map); platform->spkr_ch_map = NULL; str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); return; } num_ch = atoi(ch_count); if ((num_ch > 0) && (num_ch <= AUDIO_CHANNEL_COUNT_MAX) ) { platform->spkr_ch_map->num_ch = num_ch; for (i = 0; i < num_ch; i++) { opts = strtok_r(NULL, ", ", &test_r); platform->spkr_ch_map->chmap[i] = strtoul(opts, NULL, 16); } } str_parms_del(parms, AUDIO_PARAMETER_KEY_SPKR_DEVICE_CHMAP); } } int platform_set_parameters(void *platform, struct str_parms *parms) { struct platform_data *my_data = (struct platform_data *)platform; Loading Loading @@ -5082,6 +5135,7 @@ int platform_set_parameters(void *platform, struct str_parms *parms) audio_extn_hfp_set_parameters(adev, parms); perf_lock_set_params(platform, parms, value, len); true_32_bit_set_params(parms, value, len); platform_spkr_device_set_params(platform, parms, value, len); done: ALOGV("%s: exit with code(%d)", __func__, ret); if(kv_pairs != NULL) Loading Loading @@ -6276,6 +6330,11 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev, backend_cfg.sample_rate, backend_cfg.channels, backend_idx, usecase->id, platform_get_snd_device_name(snd_device)); if ((my_data->spkr_ch_map != NULL) && (platform_get_backend_index(snd_device) == DEFAULT_CODEC_BACKEND)) platform_set_channel_map(my_data, my_data->spkr_ch_map->num_ch, my_data->spkr_ch_map->chmap, -1); if (platform_split_snd_device(my_data, snd_device, &num_devices, new_snd_devices) < 0) new_snd_devices[0] = snd_device; Loading