Loading hal/audio_extn/audio_extn.h +3 −8 Original line number Diff line number Diff line Loading @@ -141,23 +141,18 @@ void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device, #ifndef AUDIO_LISTEN_ENABLED #define audio_extn_listen_init(adev, snd_card) (0) #define audio_extn_listen_deinit(adev) (0) #define audio_extn_listen_update_device_status(snd_dev, event) (0) #define audio_extn_listen_update_stream_status(uc_info, event) (0) #define audio_extn_listen_update_status(uc_info, event) (0) #define audio_extn_listen_set_parameters(adev, parms) (0) #else enum listen_event_type { LISTEN_EVENT_SND_DEVICE_FREE, LISTEN_EVENT_SND_DEVICE_BUSY, LISTEN_EVENT_STREAM_FREE, LISTEN_EVENT_STREAM_BUSY LISTEN_EVENT_SND_DEVICE_BUSY }; typedef enum listen_event_type listen_event_type_t; int audio_extn_listen_init(struct audio_device *adev, unsigned int snd_card); void audio_extn_listen_deinit(struct audio_device *adev); void audio_extn_listen_update_device_status(snd_device_t snd_device, listen_event_type_t event); void audio_extn_listen_update_stream_status(struct audio_usecase *uc_info, void audio_extn_listen_update_status(snd_device_t snd_device, listen_event_type_t event); void audio_extn_listen_set_parameters(struct audio_device *adev, struct str_parms *parms); Loading hal/audio_extn/listen.c +14 −69 Original line number Diff line number Diff line Loading @@ -95,75 +95,25 @@ struct listen_audio_device { static struct listen_audio_device *listen_dev; void audio_extn_listen_update_device_status(snd_device_t snd_device, void audio_extn_listen_update_status(snd_device_t snd_device, listen_event_type_t event) { bool raise_event = false; int device_type = -1; if (snd_device >= SND_DEVICE_OUT_BEGIN && snd_device < SND_DEVICE_OUT_END) device_type = PCM_PLAYBACK; else if (snd_device >= SND_DEVICE_IN_BEGIN && snd_device < SND_DEVICE_IN_END) device_type = PCM_CAPTURE; else { ALOGE("%s: invalid device 0x%x, for event %d", __func__, snd_device, event); if (!platform_listen_update_status(snd_device)) { ALOGV("%s(): no need to notify listen. device = %s. Event = %u", __func__, platform_get_snd_device_name(snd_device), event); return; } if (listen_dev) { raise_event = platform_listen_device_needs_event(snd_device); ALOGI("%s(): device 0x%x of type %d for Event %d, with Raise=%d", __func__, snd_device, device_type, event, raise_event); if (raise_event && (device_type == PCM_CAPTURE)) { switch(event) { case LISTEN_EVENT_SND_DEVICE_FREE: listen_dev->notify_event(AUDIO_DEVICE_IN_INACTIVE); break; case LISTEN_EVENT_SND_DEVICE_BUSY: listen_dev->notify_event(AUDIO_DEVICE_IN_ACTIVE); break; default: ALOGW("%s:invalid event %d for device 0x%x", __func__, event, snd_device); } }/*Events for output device, if required can be placed here in else*/ } } ALOGI("%s(): %s listen. current active device = %s. Event = %u", __func__, (event == LISTEN_EVENT_SND_DEVICE_BUSY) ? "stop" : "start", platform_get_snd_device_name(snd_device), event); void audio_extn_listen_update_stream_status(struct audio_usecase *uc_info, listen_event_type_t event) { bool raise_event = false; audio_usecase_t uc_id; int usecase_type = -1; if (uc_info == NULL) { ALOGE("%s: usecase is NULL!!!", __func__); return; } uc_id = uc_info->id; usecase_type = uc_info->type; if (listen_dev) { raise_event = platform_listen_usecase_needs_event(uc_id); ALOGI("%s(): uc_id %d of type %d for Event %d, with Raise=%d", __func__, uc_id, usecase_type, event, raise_event); if (raise_event && (usecase_type == PCM_PLAYBACK)) { switch(event) { case LISTEN_EVENT_STREAM_FREE: listen_dev->notify_event(AUDIO_STREAM_OUT_INACTIVE); break; case LISTEN_EVENT_STREAM_BUSY: listen_dev->notify_event(AUDIO_STREAM_OUT_ACTIVE); break; default: ALOGW("%s:invalid event %d, for usecase %d", __func__, event, uc_id); } }/*Events for capture usecase, if required can be placed here in else*/ if (event == LISTEN_EVENT_SND_DEVICE_FREE) listen_dev->notify_event(AUDIO_CAPTURE_INACTIVE); else if (event == LISTEN_EVENT_SND_DEVICE_BUSY) listen_dev->notify_event(AUDIO_CAPTURE_ACTIVE); } } Loading Loading @@ -200,11 +150,6 @@ int audio_extn_listen_init(struct audio_device *adev, unsigned int snd_card) listen_dev = (struct listen_audio_device*) calloc(1, sizeof(struct listen_audio_device)); if (!listen_dev) { ALOGE("failed to allocate listen_dev mem"); return -ENOMEM; } listen_dev->lib_handle = lib_handle; listen_dev->adev = adev; Loading hal/audio_hw.c +3 −10 Original line number Diff line number Diff line Loading @@ -519,7 +519,6 @@ int enable_audio_route(struct audio_device *adev, audio_extn_dolby_set_dmid(adev); audio_extn_dolby_set_endpoint(adev); #endif audio_extn_listen_update_stream_status(usecase, LISTEN_EVENT_STREAM_BUSY); strcpy(mixer_path, use_case_table[usecase->id]); platform_add_backend_name(mixer_path, snd_device); ALOGV("%s: apply mixer and update path: %s", __func__, mixer_path); Loading @@ -546,7 +545,6 @@ int disable_audio_route(struct audio_device *adev, platform_add_backend_name(mixer_path, snd_device); ALOGV("%s: reset and update mixer path: %s", __func__, mixer_path); audio_route_reset_and_update_path(adev->audio_route, mixer_path); audio_extn_listen_update_stream_status(usecase, LISTEN_EVENT_STREAM_FREE); ALOGV("%s: exit", __func__); return 0; } Loading Loading @@ -593,17 +591,12 @@ int enable_snd_device(struct audio_device *adev, } else { ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, device_name); /* due to the possibility of calibration overwrite between listen and audio, notify listen hal before audio calibration is sent */ audio_extn_listen_update_device_status(snd_device, LISTEN_EVENT_SND_DEVICE_BUSY); if (platform_send_audio_calibration(adev->platform, snd_device) < 0) { adev->snd_dev_ref_cnt[snd_device]--; audio_extn_listen_update_device_status(snd_device, LISTEN_EVENT_SND_DEVICE_FREE); return -EINVAL; } audio_extn_listen_update_status(snd_device, LISTEN_EVENT_SND_DEVICE_BUSY); amplifier_enable_devices(snd_device, true); audio_route_apply_and_update_path(adev->audio_route, device_name); } Loading Loading @@ -653,7 +646,7 @@ int disable_snd_device(struct audio_device *adev, amplifier_enable_devices(snd_device, false); } audio_extn_listen_update_device_status(snd_device, audio_extn_listen_update_status(snd_device, LISTEN_EVENT_SND_DEVICE_FREE); } Loading hal/msm8960/platform.c +1 −6 Original line number Diff line number Diff line Loading @@ -920,12 +920,7 @@ int platform_update_usecase_from_source(int source __unused, return usecase; } bool platform_listen_device_needs_event(snd_device_t snd_device __unused) { return false; } bool platform_listen_usecase_needs_event(audio_usecase_t uc_id) bool platform_listen_update_status(snd_device_t snd_device __unused) { return false; } Loading hal/msm8974/platform.c +4 −11 Original line number Diff line number Diff line Loading @@ -2199,23 +2199,16 @@ int platform_update_usecase_from_source(int source, int usecase) } } bool platform_listen_device_needs_event(snd_device_t snd_device) bool platform_listen_update_status(snd_device_t snd_device) { bool needs_event = false; if ((snd_device >= SND_DEVICE_IN_BEGIN) && (snd_device < SND_DEVICE_IN_END) && #ifdef FM_ENABLED (snd_device != SND_DEVICE_IN_CAPTURE_FM) && #endif (snd_device != SND_DEVICE_IN_CAPTURE_VI_FEEDBACK)) needs_event = true; return needs_event; } bool platform_listen_usecase_needs_event(audio_usecase_t uc_id __unused) { return true; else return false; } Loading Loading
hal/audio_extn/audio_extn.h +3 −8 Original line number Diff line number Diff line Loading @@ -141,23 +141,18 @@ void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device, #ifndef AUDIO_LISTEN_ENABLED #define audio_extn_listen_init(adev, snd_card) (0) #define audio_extn_listen_deinit(adev) (0) #define audio_extn_listen_update_device_status(snd_dev, event) (0) #define audio_extn_listen_update_stream_status(uc_info, event) (0) #define audio_extn_listen_update_status(uc_info, event) (0) #define audio_extn_listen_set_parameters(adev, parms) (0) #else enum listen_event_type { LISTEN_EVENT_SND_DEVICE_FREE, LISTEN_EVENT_SND_DEVICE_BUSY, LISTEN_EVENT_STREAM_FREE, LISTEN_EVENT_STREAM_BUSY LISTEN_EVENT_SND_DEVICE_BUSY }; typedef enum listen_event_type listen_event_type_t; int audio_extn_listen_init(struct audio_device *adev, unsigned int snd_card); void audio_extn_listen_deinit(struct audio_device *adev); void audio_extn_listen_update_device_status(snd_device_t snd_device, listen_event_type_t event); void audio_extn_listen_update_stream_status(struct audio_usecase *uc_info, void audio_extn_listen_update_status(snd_device_t snd_device, listen_event_type_t event); void audio_extn_listen_set_parameters(struct audio_device *adev, struct str_parms *parms); Loading
hal/audio_extn/listen.c +14 −69 Original line number Diff line number Diff line Loading @@ -95,75 +95,25 @@ struct listen_audio_device { static struct listen_audio_device *listen_dev; void audio_extn_listen_update_device_status(snd_device_t snd_device, void audio_extn_listen_update_status(snd_device_t snd_device, listen_event_type_t event) { bool raise_event = false; int device_type = -1; if (snd_device >= SND_DEVICE_OUT_BEGIN && snd_device < SND_DEVICE_OUT_END) device_type = PCM_PLAYBACK; else if (snd_device >= SND_DEVICE_IN_BEGIN && snd_device < SND_DEVICE_IN_END) device_type = PCM_CAPTURE; else { ALOGE("%s: invalid device 0x%x, for event %d", __func__, snd_device, event); if (!platform_listen_update_status(snd_device)) { ALOGV("%s(): no need to notify listen. device = %s. Event = %u", __func__, platform_get_snd_device_name(snd_device), event); return; } if (listen_dev) { raise_event = platform_listen_device_needs_event(snd_device); ALOGI("%s(): device 0x%x of type %d for Event %d, with Raise=%d", __func__, snd_device, device_type, event, raise_event); if (raise_event && (device_type == PCM_CAPTURE)) { switch(event) { case LISTEN_EVENT_SND_DEVICE_FREE: listen_dev->notify_event(AUDIO_DEVICE_IN_INACTIVE); break; case LISTEN_EVENT_SND_DEVICE_BUSY: listen_dev->notify_event(AUDIO_DEVICE_IN_ACTIVE); break; default: ALOGW("%s:invalid event %d for device 0x%x", __func__, event, snd_device); } }/*Events for output device, if required can be placed here in else*/ } } ALOGI("%s(): %s listen. current active device = %s. Event = %u", __func__, (event == LISTEN_EVENT_SND_DEVICE_BUSY) ? "stop" : "start", platform_get_snd_device_name(snd_device), event); void audio_extn_listen_update_stream_status(struct audio_usecase *uc_info, listen_event_type_t event) { bool raise_event = false; audio_usecase_t uc_id; int usecase_type = -1; if (uc_info == NULL) { ALOGE("%s: usecase is NULL!!!", __func__); return; } uc_id = uc_info->id; usecase_type = uc_info->type; if (listen_dev) { raise_event = platform_listen_usecase_needs_event(uc_id); ALOGI("%s(): uc_id %d of type %d for Event %d, with Raise=%d", __func__, uc_id, usecase_type, event, raise_event); if (raise_event && (usecase_type == PCM_PLAYBACK)) { switch(event) { case LISTEN_EVENT_STREAM_FREE: listen_dev->notify_event(AUDIO_STREAM_OUT_INACTIVE); break; case LISTEN_EVENT_STREAM_BUSY: listen_dev->notify_event(AUDIO_STREAM_OUT_ACTIVE); break; default: ALOGW("%s:invalid event %d, for usecase %d", __func__, event, uc_id); } }/*Events for capture usecase, if required can be placed here in else*/ if (event == LISTEN_EVENT_SND_DEVICE_FREE) listen_dev->notify_event(AUDIO_CAPTURE_INACTIVE); else if (event == LISTEN_EVENT_SND_DEVICE_BUSY) listen_dev->notify_event(AUDIO_CAPTURE_ACTIVE); } } Loading Loading @@ -200,11 +150,6 @@ int audio_extn_listen_init(struct audio_device *adev, unsigned int snd_card) listen_dev = (struct listen_audio_device*) calloc(1, sizeof(struct listen_audio_device)); if (!listen_dev) { ALOGE("failed to allocate listen_dev mem"); return -ENOMEM; } listen_dev->lib_handle = lib_handle; listen_dev->adev = adev; Loading
hal/audio_hw.c +3 −10 Original line number Diff line number Diff line Loading @@ -519,7 +519,6 @@ int enable_audio_route(struct audio_device *adev, audio_extn_dolby_set_dmid(adev); audio_extn_dolby_set_endpoint(adev); #endif audio_extn_listen_update_stream_status(usecase, LISTEN_EVENT_STREAM_BUSY); strcpy(mixer_path, use_case_table[usecase->id]); platform_add_backend_name(mixer_path, snd_device); ALOGV("%s: apply mixer and update path: %s", __func__, mixer_path); Loading @@ -546,7 +545,6 @@ int disable_audio_route(struct audio_device *adev, platform_add_backend_name(mixer_path, snd_device); ALOGV("%s: reset and update mixer path: %s", __func__, mixer_path); audio_route_reset_and_update_path(adev->audio_route, mixer_path); audio_extn_listen_update_stream_status(usecase, LISTEN_EVENT_STREAM_FREE); ALOGV("%s: exit", __func__); return 0; } Loading Loading @@ -593,17 +591,12 @@ int enable_snd_device(struct audio_device *adev, } else { ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, device_name); /* due to the possibility of calibration overwrite between listen and audio, notify listen hal before audio calibration is sent */ audio_extn_listen_update_device_status(snd_device, LISTEN_EVENT_SND_DEVICE_BUSY); if (platform_send_audio_calibration(adev->platform, snd_device) < 0) { adev->snd_dev_ref_cnt[snd_device]--; audio_extn_listen_update_device_status(snd_device, LISTEN_EVENT_SND_DEVICE_FREE); return -EINVAL; } audio_extn_listen_update_status(snd_device, LISTEN_EVENT_SND_DEVICE_BUSY); amplifier_enable_devices(snd_device, true); audio_route_apply_and_update_path(adev->audio_route, device_name); } Loading Loading @@ -653,7 +646,7 @@ int disable_snd_device(struct audio_device *adev, amplifier_enable_devices(snd_device, false); } audio_extn_listen_update_device_status(snd_device, audio_extn_listen_update_status(snd_device, LISTEN_EVENT_SND_DEVICE_FREE); } Loading
hal/msm8960/platform.c +1 −6 Original line number Diff line number Diff line Loading @@ -920,12 +920,7 @@ int platform_update_usecase_from_source(int source __unused, return usecase; } bool platform_listen_device_needs_event(snd_device_t snd_device __unused) { return false; } bool platform_listen_usecase_needs_event(audio_usecase_t uc_id) bool platform_listen_update_status(snd_device_t snd_device __unused) { return false; } Loading
hal/msm8974/platform.c +4 −11 Original line number Diff line number Diff line Loading @@ -2199,23 +2199,16 @@ int platform_update_usecase_from_source(int source, int usecase) } } bool platform_listen_device_needs_event(snd_device_t snd_device) bool platform_listen_update_status(snd_device_t snd_device) { bool needs_event = false; if ((snd_device >= SND_DEVICE_IN_BEGIN) && (snd_device < SND_DEVICE_IN_END) && #ifdef FM_ENABLED (snd_device != SND_DEVICE_IN_CAPTURE_FM) && #endif (snd_device != SND_DEVICE_IN_CAPTURE_VI_FEEDBACK)) needs_event = true; return needs_event; } bool platform_listen_usecase_needs_event(audio_usecase_t uc_id __unused) { return true; else return false; } Loading