Merge "dsp: Reslove audiodlkm code warning"

This commit is contained in:
qctecmdr 2021-11-01 07:26:51 -07:00 committed by Gerrit - the friendly Code Review server
commit b0a827bef9
7 changed files with 84 additions and 18 deletions

View File

@ -622,7 +622,9 @@ void audio_cal_exit(void)
kfree(client_info_node);
client_info_node = NULL;
}
mutex_destroy(&audio_cal.cal_mutex[i]);
}
mutex_destroy(&audio_cal.common_lock);
misc_deregister(&audio_cal_misc);
}

View File

@ -4312,7 +4312,6 @@ EXPORT_SYMBOL(adm_close);
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;
@ -4358,7 +4357,7 @@ int send_rtac_audvol_cal(void)
continue;
}
ret2 = adm_remap_and_send_cal_block(ADM_RTAC_AUDVOL_CAL,
ret = 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.
@ -4367,13 +4366,12 @@ int send_rtac_audvol_cal(void)
audvol_cal_info->acdb_id,
atomic_read(&this_adm.copp.
rate[port_idx][copp_idx]));
if (ret2 < 0) {
if (ret < 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;
}
}
}
@ -5215,6 +5213,7 @@ int adm_wait_timeout(int port_id, int copp_idx, int wait_time)
pr_debug("%s: return %d\n", __func__, ret);
if (ret != 0)
ret = -EINTR;
end:
pr_debug("%s: return %d--\n", __func__, ret);
return ret;
@ -5275,8 +5274,10 @@ int adm_store_cal_data(int port_id, int copp_idx, int path, int perf_mode,
mutex_lock(&this_adm.cal_data[cal_index]->lock);
cal_block = adm_find_cal(cal_index, get_cal_path(path), app_type,
acdb_id, sample_rate);
if (cal_block == NULL)
if (cal_block == NULL) {
pr_err("%s: can't find cal block!\n", __func__);
goto unlock;
}
if (cal_block->cal_data.size <= 0) {
pr_debug("%s: No ADM cal send for port_id = 0x%x!\n",

View File

@ -3460,6 +3460,11 @@ int afe_send_port_vad_cfg_params(u16 port_id)
return 0;
}
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
}
port_index = afe_get_port_index(port_id);
if (this_afe.vad_cfg[port_index].is_enable) {
@ -4686,9 +4691,16 @@ EXPORT_SYMBOL(afe_tdm_port_start);
void afe_set_cal_mode(u16 port_id, enum afe_cal_mode afe_cal_mode)
{
uint16_t port_index;
int ret = 0;
port_index = afe_get_port_index(port_id);
this_afe.afe_cal_mode[port_index] = afe_cal_mode;
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
} else {
port_index = afe_get_port_index(port_id);
this_afe.afe_cal_mode[port_index] = afe_cal_mode;
}
}
EXPORT_SYMBOL(afe_set_cal_mode);
@ -4723,10 +4735,17 @@ EXPORT_SYMBOL(afe_set_vad_cfg);
void afe_get_island_mode_cfg(u16 port_id, u32 *enable_flag)
{
uint16_t port_index;
int ret = 0;
if (enable_flag) {
port_index = afe_get_port_index(port_id);
*enable_flag = this_afe.island_mode[port_index];
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
} else {
if (enable_flag) {
port_index = afe_get_port_index(port_id);
*enable_flag = this_afe.island_mode[port_index];
}
}
}
EXPORT_SYMBOL(afe_get_island_mode_cfg);
@ -4742,12 +4761,19 @@ EXPORT_SYMBOL(afe_get_island_mode_cfg);
void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag)
{
uint16_t port_index;
int ret = 0;
port_index = afe_get_port_index(port_id);
this_afe.island_mode[port_index] = enable_flag;
ret = afe_validate_port(port_id);
if (ret < 0) {
pr_err("%s: Not a valid port id = 0x%x ret %d\n", __func__,
port_id, ret);
} else {
port_index = afe_get_port_index(port_id);
this_afe.island_mode[port_index] = enable_flag;
trace_printk("%s: set island mode cfg 0x%x for port 0x%x\n",
__func__, this_afe.island_mode[port_index], port_id);
trace_printk("%s: set island mode cfg 0x%x for port 0x%x\n",
__func__, this_afe.island_mode[port_index], port_id);
}
}
EXPORT_SYMBOL(afe_set_island_mode_cfg);
@ -8031,6 +8057,8 @@ int afe_register_get_events(u16 port_id,
pr_debug("%s: port_id: 0x%x\n", __func__, port_id);
memset(&rtproxy, 0, sizeof(rtproxy));
if (this_afe.apr == NULL) {
this_afe.apr = apr_register("ADSP", "AFE", afe_callback,
0xFFFFFFFF, &this_afe);
@ -8094,6 +8122,8 @@ int afe_unregister_get_events(u16 port_id)
pr_debug("%s:\n", __func__);
memset(&rtproxy, 0, sizeof(rtproxy));
if (this_afe.apr == NULL) {
this_afe.apr = apr_register("ADSP", "AFE", afe_callback,
0xFFFFFFFF, &this_afe);
@ -8178,6 +8208,8 @@ int afe_rt_proxy_port_write(phys_addr_t buf_addr_p,
int ret = 0;
struct afe_port_data_cmd_rt_proxy_port_write_v2 afecmd_wr;
memset(&afecmd_wr, 0, sizeof(afecmd_wr));
if (this_afe.apr == NULL) {
pr_err("%s: register to AFE is not done\n", __func__);
ret = -ENODEV;
@ -8237,6 +8269,8 @@ int afe_rt_proxy_port_read(phys_addr_t buf_addr_p,
struct afe_port_data_cmd_rt_proxy_port_read_v2 afecmd_rd;
int port_id = VIRTUAL_ID_TO_PORTID(id);
memset(&afecmd_rd, 0, sizeof(afecmd_rd));
if (this_afe.apr == NULL) {
pr_err("%s: register to AFE is not done\n", __func__);
ret = -ENODEV;
@ -8477,6 +8511,8 @@ int afe_dtmf_generate_rx(int64_t duration_in_ms,
pr_debug("%s: DTMF AFE Gen\n", __func__);
memset(&cmd_dtmf, 0, sizeof(cmd_dtmf));
if (afe_validate_port(this_afe.dtmf_gen_rx_portid) < 0) {
pr_err("%s: Failed : Invalid Port id = 0x%x\n",
__func__, this_afe.dtmf_gen_rx_portid);
@ -9223,6 +9259,8 @@ int afe_port_stop_nowait(int port_id)
struct afe_port_cmd_device_stop stop;
int ret = 0;
memset(&stop, 0, sizeof(stop));
if (this_afe.apr == NULL) {
pr_err("%s: AFE is already closed\n", __func__);
ret = -EINVAL;
@ -9266,6 +9304,8 @@ int afe_close(int port_id)
int index = 0;
uint16_t port_index;
memset(&stop, 0, sizeof(stop));
if (this_afe.apr == NULL) {
pr_err("%s: AFE is already closed\n", __func__);

View File

@ -11691,5 +11691,13 @@ int __init q6asm_init(void)
void q6asm_exit(void)
{
int lcnt;
q6asm_delete_cal_data();
for (lcnt = 0; lcnt <= OUT; lcnt++)
mutex_destroy(&common_client.port[lcnt].lock);
mutex_destroy(&common_client.cmd_lock);
for (lcnt = 0; lcnt <= ASM_ACTIVE_STREAMS_ALLOWED; lcnt++)
mutex_destroy(&(session[lcnt].mutex_lock_per_session));
}

View File

@ -3100,8 +3100,12 @@ int __init q6lsm_init(void)
void q6lsm_exit(void)
{
int i = 0;
lsm_delete_cal_data();
for (; i <= LSM_MAX_SESSION_ID; i++)
mutex_destroy(&lsm_common.common_client[i].cmd_lock);
mutex_destroy(&lsm_common.apr_lock);
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(lsm_common.entry);
lsm_common.entry = NULL;

View File

@ -118,7 +118,7 @@ static int voice_send_cvp_ecns_enable_cmd(struct voice_data *v,
static int is_cal_memory_allocated(void);
static bool is_cvd_version_queried(void);
static int is_voip_memory_allocated(void);
static bool is_voip_memory_allocated(void);
static int voice_get_cvd_int_version(char *cvd_ver_string);
static int voice_alloc_cal_mem_map_table(void);
static int voice_alloc_rtac_mem_map_table(void);
@ -134,7 +134,7 @@ static int remap_cal_data(struct cal_block_data *cal_block,
static int voice_unmap_cal_memory(int32_t cal_type,
struct cal_block_data *cal_block);
static int is_source_tracking_shared_memomry_allocated(void);
static bool is_source_tracking_shared_memomry_allocated(void);
static int voice_alloc_source_tracking_shared_memory(void);
static int voice_alloc_and_map_source_tracking_shared_memory(
struct voice_data *v);
@ -2222,7 +2222,7 @@ done:
}
static int is_voip_memory_allocated(void)
static bool is_voip_memory_allocated(void)
{
bool ret;
struct voice_data *v = voice_get_session(
@ -9693,7 +9693,7 @@ int voc_get_sound_focus(struct sound_focus_param *soundFocusData)
}
EXPORT_SYMBOL(voc_get_sound_focus);
static int is_source_tracking_shared_memomry_allocated(void)
static bool is_source_tracking_shared_memomry_allocated(void)
{
bool ret;
@ -10351,7 +10351,11 @@ int __init voice_init(void)
void voice_exit(void)
{
int i;
q6core_destroy_uevent_data(common.uevent_data);
voice_delete_cal_data();
free_cal_map_table();
mutex_destroy(&common.common_lock);
for (i = 0; i < MAX_VOC_SESSIONS; i++)
mutex_destroy(&common.voice[i].lock);
}

View File

@ -2068,6 +2068,13 @@ void rtac_exit(void)
kzfree(rtac_asm_buffer);
kzfree(rtac_afe_buffer);
kzfree(rtac_voice_buffer);
mutex_destroy(&rtac_voice_apr_mutex);
mutex_destroy(&rtac_voice_mutex);
mutex_destroy(&rtac_afe_apr_mutex);
mutex_destroy(&rtac_asm_apr_mutex);
mutex_destroy(&rtac_adm_apr_mutex);
mutex_destroy(&rtac_adm_mutex);
mutex_destroy(&rtac_common.rtac_fops_mutex);
}
MODULE_DESCRIPTION("SoC QDSP6v2 Real-Time Audio Calibration driver");