Loading hal/audio_extn/adsp_hdlr.c +27 −7 Original line number Diff line number Diff line /* * Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -457,7 +457,7 @@ int audio_extn_adsp_hdlr_stream_deregister_event(void *handle, void *data) int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, adsp_event_callback_t cb, void *cookie) void *cookie, bool is_adm_event) { int ret = 0; char mixer_ctl_name[MIXER_PATH_MAX_LENGTH] = {0}; Loading @@ -480,14 +480,22 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, ALOGE("%s: Invalid payload_length %d",__func__, param->payload_length); return -EINVAL; } if (is_adm_event) ret = snprintf(cb_mixer_ctl_name, sizeof(cb_mixer_ctl_name), "ADSP COPP Callback Event"); else ret = snprintf(cb_mixer_ctl_name, sizeof(cb_mixer_ctl_name), "ADSP Stream Callback Event %d", config->pcm_device_id); if (ret < 0) { ALOGE("%s: snprintf failed",__func__); ret = -EINVAL; goto done; } ctl = mixer_get_ctl_by_name(adsp_hdlr_inst->mixer, cb_mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, cb_mixer_ctl_name); Loading @@ -495,8 +503,13 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, goto done; } if (is_adm_event) ret = snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "COPP Event Cmd"); else ret = snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "ADSP Stream Cmd %d", config->pcm_device_id); if (ret < 0) { ALOGE("%s: snprintf failed",__func__); ret = -EINVAL; Loading @@ -504,12 +517,14 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, } ctl = mixer_get_ctl_by_name(adsp_hdlr_inst->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); ret = -EINVAL; goto done; } ALOGD("%s: event = %d, payload_length %d", __func__, param->event_type, param->payload_length); /* copy event_type, payload size and payload */ Loading @@ -521,6 +536,7 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, param->payload, param->payload_length); ret = mixer_ctl_set_array(ctl, payload, (sizeof(param->event_type) + sizeof(param->payload_length) + param->payload_length)); if (ret < 0) { ALOGE("%s: Could not set ctl for mixer cmd - %s, ret %d", __func__, mixer_ctl_name, ret); Loading @@ -537,23 +553,27 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, /* create event threads during first event registration */ pthread_mutex_lock(&adsp_hdlr_inst->event_wait_lock); if (!adsp_hdlr_inst->event_wait_thread_active) create_event_wait_thread(adsp_hdlr_inst); pthread_mutex_unlock(&adsp_hdlr_inst->event_wait_lock); pthread_mutex_unlock(&adsp_hdlr_inst->event_wait_lock); pthread_mutex_lock(&adsp_hdlr_inst->event_callback_lock); if (!adsp_hdlr_inst->event_callback_thread_active) create_event_callback_thread(adsp_hdlr_inst); pthread_mutex_unlock(&adsp_hdlr_inst->event_callback_lock); pthread_mutex_unlock(&adsp_hdlr_inst->event_callback_lock); send_cmd_event_wait_thread(adsp_hdlr_inst, EVENT_CMD_WAIT); } event_info = (struct adsp_hdlr_event_info *) calloc(1, sizeof(struct adsp_hdlr_event_info)); if (event_info == NULL) { ret = -ENOMEM; goto done; } event_info->event_type = param->event_type; event_info->cb = cb; event_info->cookie = cookie; Loading Loading @@ -582,7 +602,7 @@ int audio_extn_adsp_hdlr_stream_set_param(void *handle, switch (cmd) { case ADSP_HDLR_STREAM_CMD_REGISTER_EVENT : ret = audio_extn_adsp_hdlr_stream_register_event(handle, param, NULL, NULL); ret = audio_extn_adsp_hdlr_stream_register_event(handle, param, NULL, NULL, false); if (ret) ALOGE("%s:adsp_hdlr_stream_register_event failed error %d", __func__, ret); Loading hal/audio_extn/adsp_hdlr.h +1 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ int audio_extn_adsp_hdlr_stream_set_param(void *handle, adsp_hdlr_cmd_t cmd, void *param); int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *param, adsp_event_callback_t cb, void *cookie); void *param, adsp_event_callback_t cb, void *cookie, bool is_adm_event); int audio_extn_adsp_hdlr_stream_deregister_event(void *handle, void *param); #else #define audio_extn_adsp_hdlr_init(mixer) (0) Loading hal/audio_extn/audio_defs.h +2 −1 Original line number Diff line number Diff line /* * Copyright (c) 2014-2015, 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2015, 2017-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -217,6 +217,7 @@ typedef enum { typedef enum { AUDIO_STREAM_PP_EVENT = 0, AUDIO_STREAM_ENCDEC_EVENT = 1, AUDIO_COPP_EVENT = 3, } audio_event_id; /* payload format for HAL parameter Loading hal/audio_extn/hw_loopback.c +3 −2 Original line number Diff line number Diff line /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -553,7 +553,8 @@ int create_loopback_session(loopback_patch_t *active_loopback_patch) inout->adsp_hdlr_stream_handle = NULL; goto exit; } if (audio_extn_ip_hdlr_intf_supported(source_patch_config->format,false, true)) { if (audio_extn_ip_hdlr_intf_supported(source_patch_config->format,false, true) || audio_extn_ip_hdlr_intf_supported_for_copp(adev->platform)) { ret = audio_extn_ip_hdlr_intf_init(&inout->ip_hdlr_handle, NULL, NULL, adev, USECASE_AUDIO_TRANSCODE_LOOPBACK_RX); if (ret < 0) { Loading Loading
hal/audio_extn/adsp_hdlr.c +27 −7 Original line number Diff line number Diff line /* * Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -457,7 +457,7 @@ int audio_extn_adsp_hdlr_stream_deregister_event(void *handle, void *data) int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, adsp_event_callback_t cb, void *cookie) void *cookie, bool is_adm_event) { int ret = 0; char mixer_ctl_name[MIXER_PATH_MAX_LENGTH] = {0}; Loading @@ -480,14 +480,22 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, ALOGE("%s: Invalid payload_length %d",__func__, param->payload_length); return -EINVAL; } if (is_adm_event) ret = snprintf(cb_mixer_ctl_name, sizeof(cb_mixer_ctl_name), "ADSP COPP Callback Event"); else ret = snprintf(cb_mixer_ctl_name, sizeof(cb_mixer_ctl_name), "ADSP Stream Callback Event %d", config->pcm_device_id); if (ret < 0) { ALOGE("%s: snprintf failed",__func__); ret = -EINVAL; goto done; } ctl = mixer_get_ctl_by_name(adsp_hdlr_inst->mixer, cb_mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, cb_mixer_ctl_name); Loading @@ -495,8 +503,13 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, goto done; } if (is_adm_event) ret = snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "COPP Event Cmd"); else ret = snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "ADSP Stream Cmd %d", config->pcm_device_id); if (ret < 0) { ALOGE("%s: snprintf failed",__func__); ret = -EINVAL; Loading @@ -504,12 +517,14 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, } ctl = mixer_get_ctl_by_name(adsp_hdlr_inst->mixer, mixer_ctl_name); if (!ctl) { ALOGE("%s: Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name); ret = -EINVAL; goto done; } ALOGD("%s: event = %d, payload_length %d", __func__, param->event_type, param->payload_length); /* copy event_type, payload size and payload */ Loading @@ -521,6 +536,7 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, param->payload, param->payload_length); ret = mixer_ctl_set_array(ctl, payload, (sizeof(param->event_type) + sizeof(param->payload_length) + param->payload_length)); if (ret < 0) { ALOGE("%s: Could not set ctl for mixer cmd - %s, ret %d", __func__, mixer_ctl_name, ret); Loading @@ -537,23 +553,27 @@ int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *data, /* create event threads during first event registration */ pthread_mutex_lock(&adsp_hdlr_inst->event_wait_lock); if (!adsp_hdlr_inst->event_wait_thread_active) create_event_wait_thread(adsp_hdlr_inst); pthread_mutex_unlock(&adsp_hdlr_inst->event_wait_lock); pthread_mutex_unlock(&adsp_hdlr_inst->event_wait_lock); pthread_mutex_lock(&adsp_hdlr_inst->event_callback_lock); if (!adsp_hdlr_inst->event_callback_thread_active) create_event_callback_thread(adsp_hdlr_inst); pthread_mutex_unlock(&adsp_hdlr_inst->event_callback_lock); pthread_mutex_unlock(&adsp_hdlr_inst->event_callback_lock); send_cmd_event_wait_thread(adsp_hdlr_inst, EVENT_CMD_WAIT); } event_info = (struct adsp_hdlr_event_info *) calloc(1, sizeof(struct adsp_hdlr_event_info)); if (event_info == NULL) { ret = -ENOMEM; goto done; } event_info->event_type = param->event_type; event_info->cb = cb; event_info->cookie = cookie; Loading Loading @@ -582,7 +602,7 @@ int audio_extn_adsp_hdlr_stream_set_param(void *handle, switch (cmd) { case ADSP_HDLR_STREAM_CMD_REGISTER_EVENT : ret = audio_extn_adsp_hdlr_stream_register_event(handle, param, NULL, NULL); ret = audio_extn_adsp_hdlr_stream_register_event(handle, param, NULL, NULL, false); if (ret) ALOGE("%s:adsp_hdlr_stream_register_event failed error %d", __func__, ret); Loading
hal/audio_extn/adsp_hdlr.h +1 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ int audio_extn_adsp_hdlr_stream_set_param(void *handle, adsp_hdlr_cmd_t cmd, void *param); int audio_extn_adsp_hdlr_stream_register_event(void *handle, void *param, adsp_event_callback_t cb, void *cookie); void *param, adsp_event_callback_t cb, void *cookie, bool is_adm_event); int audio_extn_adsp_hdlr_stream_deregister_event(void *handle, void *param); #else #define audio_extn_adsp_hdlr_init(mixer) (0) Loading
hal/audio_extn/audio_defs.h +2 −1 Original line number Diff line number Diff line /* * Copyright (c) 2014-2015, 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2015, 2017-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -217,6 +217,7 @@ typedef enum { typedef enum { AUDIO_STREAM_PP_EVENT = 0, AUDIO_STREAM_ENCDEC_EVENT = 1, AUDIO_COPP_EVENT = 3, } audio_event_id; /* payload format for HAL parameter Loading
hal/audio_extn/hw_loopback.c +3 −2 Original line number Diff line number Diff line /* * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -553,7 +553,8 @@ int create_loopback_session(loopback_patch_t *active_loopback_patch) inout->adsp_hdlr_stream_handle = NULL; goto exit; } if (audio_extn_ip_hdlr_intf_supported(source_patch_config->format,false, true)) { if (audio_extn_ip_hdlr_intf_supported(source_patch_config->format,false, true) || audio_extn_ip_hdlr_intf_supported_for_copp(adev->platform)) { ret = audio_extn_ip_hdlr_intf_init(&inout->ip_hdlr_handle, NULL, NULL, adev, USECASE_AUDIO_TRANSCODE_LOOPBACK_RX); if (ret < 0) { Loading