Loading hal/audio_extn/audio_extn.h +0 −4 Original line number Diff line number Diff line Loading @@ -285,16 +285,12 @@ int32_t audio_extn_read_xml(struct audio_device *adev, uint32_t mixer_card, #define audio_extn_spkr_prot_calib_cancel(adev) (0) #define audio_extn_spkr_prot_stop_processing(snd_device) (0) #define audio_extn_spkr_prot_is_enabled() (false) #define audio_extn_spkr_prot_get_acdb_id(snd_device) (-EINVAL) #define audio_extn_get_spkr_prot_snd_device(snd_device) (snd_device) #define audio_extn_spkr_prot_set_parameters(parms, value, len) (0) #else void audio_extn_spkr_prot_init(void *adev); int audio_extn_spkr_prot_start_processing(snd_device_t snd_device); void audio_extn_spkr_prot_stop_processing(snd_device_t snd_device); bool audio_extn_spkr_prot_is_enabled(); int audio_extn_spkr_prot_get_acdb_id(snd_device_t snd_device); int audio_extn_get_spkr_prot_snd_device(snd_device_t snd_device); void audio_extn_spkr_prot_calib_cancel(void *adev); void audio_extn_spkr_prot_set_parameters(struct str_parms *parms, char *value, int len); Loading hal/audio_extn/spkr_protection.c +3 −52 Original line number Diff line number Diff line Loading @@ -1061,55 +1061,6 @@ void audio_extn_spkr_prot_init(void *adev) } } int audio_extn_spkr_prot_get_acdb_id(snd_device_t snd_device) { int acdb_id; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED); break; case SND_DEVICE_OUT_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT); break; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT); break; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED); break; default: acdb_id = -EINVAL; break; } return acdb_id; } int audio_extn_get_spkr_prot_snd_device(snd_device_t snd_device) { if (!handle.spkr_prot_enable) return snd_device; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: return SND_DEVICE_OUT_SPEAKER_PROTECTED; case SND_DEVICE_OUT_SPEAKER_VBAT: return SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED; default: return snd_device; } } int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) { struct audio_usecase *uc_info_tx; Loading @@ -1123,13 +1074,13 @@ int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) ALOGE("%s: Invalid params", __func__); return -EINVAL; } snd_device = audio_extn_get_spkr_prot_snd_device(snd_device); snd_device = platform_get_spkr_prot_snd_device(snd_device); spkr_prot_set_spkrstatus(true); uc_info_tx = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase)); if (!uc_info_tx) { return -ENOMEM; } ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, platform_get_snd_device_name(snd_device)); audio_route_apply_and_update_path(adev->audio_route, platform_get_snd_device_name(snd_device)); Loading Loading @@ -1201,7 +1152,7 @@ void audio_extn_spkr_prot_stop_processing(snd_device_t snd_device) struct audio_device *adev = handle.adev_handle; ALOGV("%s: Entry", __func__); snd_device = audio_extn_get_spkr_prot_snd_device(snd_device); snd_device = platform_get_spkr_prot_snd_device(snd_device); spkr_prot_set_spkrstatus(false); pthread_mutex_lock(&handle.mutex_spkr_prot); if (adev && handle.spkr_processing_state == SPKR_PROCESSING_IN_PROGRESS) { Loading hal/audio_extn/utils.c +2 −2 Original line number Diff line number Diff line Loading @@ -588,7 +588,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, goto exit_send_app_type_cfg; } snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ? audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device; platform_get_spkr_prot_snd_device(snd_device) : snd_device; acdb_dev_id = platform_get_snd_device_acdb_id(snd_device); if (acdb_dev_id < 0) { ALOGE("%s: Couldn't get the acdb dev id", __func__); Loading Loading @@ -657,7 +657,7 @@ void audio_extn_utils_send_audio_calibration(struct audio_device *adev, struct stream_out *out = usecase->stream.out; int snd_device = usecase->out_snd_device; snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ? audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device; platform_get_spkr_prot_snd_device(snd_device) : snd_device; platform_send_audio_calibration(adev->platform, usecase, out->app_type_cfg.app_type, usecase->stream.out->app_type_cfg.sample_rate); Loading hal/audio_hw.c +6 −9 Original line number Diff line number Diff line Loading @@ -516,11 +516,9 @@ int enable_snd_device(struct audio_device *adev, if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device) audio_extn_usb_start_capture(adev); if ((snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA || snd_device == SND_DEVICE_OUT_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) && if (platform_can_enable_spkr_prot_on_device(snd_device) && audio_extn_spkr_prot_is_enabled()) { if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) { if (platform_get_spkr_prot_acdb_id(snd_device) < 0) { adev->snd_dev_ref_cnt[snd_device]--; return -EINVAL; } Loading Loading @@ -584,9 +582,8 @@ int disable_snd_device(struct audio_device *adev, /* exit usb capture thread */ if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device) audio_extn_usb_stop_capture(); if ((snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA || snd_device == SND_DEVICE_OUT_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) && if (platform_can_enable_spkr_prot_on_device(snd_device) && audio_extn_spkr_prot_is_enabled()) { audio_extn_spkr_prot_stop_processing(snd_device); } else { Loading hal/msm8916/platform.c +64 −1 Original line number Diff line number Diff line Loading @@ -2240,7 +2240,7 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas snd_device = voice_get_incall_rec_snd_device(usecase->in_snd_device); else if ((usecase->type == PCM_HFP_CALL) || (usecase->type == PCM_CAPTURE)) snd_device = usecase->in_snd_device; acdb_dev_id = acdb_device_table[audio_extn_get_spkr_prot_snd_device(snd_device)]; acdb_dev_id = acdb_device_table[platform_get_spkr_prot_snd_device(snd_device)]; // Do not use Rx path default app type for TX path if ((usecase->type == PCM_CAPTURE) && (app_type == DEFAULT_APP_TYPE_RX_PATH)) { Loading Loading @@ -4898,3 +4898,66 @@ bool platform_send_gain_dep_cal(void *platform __unused, { return 0; } bool platform_can_enable_spkr_prot_on_device(snd_device_t snd_device) { bool ret = false; if (snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA || snd_device == SND_DEVICE_OUT_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_WSA) { ret = true; } return ret; } int platform_get_spkr_prot_acdb_id(snd_device_t snd_device) { int acdb_id; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED); break; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED); break; case SND_DEVICE_OUT_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT); break; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT); break; default: acdb_id = -EINVAL; break; } return acdb_id; } int platform_get_spkr_prot_snd_device(snd_device_t snd_device) { if (!audio_extn_spkr_prot_is_enabled()) return snd_device; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: return SND_DEVICE_OUT_SPEAKER_PROTECTED; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED; case SND_DEVICE_OUT_SPEAKER_VBAT: return SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT; default: return snd_device; } } Loading
hal/audio_extn/audio_extn.h +0 −4 Original line number Diff line number Diff line Loading @@ -285,16 +285,12 @@ int32_t audio_extn_read_xml(struct audio_device *adev, uint32_t mixer_card, #define audio_extn_spkr_prot_calib_cancel(adev) (0) #define audio_extn_spkr_prot_stop_processing(snd_device) (0) #define audio_extn_spkr_prot_is_enabled() (false) #define audio_extn_spkr_prot_get_acdb_id(snd_device) (-EINVAL) #define audio_extn_get_spkr_prot_snd_device(snd_device) (snd_device) #define audio_extn_spkr_prot_set_parameters(parms, value, len) (0) #else void audio_extn_spkr_prot_init(void *adev); int audio_extn_spkr_prot_start_processing(snd_device_t snd_device); void audio_extn_spkr_prot_stop_processing(snd_device_t snd_device); bool audio_extn_spkr_prot_is_enabled(); int audio_extn_spkr_prot_get_acdb_id(snd_device_t snd_device); int audio_extn_get_spkr_prot_snd_device(snd_device_t snd_device); void audio_extn_spkr_prot_calib_cancel(void *adev); void audio_extn_spkr_prot_set_parameters(struct str_parms *parms, char *value, int len); Loading
hal/audio_extn/spkr_protection.c +3 −52 Original line number Diff line number Diff line Loading @@ -1061,55 +1061,6 @@ void audio_extn_spkr_prot_init(void *adev) } } int audio_extn_spkr_prot_get_acdb_id(snd_device_t snd_device) { int acdb_id; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED); break; case SND_DEVICE_OUT_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT); break; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT); break; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED); break; default: acdb_id = -EINVAL; break; } return acdb_id; } int audio_extn_get_spkr_prot_snd_device(snd_device_t snd_device) { if (!handle.spkr_prot_enable) return snd_device; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: return SND_DEVICE_OUT_SPEAKER_PROTECTED; case SND_DEVICE_OUT_SPEAKER_VBAT: return SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED; default: return snd_device; } } int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) { struct audio_usecase *uc_info_tx; Loading @@ -1123,13 +1074,13 @@ int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) ALOGE("%s: Invalid params", __func__); return -EINVAL; } snd_device = audio_extn_get_spkr_prot_snd_device(snd_device); snd_device = platform_get_spkr_prot_snd_device(snd_device); spkr_prot_set_spkrstatus(true); uc_info_tx = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase)); if (!uc_info_tx) { return -ENOMEM; } ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, platform_get_snd_device_name(snd_device)); audio_route_apply_and_update_path(adev->audio_route, platform_get_snd_device_name(snd_device)); Loading Loading @@ -1201,7 +1152,7 @@ void audio_extn_spkr_prot_stop_processing(snd_device_t snd_device) struct audio_device *adev = handle.adev_handle; ALOGV("%s: Entry", __func__); snd_device = audio_extn_get_spkr_prot_snd_device(snd_device); snd_device = platform_get_spkr_prot_snd_device(snd_device); spkr_prot_set_spkrstatus(false); pthread_mutex_lock(&handle.mutex_spkr_prot); if (adev && handle.spkr_processing_state == SPKR_PROCESSING_IN_PROGRESS) { Loading
hal/audio_extn/utils.c +2 −2 Original line number Diff line number Diff line Loading @@ -588,7 +588,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev, goto exit_send_app_type_cfg; } snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ? audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device; platform_get_spkr_prot_snd_device(snd_device) : snd_device; acdb_dev_id = platform_get_snd_device_acdb_id(snd_device); if (acdb_dev_id < 0) { ALOGE("%s: Couldn't get the acdb dev id", __func__); Loading Loading @@ -657,7 +657,7 @@ void audio_extn_utils_send_audio_calibration(struct audio_device *adev, struct stream_out *out = usecase->stream.out; int snd_device = usecase->out_snd_device; snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ? audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device; platform_get_spkr_prot_snd_device(snd_device) : snd_device; platform_send_audio_calibration(adev->platform, usecase, out->app_type_cfg.app_type, usecase->stream.out->app_type_cfg.sample_rate); Loading
hal/audio_hw.c +6 −9 Original line number Diff line number Diff line Loading @@ -516,11 +516,9 @@ int enable_snd_device(struct audio_device *adev, if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device) audio_extn_usb_start_capture(adev); if ((snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA || snd_device == SND_DEVICE_OUT_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) && if (platform_can_enable_spkr_prot_on_device(snd_device) && audio_extn_spkr_prot_is_enabled()) { if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) { if (platform_get_spkr_prot_acdb_id(snd_device) < 0) { adev->snd_dev_ref_cnt[snd_device]--; return -EINVAL; } Loading Loading @@ -584,9 +582,8 @@ int disable_snd_device(struct audio_device *adev, /* exit usb capture thread */ if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device) audio_extn_usb_stop_capture(); if ((snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA || snd_device == SND_DEVICE_OUT_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) && if (platform_can_enable_spkr_prot_on_device(snd_device) && audio_extn_spkr_prot_is_enabled()) { audio_extn_spkr_prot_stop_processing(snd_device); } else { Loading
hal/msm8916/platform.c +64 −1 Original line number Diff line number Diff line Loading @@ -2240,7 +2240,7 @@ int platform_send_audio_calibration(void *platform, struct audio_usecase *usecas snd_device = voice_get_incall_rec_snd_device(usecase->in_snd_device); else if ((usecase->type == PCM_HFP_CALL) || (usecase->type == PCM_CAPTURE)) snd_device = usecase->in_snd_device; acdb_dev_id = acdb_device_table[audio_extn_get_spkr_prot_snd_device(snd_device)]; acdb_dev_id = acdb_device_table[platform_get_spkr_prot_snd_device(snd_device)]; // Do not use Rx path default app type for TX path if ((usecase->type == PCM_CAPTURE) && (app_type == DEFAULT_APP_TYPE_RX_PATH)) { Loading Loading @@ -4898,3 +4898,66 @@ bool platform_send_gain_dep_cal(void *platform __unused, { return 0; } bool platform_can_enable_spkr_prot_on_device(snd_device_t snd_device) { bool ret = false; if (snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA || snd_device == SND_DEVICE_OUT_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_VBAT || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER || snd_device == SND_DEVICE_OUT_VOICE_SPEAKER_WSA) { ret = true; } return ret; } int platform_get_spkr_prot_acdb_id(snd_device_t snd_device) { int acdb_id; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED); break; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED); break; case SND_DEVICE_OUT_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT); break; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: acdb_id = platform_get_snd_device_acdb_id(SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT); break; default: acdb_id = -EINVAL; break; } return acdb_id; } int platform_get_spkr_prot_snd_device(snd_device_t snd_device) { if (!audio_extn_spkr_prot_is_enabled()) return snd_device; switch(snd_device) { case SND_DEVICE_OUT_SPEAKER: case SND_DEVICE_OUT_SPEAKER_WSA: return SND_DEVICE_OUT_SPEAKER_PROTECTED; case SND_DEVICE_OUT_VOICE_SPEAKER: case SND_DEVICE_OUT_VOICE_SPEAKER_WSA: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED; case SND_DEVICE_OUT_SPEAKER_VBAT: return SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT; case SND_DEVICE_OUT_VOICE_SPEAKER_VBAT: return SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT; default: return snd_device; } }