Loading include/linux/qdsp6v2/rtac.h +26 −0 Original line number Original line Diff line number Diff line Loading @@ -14,11 +14,16 @@ #ifndef __RTAC_H__ #ifndef __RTAC_H__ #define __RTAC_H__ #define __RTAC_H__ #include <sound/apr_audio-v2.h> /* Voice Modes */ /* Voice Modes */ #define RTAC_CVP 0 #define RTAC_CVP 0 #define RTAC_CVS 1 #define RTAC_CVS 1 #define RTAC_VOICE_MODES 2 #define RTAC_VOICE_MODES 2 #define RTAC_MAX_ACTIVE_DEVICES 4 #define RTAC_MAX_ACTIVE_POPP 8 enum { enum { ADM_RTAC_CAL, ADM_RTAC_CAL, ASM_RTAC_CAL, ASM_RTAC_CAL, Loading @@ -45,6 +50,26 @@ struct rtac_cal_block_data { struct rtac_cal_data cal_data; struct rtac_cal_data cal_data; }; }; struct rtac_popp_data { uint32_t popp; uint32_t popp_topology; }; struct rtac_adm_data { uint32_t topology_id; uint32_t afe_port; uint32_t copp; uint32_t num_of_popp; uint32_t app_type; uint32_t acdb_dev_id; struct rtac_popp_data popp[RTAC_MAX_ACTIVE_POPP]; }; struct rtac_adm { uint32_t num_of_dev; struct rtac_adm_data device[RTAC_MAX_ACTIVE_DEVICES]; }; void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id, void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id, u32 app_type, u32 acdb_dev_id); u32 app_type, u32 acdb_dev_id); void rtac_remove_adm_device(u32 port_id, u32 copp_id); void rtac_remove_adm_device(u32 port_id, u32 copp_id); Loading @@ -65,4 +90,5 @@ void rtac_copy_voice_payload_to_user(void *payload, u32 payload_size); int rtac_clear_mapping(uint32_t cal_type); int rtac_clear_mapping(uint32_t cal_type); bool rtac_make_afe_callback(uint32_t *payload, u32 payload_size); bool rtac_make_afe_callback(uint32_t *payload, u32 payload_size); void rtac_set_afe_handle(void *handle); void rtac_set_afe_handle(void *handle); void get_rtac_adm_data(struct rtac_adm *adm_data); #endif #endif include/sound/q6adm-v2.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -36,6 +36,7 @@ enum { ADM_RTAC_APR_CAL, ADM_RTAC_APR_CAL, ADM_DTS_EAGLE, ADM_DTS_EAGLE, ADM_SRS_TRUMEDIA, ADM_SRS_TRUMEDIA, ADM_RTAC_AUDVOL_CAL, ADM_MAX_CAL_TYPES ADM_MAX_CAL_TYPES }; }; Loading include/uapi/linux/msm_audio_calibration.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -93,6 +93,7 @@ enum { SRS_TRUMEDIA_CAL_TYPE, SRS_TRUMEDIA_CAL_TYPE, CORE_CUSTOM_TOPOLOGIES_CAL_TYPE, CORE_CUSTOM_TOPOLOGIES_CAL_TYPE, ADM_RTAC_AUDVOL_CAL_TYPE, MAX_CAL_TYPES, MAX_CAL_TYPES, }; }; Loading sound/soc/msm/qdsp6v2/audio_cal_utils.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -62,6 +62,7 @@ size_t get_cal_info_size(int32_t cal_type) size = sizeof(struct audio_cal_info_audproc); size = sizeof(struct audio_cal_info_audproc); break; break; case ADM_AUDVOL_CAL_TYPE: case ADM_AUDVOL_CAL_TYPE: case ADM_RTAC_AUDVOL_CAL_TYPE: size = sizeof(struct audio_cal_info_audvol); size = sizeof(struct audio_cal_info_audvol); break; break; case ASM_TOPOLOGY_CAL_TYPE: case ASM_TOPOLOGY_CAL_TYPE: Loading Loading @@ -188,6 +189,7 @@ size_t get_user_cal_type_size(int32_t cal_type) size = sizeof(struct audio_cal_type_audproc); size = sizeof(struct audio_cal_type_audproc); break; break; case ADM_AUDVOL_CAL_TYPE: case ADM_AUDVOL_CAL_TYPE: case ADM_RTAC_AUDVOL_CAL_TYPE: size = sizeof(struct audio_cal_type_audvol); size = sizeof(struct audio_cal_type_audvol); break; break; case ASM_TOPOLOGY_CAL_TYPE: case ASM_TOPOLOGY_CAL_TYPE: Loading sound/soc/msm/qdsp6v2/q6adm.c +109 −13 Original line number Original line Diff line number Diff line Loading @@ -1870,6 +1870,28 @@ static struct cal_block_data *adm_find_cal(int cal_index, int path, return adm_find_cal_by_app_type(cal_index, path, app_type); return adm_find_cal_by_app_type(cal_index, path, app_type); } } static int adm_remap_and_send_cal_block(int cal_index, int port_id, int copp_idx, struct cal_block_data *cal_block, int perf_mode, int app_type, int acdb_id, int sample_rate) { int ret = 0; pr_debug("%s: Sending cal_index cal %d\n", __func__, cal_index); ret = remap_cal_data(cal_block, cal_index); if (ret) { pr_err("%s: Remap_cal_data failed for cal %d!\n", __func__, cal_index); goto done; } ret = send_adm_cal_block(port_id, copp_idx, cal_block, perf_mode, app_type, acdb_id, sample_rate); if (ret < 0) pr_debug("%s: No cal sent for cal_index %d, port_id = 0x%x! ret %d sample_rate %d\n", __func__, cal_index, port_id, ret, sample_rate); done: return ret; } static void send_adm_cal_type(int cal_index, int path, int port_id, static void send_adm_cal_type(int cal_index, int path, int port_id, int copp_idx, int perf_mode, int app_type, int copp_idx, int perf_mode, int app_type, int acdb_id, int sample_rate) int acdb_id, int sample_rate) Loading @@ -1891,18 +1913,8 @@ static void send_adm_cal_type(int cal_index, int path, int port_id, if (cal_block == NULL) if (cal_block == NULL) goto unlock; goto unlock; pr_debug("%s: Sending cal_index cal %d\n", __func__, cal_index); ret = adm_remap_and_send_cal_block(cal_index, port_id, copp_idx, ret = remap_cal_data(cal_block, cal_index); cal_block, perf_mode, app_type, acdb_id, sample_rate); if (ret) { pr_err("%s: Remap_cal_data failed for cal %d!\n", __func__, cal_index); goto unlock; } ret = send_adm_cal_block(port_id, copp_idx, cal_block, perf_mode, app_type, acdb_id, sample_rate); if (ret < 0) pr_debug("%s: No cal sent for cal_index %d, port_id = 0x%x! ret %d sample_rate %d\n", __func__, cal_index, port_id, ret, sample_rate); unlock: unlock: mutex_unlock(&this_adm.cal_data[cal_index]->lock); mutex_unlock(&this_adm.cal_data[cal_index]->lock); done: done: Loading Loading @@ -2534,6 +2546,79 @@ int adm_close(int port_id, int perf_mode, int copp_idx) return 0; return 0; } } int send_rtac_audvol_cal(void) { int ret = 0; int ret2 = 0; int i = 0; int copp_idx, port_idx, acdb_id, app_id, path; struct cal_block_data *cal_block = NULL; struct audio_cal_info_audvol *audvol_cal_info = NULL; struct rtac_adm rtac_adm_data; mutex_lock(&this_adm.cal_data[ADM_RTAC_AUDVOL_CAL]->lock); cal_block = cal_utils_get_only_cal_block( this_adm.cal_data[ADM_RTAC_AUDVOL_CAL]); if (cal_block == NULL) { pr_err("%s: can't find cal block!\n", __func__); goto unlock; } audvol_cal_info = cal_block->cal_info; if (audvol_cal_info == NULL) { pr_err("%s: audvol_cal_info is NULL!\n", __func__); goto unlock; } get_rtac_adm_data(&rtac_adm_data); for (; i < rtac_adm_data.num_of_dev; i++) { acdb_id = rtac_adm_data.device[i].acdb_dev_id; if (acdb_id == 0) acdb_id = audvol_cal_info->acdb_id; app_id = rtac_adm_data.device[i].app_type; if (app_id == 0) app_id = audvol_cal_info->app_type; path = afe_get_port_type(rtac_adm_data.device[i].afe_port); if ((acdb_id == audvol_cal_info->acdb_id) && (app_id == audvol_cal_info->app_type) && (path == audvol_cal_info->path)) { if (adm_get_indexes_from_copp_id(rtac_adm_data. device[i].copp, &copp_idx, &port_idx) != 0) { pr_debug("%s: Copp Id %d is not active\n", __func__, rtac_adm_data.device[i].copp); continue; } ret2 = adm_remap_and_send_cal_block(ADM_RTAC_AUDVOL_CAL, rtac_adm_data.device[i].afe_port, copp_idx, cal_block, atomic_read(&this_adm.copp. mode[port_idx][copp_idx]), audvol_cal_info->app_type, audvol_cal_info->acdb_id, atomic_read(&this_adm.copp. rate[port_idx][copp_idx])); if (ret2 < 0) { pr_debug("%s: remap and send failed for copp Id %d, acdb id %d, app type %d, path %d\n", __func__, rtac_adm_data.device[i].copp, audvol_cal_info->acdb_id, audvol_cal_info->app_type, audvol_cal_info->path); ret = ret2; } } } unlock: mutex_unlock(&this_adm.cal_data[ADM_RTAC_AUDVOL_CAL]->lock); return ret; } int adm_map_rtac_block(struct rtac_cal_block_data *cal_block) int adm_map_rtac_block(struct rtac_cal_block_data *cal_block) { { int result = 0; int result = 0; Loading Loading @@ -2643,6 +2728,9 @@ static int get_cal_type_index(int32_t cal_type) case ADM_RTAC_APR_CAL_TYPE: case ADM_RTAC_APR_CAL_TYPE: ret = ADM_RTAC_APR_CAL; ret = ADM_RTAC_APR_CAL; break; break; case ADM_RTAC_AUDVOL_CAL_TYPE: ret = ADM_RTAC_AUDVOL_CAL; break; default: default: pr_err("%s: invalid cal type %d!\n", __func__, cal_type); pr_err("%s: invalid cal type %d!\n", __func__, cal_type); } } Loading Loading @@ -2728,6 +2816,8 @@ static int adm_set_cal(int32_t cal_type, size_t data_size, void *data) mutex_lock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); mutex_lock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); this_adm.set_custom_topology = 1; this_adm.set_custom_topology = 1; mutex_unlock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); mutex_unlock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); } else if (cal_index == ADM_RTAC_AUDVOL_CAL) { send_rtac_audvol_cal(); } } done: done: return ret; return ret; Loading Loading @@ -2838,7 +2928,13 @@ static int adm_init_cal_data(void) {{SRS_TRUMEDIA_CAL_TYPE, {{SRS_TRUMEDIA_CAL_TYPE, {NULL, NULL, NULL, NULL, NULL, NULL} }, {NULL, NULL, NULL, NULL, NULL, NULL} }, {NULL, NULL, cal_utils_match_buf_num} } {NULL, NULL, cal_utils_match_buf_num} }, {{ADM_RTAC_AUDVOL_CAL_TYPE, {adm_alloc_cal, adm_dealloc_cal, NULL, adm_set_cal, NULL, NULL} }, {adm_map_cal_data, adm_unmap_cal_data, cal_utils_match_buf_num} }, }; }; pr_debug("%s:\n", __func__); pr_debug("%s:\n", __func__); Loading Loading
include/linux/qdsp6v2/rtac.h +26 −0 Original line number Original line Diff line number Diff line Loading @@ -14,11 +14,16 @@ #ifndef __RTAC_H__ #ifndef __RTAC_H__ #define __RTAC_H__ #define __RTAC_H__ #include <sound/apr_audio-v2.h> /* Voice Modes */ /* Voice Modes */ #define RTAC_CVP 0 #define RTAC_CVP 0 #define RTAC_CVS 1 #define RTAC_CVS 1 #define RTAC_VOICE_MODES 2 #define RTAC_VOICE_MODES 2 #define RTAC_MAX_ACTIVE_DEVICES 4 #define RTAC_MAX_ACTIVE_POPP 8 enum { enum { ADM_RTAC_CAL, ADM_RTAC_CAL, ASM_RTAC_CAL, ASM_RTAC_CAL, Loading @@ -45,6 +50,26 @@ struct rtac_cal_block_data { struct rtac_cal_data cal_data; struct rtac_cal_data cal_data; }; }; struct rtac_popp_data { uint32_t popp; uint32_t popp_topology; }; struct rtac_adm_data { uint32_t topology_id; uint32_t afe_port; uint32_t copp; uint32_t num_of_popp; uint32_t app_type; uint32_t acdb_dev_id; struct rtac_popp_data popp[RTAC_MAX_ACTIVE_POPP]; }; struct rtac_adm { uint32_t num_of_dev; struct rtac_adm_data device[RTAC_MAX_ACTIVE_DEVICES]; }; void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id, void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id, u32 app_type, u32 acdb_dev_id); u32 app_type, u32 acdb_dev_id); void rtac_remove_adm_device(u32 port_id, u32 copp_id); void rtac_remove_adm_device(u32 port_id, u32 copp_id); Loading @@ -65,4 +90,5 @@ void rtac_copy_voice_payload_to_user(void *payload, u32 payload_size); int rtac_clear_mapping(uint32_t cal_type); int rtac_clear_mapping(uint32_t cal_type); bool rtac_make_afe_callback(uint32_t *payload, u32 payload_size); bool rtac_make_afe_callback(uint32_t *payload, u32 payload_size); void rtac_set_afe_handle(void *handle); void rtac_set_afe_handle(void *handle); void get_rtac_adm_data(struct rtac_adm *adm_data); #endif #endif
include/sound/q6adm-v2.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -36,6 +36,7 @@ enum { ADM_RTAC_APR_CAL, ADM_RTAC_APR_CAL, ADM_DTS_EAGLE, ADM_DTS_EAGLE, ADM_SRS_TRUMEDIA, ADM_SRS_TRUMEDIA, ADM_RTAC_AUDVOL_CAL, ADM_MAX_CAL_TYPES ADM_MAX_CAL_TYPES }; }; Loading
include/uapi/linux/msm_audio_calibration.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -93,6 +93,7 @@ enum { SRS_TRUMEDIA_CAL_TYPE, SRS_TRUMEDIA_CAL_TYPE, CORE_CUSTOM_TOPOLOGIES_CAL_TYPE, CORE_CUSTOM_TOPOLOGIES_CAL_TYPE, ADM_RTAC_AUDVOL_CAL_TYPE, MAX_CAL_TYPES, MAX_CAL_TYPES, }; }; Loading
sound/soc/msm/qdsp6v2/audio_cal_utils.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -62,6 +62,7 @@ size_t get_cal_info_size(int32_t cal_type) size = sizeof(struct audio_cal_info_audproc); size = sizeof(struct audio_cal_info_audproc); break; break; case ADM_AUDVOL_CAL_TYPE: case ADM_AUDVOL_CAL_TYPE: case ADM_RTAC_AUDVOL_CAL_TYPE: size = sizeof(struct audio_cal_info_audvol); size = sizeof(struct audio_cal_info_audvol); break; break; case ASM_TOPOLOGY_CAL_TYPE: case ASM_TOPOLOGY_CAL_TYPE: Loading Loading @@ -188,6 +189,7 @@ size_t get_user_cal_type_size(int32_t cal_type) size = sizeof(struct audio_cal_type_audproc); size = sizeof(struct audio_cal_type_audproc); break; break; case ADM_AUDVOL_CAL_TYPE: case ADM_AUDVOL_CAL_TYPE: case ADM_RTAC_AUDVOL_CAL_TYPE: size = sizeof(struct audio_cal_type_audvol); size = sizeof(struct audio_cal_type_audvol); break; break; case ASM_TOPOLOGY_CAL_TYPE: case ASM_TOPOLOGY_CAL_TYPE: Loading
sound/soc/msm/qdsp6v2/q6adm.c +109 −13 Original line number Original line Diff line number Diff line Loading @@ -1870,6 +1870,28 @@ static struct cal_block_data *adm_find_cal(int cal_index, int path, return adm_find_cal_by_app_type(cal_index, path, app_type); return adm_find_cal_by_app_type(cal_index, path, app_type); } } static int adm_remap_and_send_cal_block(int cal_index, int port_id, int copp_idx, struct cal_block_data *cal_block, int perf_mode, int app_type, int acdb_id, int sample_rate) { int ret = 0; pr_debug("%s: Sending cal_index cal %d\n", __func__, cal_index); ret = remap_cal_data(cal_block, cal_index); if (ret) { pr_err("%s: Remap_cal_data failed for cal %d!\n", __func__, cal_index); goto done; } ret = send_adm_cal_block(port_id, copp_idx, cal_block, perf_mode, app_type, acdb_id, sample_rate); if (ret < 0) pr_debug("%s: No cal sent for cal_index %d, port_id = 0x%x! ret %d sample_rate %d\n", __func__, cal_index, port_id, ret, sample_rate); done: return ret; } static void send_adm_cal_type(int cal_index, int path, int port_id, static void send_adm_cal_type(int cal_index, int path, int port_id, int copp_idx, int perf_mode, int app_type, int copp_idx, int perf_mode, int app_type, int acdb_id, int sample_rate) int acdb_id, int sample_rate) Loading @@ -1891,18 +1913,8 @@ static void send_adm_cal_type(int cal_index, int path, int port_id, if (cal_block == NULL) if (cal_block == NULL) goto unlock; goto unlock; pr_debug("%s: Sending cal_index cal %d\n", __func__, cal_index); ret = adm_remap_and_send_cal_block(cal_index, port_id, copp_idx, ret = remap_cal_data(cal_block, cal_index); cal_block, perf_mode, app_type, acdb_id, sample_rate); if (ret) { pr_err("%s: Remap_cal_data failed for cal %d!\n", __func__, cal_index); goto unlock; } ret = send_adm_cal_block(port_id, copp_idx, cal_block, perf_mode, app_type, acdb_id, sample_rate); if (ret < 0) pr_debug("%s: No cal sent for cal_index %d, port_id = 0x%x! ret %d sample_rate %d\n", __func__, cal_index, port_id, ret, sample_rate); unlock: unlock: mutex_unlock(&this_adm.cal_data[cal_index]->lock); mutex_unlock(&this_adm.cal_data[cal_index]->lock); done: done: Loading Loading @@ -2534,6 +2546,79 @@ int adm_close(int port_id, int perf_mode, int copp_idx) return 0; return 0; } } int send_rtac_audvol_cal(void) { int ret = 0; int ret2 = 0; int i = 0; int copp_idx, port_idx, acdb_id, app_id, path; struct cal_block_data *cal_block = NULL; struct audio_cal_info_audvol *audvol_cal_info = NULL; struct rtac_adm rtac_adm_data; mutex_lock(&this_adm.cal_data[ADM_RTAC_AUDVOL_CAL]->lock); cal_block = cal_utils_get_only_cal_block( this_adm.cal_data[ADM_RTAC_AUDVOL_CAL]); if (cal_block == NULL) { pr_err("%s: can't find cal block!\n", __func__); goto unlock; } audvol_cal_info = cal_block->cal_info; if (audvol_cal_info == NULL) { pr_err("%s: audvol_cal_info is NULL!\n", __func__); goto unlock; } get_rtac_adm_data(&rtac_adm_data); for (; i < rtac_adm_data.num_of_dev; i++) { acdb_id = rtac_adm_data.device[i].acdb_dev_id; if (acdb_id == 0) acdb_id = audvol_cal_info->acdb_id; app_id = rtac_adm_data.device[i].app_type; if (app_id == 0) app_id = audvol_cal_info->app_type; path = afe_get_port_type(rtac_adm_data.device[i].afe_port); if ((acdb_id == audvol_cal_info->acdb_id) && (app_id == audvol_cal_info->app_type) && (path == audvol_cal_info->path)) { if (adm_get_indexes_from_copp_id(rtac_adm_data. device[i].copp, &copp_idx, &port_idx) != 0) { pr_debug("%s: Copp Id %d is not active\n", __func__, rtac_adm_data.device[i].copp); continue; } ret2 = adm_remap_and_send_cal_block(ADM_RTAC_AUDVOL_CAL, rtac_adm_data.device[i].afe_port, copp_idx, cal_block, atomic_read(&this_adm.copp. mode[port_idx][copp_idx]), audvol_cal_info->app_type, audvol_cal_info->acdb_id, atomic_read(&this_adm.copp. rate[port_idx][copp_idx])); if (ret2 < 0) { pr_debug("%s: remap and send failed for copp Id %d, acdb id %d, app type %d, path %d\n", __func__, rtac_adm_data.device[i].copp, audvol_cal_info->acdb_id, audvol_cal_info->app_type, audvol_cal_info->path); ret = ret2; } } } unlock: mutex_unlock(&this_adm.cal_data[ADM_RTAC_AUDVOL_CAL]->lock); return ret; } int adm_map_rtac_block(struct rtac_cal_block_data *cal_block) int adm_map_rtac_block(struct rtac_cal_block_data *cal_block) { { int result = 0; int result = 0; Loading Loading @@ -2643,6 +2728,9 @@ static int get_cal_type_index(int32_t cal_type) case ADM_RTAC_APR_CAL_TYPE: case ADM_RTAC_APR_CAL_TYPE: ret = ADM_RTAC_APR_CAL; ret = ADM_RTAC_APR_CAL; break; break; case ADM_RTAC_AUDVOL_CAL_TYPE: ret = ADM_RTAC_AUDVOL_CAL; break; default: default: pr_err("%s: invalid cal type %d!\n", __func__, cal_type); pr_err("%s: invalid cal type %d!\n", __func__, cal_type); } } Loading Loading @@ -2728,6 +2816,8 @@ static int adm_set_cal(int32_t cal_type, size_t data_size, void *data) mutex_lock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); mutex_lock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); this_adm.set_custom_topology = 1; this_adm.set_custom_topology = 1; mutex_unlock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); mutex_unlock(&this_adm.cal_data[ADM_CUSTOM_TOP_CAL]->lock); } else if (cal_index == ADM_RTAC_AUDVOL_CAL) { send_rtac_audvol_cal(); } } done: done: return ret; return ret; Loading Loading @@ -2838,7 +2928,13 @@ static int adm_init_cal_data(void) {{SRS_TRUMEDIA_CAL_TYPE, {{SRS_TRUMEDIA_CAL_TYPE, {NULL, NULL, NULL, NULL, NULL, NULL} }, {NULL, NULL, NULL, NULL, NULL, NULL} }, {NULL, NULL, cal_utils_match_buf_num} } {NULL, NULL, cal_utils_match_buf_num} }, {{ADM_RTAC_AUDVOL_CAL_TYPE, {adm_alloc_cal, adm_dealloc_cal, NULL, adm_set_cal, NULL, NULL} }, {adm_map_cal_data, adm_unmap_cal_data, cal_utils_match_buf_num} }, }; }; pr_debug("%s:\n", __func__); pr_debug("%s:\n", __func__); Loading