forked from Minki/linux
ASoC: q6dsp: q6afe: prepare afe_apr_send_pkt to take response opcode
Update afe_apr_send_pkt() to take response opcode that it should wait for. This is helpful in cases where we expect response other than the actual command opcode. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20200910101732.23484-4-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
825492cb51
commit
342a4f8ca1
@ -902,10 +902,9 @@ int q6afe_get_port_id(int index)
|
|||||||
EXPORT_SYMBOL_GPL(q6afe_get_port_id);
|
EXPORT_SYMBOL_GPL(q6afe_get_port_id);
|
||||||
|
|
||||||
static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt,
|
static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt,
|
||||||
struct q6afe_port *port)
|
struct q6afe_port *port, uint32_t rsp_opcode)
|
||||||
{
|
{
|
||||||
wait_queue_head_t *wait = &port->wait;
|
wait_queue_head_t *wait = &port->wait;
|
||||||
struct apr_hdr *hdr = &pkt->hdr;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mutex_lock(&afe->lock);
|
mutex_lock(&afe->lock);
|
||||||
@ -919,7 +918,7 @@ static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = wait_event_timeout(*wait, (port->result.opcode == hdr->opcode),
|
ret = wait_event_timeout(*wait, (port->result.opcode == rsp_opcode),
|
||||||
msecs_to_jiffies(TIMEOUT_MS));
|
msecs_to_jiffies(TIMEOUT_MS));
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = -ETIMEDOUT;
|
ret = -ETIMEDOUT;
|
||||||
@ -976,7 +975,7 @@ static int q6afe_port_set_param(struct q6afe_port *port, void *data,
|
|||||||
pdata->param_id = param_id;
|
pdata->param_id = param_id;
|
||||||
pdata->param_size = psize;
|
pdata->param_size = psize;
|
||||||
|
|
||||||
ret = afe_apr_send_pkt(afe, pkt, port);
|
ret = afe_apr_send_pkt(afe, pkt, port, AFE_SVC_CMD_SET_PARAM);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(afe->dev, "AFE enable for port 0x%x failed %d\n",
|
dev_err(afe->dev, "AFE enable for port 0x%x failed %d\n",
|
||||||
port_id, ret);
|
port_id, ret);
|
||||||
@ -1025,7 +1024,7 @@ static int q6afe_port_set_param_v2(struct q6afe_port *port, void *data,
|
|||||||
pdata->param_id = param_id;
|
pdata->param_id = param_id;
|
||||||
pdata->param_size = psize;
|
pdata->param_size = psize;
|
||||||
|
|
||||||
ret = afe_apr_send_pkt(afe, pkt, port);
|
ret = afe_apr_send_pkt(afe, pkt, port, AFE_PORT_CMD_SET_PARAM_V2);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(afe->dev, "AFE enable for port 0x%x failed %d\n",
|
dev_err(afe->dev, "AFE enable for port 0x%x failed %d\n",
|
||||||
port_id, ret);
|
port_id, ret);
|
||||||
@ -1155,7 +1154,7 @@ int q6afe_port_stop(struct q6afe_port *port)
|
|||||||
stop->port_id = port_id;
|
stop->port_id = port_id;
|
||||||
stop->reserved = 0;
|
stop->reserved = 0;
|
||||||
|
|
||||||
ret = afe_apr_send_pkt(afe, pkt, port);
|
ret = afe_apr_send_pkt(afe, pkt, port, AFE_PORT_CMD_DEVICE_STOP);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(afe->dev, "AFE close failed %d\n", ret);
|
dev_err(afe->dev, "AFE close failed %d\n", ret);
|
||||||
|
|
||||||
@ -1467,7 +1466,7 @@ int q6afe_port_start(struct q6afe_port *port)
|
|||||||
|
|
||||||
start->port_id = port_id;
|
start->port_id = port_id;
|
||||||
|
|
||||||
ret = afe_apr_send_pkt(afe, pkt, port);
|
ret = afe_apr_send_pkt(afe, pkt, port, AFE_PORT_CMD_DEVICE_START);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(afe->dev, "AFE enable for port 0x%x failed %d\n",
|
dev_err(afe->dev, "AFE enable for port 0x%x failed %d\n",
|
||||||
port_id, ret);
|
port_id, ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user