Merge "dsp: q6afe: Update lpass hw votes to maintain separate handles"

This commit is contained in:
qctecmdr
2019-11-12 03:12:55 -08:00
committed by Gerrit - the friendly Code Review server
2 changed files with 22 additions and 12 deletions

View File

@@ -110,7 +110,7 @@ struct afe_ctl {
wait_queue_head_t wait_wakeup; wait_queue_head_t wait_wakeup;
struct task_struct *task; struct task_struct *task;
wait_queue_head_t lpass_core_hw_wait; wait_queue_head_t lpass_core_hw_wait;
uint32_t lpass_hw_core_client_hdl; uint32_t lpass_hw_core_client_hdl[AFE_LPASS_CORE_HW_VOTE_MAX];
void (*tx_cb)(uint32_t opcode, void (*tx_cb)(uint32_t opcode,
uint32_t token, uint32_t *payload, void *priv); uint32_t token, uint32_t *payload, void *priv);
void (*rx_cb)(uint32_t opcode, void (*rx_cb)(uint32_t opcode,
@@ -571,6 +571,8 @@ static bool afe_token_is_valid(uint32_t token)
static int32_t afe_callback(struct apr_client_data *data, void *priv) static int32_t afe_callback(struct apr_client_data *data, void *priv)
{ {
uint16_t i = 0;
if (!data) { if (!data) {
pr_err("%s: Invalid param data\n", __func__); pr_err("%s: Invalid param data\n", __func__);
return -EINVAL; return -EINVAL;
@@ -598,7 +600,8 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv)
/* Reset the core client handle in SSR/PDR use cases */ /* Reset the core client handle in SSR/PDR use cases */
mutex_lock(&this_afe.afe_cmd_lock); mutex_lock(&this_afe.afe_cmd_lock);
this_afe.lpass_hw_core_client_hdl = 0; for (i = 0; i < AFE_LPASS_CORE_HW_VOTE_MAX; i++)
this_afe.lpass_hw_core_client_hdl[i] = 0;
mutex_unlock(&this_afe.afe_cmd_lock); mutex_unlock(&this_afe.afe_cmd_lock);
/* /*
@@ -673,7 +676,9 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv)
pr_debug("%s: AFE_CMD_RSP_REMOTE_LPASS_CORE_HW_VOTE_REQUEST handle %d\n", pr_debug("%s: AFE_CMD_RSP_REMOTE_LPASS_CORE_HW_VOTE_REQUEST handle %d\n",
__func__, payload[0]); __func__, payload[0]);
this_afe.lpass_hw_core_client_hdl = payload[0]; if (data->token < AFE_LPASS_CORE_HW_VOTE_MAX)
this_afe.lpass_hw_core_client_hdl[data->token] =
payload[0];
atomic_set(&this_afe.state, 0); atomic_set(&this_afe.state, 0);
atomic_set(&this_afe.status, 0); atomic_set(&this_afe.status, 0);
wake_up(&this_afe.lpass_core_hw_wait); wake_up(&this_afe.lpass_core_hw_wait);
@@ -9086,7 +9091,8 @@ int __init afe_init(void)
this_afe.mmap_handle = 0; this_afe.mmap_handle = 0;
this_afe.vi_tx_port = -1; this_afe.vi_tx_port = -1;
this_afe.vi_rx_port = -1; this_afe.vi_rx_port = -1;
this_afe.lpass_hw_core_client_hdl = 0; for (i = 0; i < AFE_LPASS_CORE_HW_VOTE_MAX; i++)
this_afe.lpass_hw_core_client_hdl[i] = 0;
this_afe.prot_cfg.mode = MSM_SPKR_PROT_DISABLED; this_afe.prot_cfg.mode = MSM_SPKR_PROT_DISABLED;
this_afe.th_ftm_cfg.mode = MSM_SPKR_PROT_DISABLED; this_afe.th_ftm_cfg.mode = MSM_SPKR_PROT_DISABLED;
this_afe.ex_ftm_cfg.mode = MSM_SPKR_PROT_DISABLED; this_afe.ex_ftm_cfg.mode = MSM_SPKR_PROT_DISABLED;
@@ -9218,7 +9224,7 @@ int afe_vote_lpass_core_hw(uint32_t hw_block_id, char *client_name,
cmd_ptr->hdr.pkt_size = sizeof(hw_vote_cfg); cmd_ptr->hdr.pkt_size = sizeof(hw_vote_cfg);
cmd_ptr->hdr.src_port = 0; cmd_ptr->hdr.src_port = 0;
cmd_ptr->hdr.dest_port = 0; cmd_ptr->hdr.dest_port = 0;
cmd_ptr->hdr.token = 0; cmd_ptr->hdr.token = hw_block_id;
cmd_ptr->hdr.opcode = AFE_CMD_REMOTE_LPASS_CORE_HW_VOTE_REQUEST; cmd_ptr->hdr.opcode = AFE_CMD_REMOTE_LPASS_CORE_HW_VOTE_REQUEST;
cmd_ptr->hw_block_id = hw_block_id; cmd_ptr->hw_block_id = hw_block_id;
strlcpy(cmd_ptr->client_name, client_name, strlcpy(cmd_ptr->client_name, client_name,
@@ -9259,9 +9265,9 @@ int afe_vote_lpass_core_hw(uint32_t hw_block_id, char *client_name,
goto done; goto done;
} }
*client_handle = this_afe.lpass_hw_core_client_hdl; *client_handle = this_afe.lpass_hw_core_client_hdl[hw_block_id];
pr_debug("%s: lpass_hw_core_client_hdl %d\n", __func__, pr_debug("%s: lpass_hw_core_client_hdl %d\n", __func__,
this_afe.lpass_hw_core_client_hdl); this_afe.lpass_hw_core_client_hdl[hw_block_id]);
done: done:
mutex_unlock(&this_afe.afe_cmd_lock); mutex_unlock(&this_afe.afe_cmd_lock);
return ret; return ret;
@@ -9291,7 +9297,7 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
mutex_lock(&this_afe.afe_cmd_lock); mutex_lock(&this_afe.afe_cmd_lock);
if (!this_afe.lpass_hw_core_client_hdl) { if (!this_afe.lpass_hw_core_client_hdl[hw_block_id]) {
pr_debug("%s: SSR in progress, return\n", __func__); pr_debug("%s: SSR in progress, return\n", __func__);
goto done; goto done;
} }

View File

@@ -483,10 +483,14 @@ void afe_register_wakeup_irq_callback(
int afe_get_doa_tracking_mon(u16 port_id, int afe_get_doa_tracking_mon(u16 port_id,
struct doa_tracking_mon_param *doa_tracking_data); struct doa_tracking_mon_param *doa_tracking_data);
#define AFE_LPASS_CORE_HW_BLOCK_ID_NONE 0 enum {
#define AFE_LPASS_CORE_HW_BLOCK_ID_AVTIMER 2 AFE_LPASS_CORE_HW_BLOCK_ID_NONE,
#define AFE_LPASS_CORE_HW_MACRO_BLOCK 3 AFE_LPASS_CORE_HW_RSVD,
#define AFE_LPASS_CORE_HW_DCODEC_BLOCK 4 AFE_LPASS_CORE_HW_BLOCK_ID_AVTIMER,
AFE_LPASS_CORE_HW_MACRO_BLOCK,
AFE_LPASS_CORE_HW_DCODEC_BLOCK,
AFE_LPASS_CORE_HW_VOTE_MAX
};
/* Handles audio-video timer (avtimer) and BTSC vote requests from clients. /* Handles audio-video timer (avtimer) and BTSC vote requests from clients.
*/ */