codecs: Enable clock voting logs to debug AHB/NOC issues

Enable clock voting logs to debug stability issues.

Change-Id: Ie1f995ab004778a81ea42baad15ea36858407e9a
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
This commit is contained in:
Aditya Bavanari
2019-09-16 18:27:51 -07:00
committato da Gerrit - the friendly Code Review server
parent d155d7f509
commit 236ff485d2
12 ha cambiato i file con 180 aggiunte e 20 eliminazioni

Vedi File

@@ -1084,6 +1084,8 @@ static int afe_apr_send_pkt(void *data, wait_queue_head_t *wait)
pr_err_ratelimited("%s: request timedout\n",
__func__);
ret = -ETIMEDOUT;
trace_printk("%s: wait for ADSP response timed out\n",
__func__);
} else if (atomic_read(&this_afe.status) > 0) {
pr_err("%s: DSP returned error[%s]\n", __func__,
adsp_err_get_err_str(atomic_read(
@@ -2235,7 +2237,7 @@ static int afe_send_hw_delay(u16 port_id, u32 rate)
__func__, port_id, ret);
fail_cmd:
pr_debug("%s: port_id 0x%x rate %u delay_usec %d status %d\n",
pr_info("%s: port_id 0x%x rate %u delay_usec %d status %d\n",
__func__, port_id, rate, delay_entry.delay_usec, ret);
return ret;
}
@@ -2259,6 +2261,8 @@ static struct cal_block_data *afe_find_cal_topo_id_by_port(
/* Skip cal_block if it is already marked stale */
if (cal_utils_is_cal_stale(cal_block))
continue;
pr_info("%s: port id: 0x%x, dev_acdb_id: %d\n", __func__,
port_id, this_afe.dev_acdb_id[afe_port_index]);
path = ((afe_get_port_type(port_id) ==
MSM_AFE_PORT_TYPE_TX)?(TX_DEVICE):(RX_DEVICE));
afe_top =
@@ -2267,14 +2271,14 @@ static struct cal_block_data *afe_find_cal_topo_id_by_port(
if (this_afe.dev_acdb_id[afe_port_index] > 0) {
if (afe_top->acdb_id ==
this_afe.dev_acdb_id[afe_port_index]) {
pr_debug("%s: top_id:%x acdb_id:%d afe_port_id:%d\n",
pr_info("%s: top_id:%x acdb_id:%d afe_port_id:0x%x\n",
__func__, afe_top->topology,
afe_top->acdb_id,
q6audio_get_port_id(port_id));
return cal_block;
}
} else {
pr_debug("%s: top_id:%x acdb_id:%d afe_port:%d\n",
pr_info("%s: top_id:%x acdb_id:%d afe_port:0x%x\n",
__func__, afe_top->topology, afe_top->acdb_id,
q6audio_get_port_id(port_id));
return cal_block;
@@ -2331,9 +2335,9 @@ static int afe_get_cal_topology_id(u16 port_id, u32 *topology_id,
*topology_id = (u32)afe_top_info->topology;
cal_utils_mark_cal_used(cal_block);
pr_debug("%s: port_id = %u acdb_id = %d topology_id = %u ret=%d\n",
pr_info("%s: port_id = 0x%x acdb_id = %d topology_id = 0x%x cal_type_index=%d ret=%d\n",
__func__, port_id, afe_top_info->acdb_id,
afe_top_info->topology, ret);
afe_top_info->topology, cal_type_index, ret);
unlock:
mutex_unlock(&this_afe.cal_data[cal_type_index]->lock);
return ret;
@@ -2388,7 +2392,7 @@ static int afe_send_port_topology_id(u16 port_id)
this_afe.topology[index] = topology_id;
rtac_update_afe_topology(port_id);
done:
pr_debug("%s: AFE set topology id 0x%x enable for port 0x%x ret %d\n",
pr_info("%s: AFE set topology id 0x%x enable for port 0x%x ret %d\n",
__func__, topology_id, port_id, ret);
return ret;
@@ -2461,6 +2465,8 @@ int afe_send_port_island_mode(u16 port_id)
}
pr_debug("%s: AFE set island mode 0x%x enable for port 0x%x ret %d\n",
__func__, island_mode, port_id, ret);
trace_printk("%s: AFE set island mode 0x%x enable for port 0x%x ret %d\n",
__func__, island_mode, port_id, ret);
return ret;
}
EXPORT_SYMBOL(afe_send_port_island_mode);
@@ -2623,7 +2629,7 @@ static struct cal_block_data *afe_find_cal(int cal_index, int port_id)
struct audio_cal_info_afe *afe_cal_info = NULL;
int afe_port_index = q6audio_get_port_index(port_id);
pr_debug("%s: cal_index %d port_id %d port_index %d\n", __func__,
pr_info("%s: cal_index %d port_id 0x%x port_index %d\n", __func__,
cal_index, port_id, afe_port_index);
if (afe_port_index < 0) {
pr_err("%s: Error getting AFE port index %d\n",
@@ -2635,16 +2641,21 @@ static struct cal_block_data *afe_find_cal(int cal_index, int port_id)
&this_afe.cal_data[cal_index]->cal_blocks) {
cal_block = list_entry(ptr, struct cal_block_data, list);
afe_cal_info = cal_block->cal_info;
pr_info("%s: acdb_id %d dev_acdb_id %d sample_rate %d afe_sample_rates %d\n",
__func__, afe_cal_info->acdb_id,
this_afe.dev_acdb_id[afe_port_index],
afe_cal_info->sample_rate,
this_afe.afe_sample_rates[afe_port_index]);
if ((afe_cal_info->acdb_id ==
this_afe.dev_acdb_id[afe_port_index]) &&
(afe_cal_info->sample_rate ==
this_afe.afe_sample_rates[afe_port_index])) {
pr_debug("%s: cal block is a match, size is %zd\n",
pr_info("%s: cal block is a match, size is %zd\n",
__func__, cal_block->cal_data.size);
goto exit;
}
}
pr_debug("%s: no matching cal_block found\n", __func__);
pr_info("%s: no matching cal_block found\n", __func__);
cal_block = NULL;
exit:
@@ -2657,7 +2668,7 @@ static int send_afe_cal_type(int cal_index, int port_id)
int ret;
int afe_port_index = q6audio_get_port_index(port_id);
pr_debug("%s:\n", __func__);
pr_info("%s: cal_index is %d\n", __func__, cal_index);
if (this_afe.cal_data[cal_index] == NULL) {
pr_warn("%s: cal_index %d not allocated!\n",
@@ -2674,7 +2685,9 @@ static int send_afe_cal_type(int cal_index, int port_id)
}
mutex_lock(&this_afe.cal_data[cal_index]->lock);
pr_info("%s: dev_acdb_id[%d] is %d\n",
__func__, afe_port_index,
this_afe.dev_acdb_id[afe_port_index]);
if (((cal_index == AFE_COMMON_RX_CAL) ||
(cal_index == AFE_COMMON_TX_CAL) ||
(cal_index == AFE_LSM_TX_CAL)) &&
@@ -2690,7 +2703,7 @@ static int send_afe_cal_type(int cal_index, int port_id)
goto unlock;
}
pr_debug("%s: Sending cal_index cal %d\n", __func__, cal_index);
pr_info("%s: Sending cal_index cal %d\n", __func__, cal_index);
ret = remap_cal_data(cal_block, cal_index);
if (ret) {
@@ -2701,7 +2714,7 @@ static int send_afe_cal_type(int cal_index, int port_id)
}
ret = afe_send_cal_block(port_id, cal_block);
if (ret < 0)
pr_debug("%s: No cal sent for cal_index %d, port_id = 0x%x! ret %d\n",
pr_err("%s: No cal sent for cal_index %d, port_id = 0x%x! ret %d\n",
__func__, cal_index, port_id, ret);
cal_utils_mark_cal_used(cal_block);
@@ -3776,6 +3789,8 @@ void afe_set_island_mode_cfg(u16 port_id, u32 enable_flag)
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);
}
EXPORT_SYMBOL(afe_set_island_mode_cfg);
@@ -4584,7 +4599,7 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
port_id = VIRTUAL_ID_TO_PORTID(port_id);
}
pr_debug("%s: port id: 0x%x\n", __func__, port_id);
pr_info("%s: port id: 0x%x\n", __func__, port_id);
index = q6audio_get_port_index(port_id);
if (index < 0 || index >= AFE_MAX_PORTS) {
@@ -7605,7 +7620,7 @@ int afe_close(int port_id)
ret = -EINVAL;
goto fail_cmd;
}
pr_debug("%s: port_id = 0x%x\n", __func__, port_id);
pr_info("%s: port_id = 0x%x\n", __func__, port_id);
if ((port_id == RT_PROXY_DAI_001_RX) ||
(port_id == RT_PROXY_DAI_002_TX)) {
pr_debug("%s: before decrementing pcm_afe_instance %d\n",
@@ -7792,6 +7807,15 @@ int afe_set_lpass_clock(u16 port_id, struct afe_clk_cfg *cfg)
cfg->clk_root, cfg->clk_set_mode,
cfg->reserved, q6audio_get_port_id(port_id));
trace_printk("%s: Minor version =0x%x clk val1 = %d\n"
"clk val2 = %d, clk src = 0x%x\n"
"clk root = 0x%x clk mode = 0x%x resrv = 0x%x\n"
"port id = 0x%x\n",
__func__, cfg->i2s_cfg_minor_version,
cfg->clk_val1, cfg->clk_val2, cfg->clk_src,
cfg->clk_root, cfg->clk_set_mode,
cfg->reserved, q6audio_get_port_id(port_id));
ret = q6afe_pack_and_set_param_in_band(port_id,
q6audio_get_port_index(port_id),
param_hdr, (u8 *) &clk_cfg);
@@ -7844,12 +7868,21 @@ int afe_set_lpass_clk_cfg(int index, struct afe_clk_set *cfg)
cfg->clk_id, cfg->clk_freq_in_hz, cfg->clk_attri,
cfg->clk_root, cfg->enable);
trace_printk("%s: Minor version =0x%x clk id = %d\n"
"clk freq (Hz) = %d, clk attri = 0x%x\n"
"clk root = 0x%x clk enable = 0x%x\n",
__func__, cfg->clk_set_minor_version,
cfg->clk_id, cfg->clk_freq_in_hz, cfg->clk_attri,
cfg->clk_root, cfg->enable);
ret = q6afe_svc_pack_and_set_param_in_band(index, param_hdr,
(u8 *) cfg);
if (ret < 0)
if (ret < 0) {
pr_err_ratelimited("%s: AFE clk cfg failed with ret %d\n",
__func__, ret);
trace_printk("%s: AFE clk cfg failed with ret %d\n",
__func__, ret);
}
mutex_unlock(&this_afe.afe_clk_lock);
return ret;
}
@@ -9357,6 +9390,8 @@ int afe_vote_lpass_core_hw(uint32_t hw_block_id, char *client_name,
pr_debug("%s: lpass core hw vote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
trace_printk("%s: lpass core hw vote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
*client_handle = 0;
ret = afe_apr_send_clk_pkt((uint32_t *)cmd_ptr,
@@ -9396,6 +9431,7 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
if (!this_afe.lpass_hw_core_client_hdl[hw_block_id]) {
pr_debug("%s: SSR in progress, return\n", __func__);
trace_printk("%s: SSR in progress, return\n", __func__);
goto done;
}
@@ -9415,6 +9451,9 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
pr_debug("%s: lpass core hw unvote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
trace_printk("%s: lpass core hw unvote opcode[0x%x] hw id[0x%x]\n",
__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);
if (cmd_ptr->client_handle <= 0) {
pr_err("%s: invalid client handle\n", __func__);
ret = -EINVAL;