mutex_lock(&adm->lock);
copp->result.opcode = 0;
copp->result.status = 0;
ret = apr_send_pkt(adm->apr, pkt); if (ret < 0) {
dev_err(dev, "Failed to send APR packet\n");
ret = -EINVAL; goto err;
}
/* Wait for the callback with copp id */ if (rsp_opcode)
ret = wait_event_timeout(copp->wait,
(copp->result.opcode == opcode) ||
(copp->result.opcode == rsp_opcode),
msecs_to_jiffies(TIMEOUT_MS)); else
ret = wait_event_timeout(copp->wait,
(copp->result.opcode == opcode),
msecs_to_jiffies(TIMEOUT_MS));
if (!ret) {
dev_err(dev, "ADM copp cmd timedout\n");
ret = -ETIMEDOUT;
} elseif (copp->result.status > 0) {
dev_err(dev, "DSP returned error[%d]\n",
copp->result.status);
ret = -EINVAL;
}
err:
mutex_unlock(&adm->lock); return ret;
}
staticint q6adm_device_close(struct q6adm *adm, struct q6copp *copp, int port_id, int copp_idx)
{ struct apr_pkt close;
staticstruct q6copp *q6adm_find_matching_copp(struct q6adm *adm, int port_id, int topology, int mode, int rate, int channel_mode, int bit_width, int app_type)
{ struct q6copp *c; struct q6copp *ret = NULL; unsignedlong flags;
staticint q6adm_device_open(struct q6adm *adm, struct q6copp *copp, int port_id, int path, int topology, int channel_mode, int bit_width, int rate)
{ struct q6adm_cmd_device_open_v5 *open; int afe_port = q6afe_get_port_id(port_id); struct apr_pkt *pkt; void *p; int ret, pkt_size;
pkt_size = APR_HDR_SIZE + sizeof(*open);
p = kzalloc(pkt_size, GFP_KERNEL); if (!p) return -ENOMEM;
ret = q6dsp_map_channels(&open->dev_channel_mapping[0],
channel_mode); if (ret) goto err;
ret = q6adm_apr_send_copp_pkt(adm, copp, pkt,
ADM_CMDRSP_DEVICE_OPEN_V5);
err:
kfree(pkt); return ret;
}
/** * q6adm_open() - open adm and grab a free copp * * @dev: Pointer to adm child device. * @port_id: port id * @path: playback or capture path. * @rate: rate at which copp is required. * @channel_mode: channel mode * @topology: adm topology id * @perf_mode: performace mode. * @bit_width: audio sample bit width * @app_type: Application type. * @acdb_id: ACDB id * * Return: Will be an negative on error or a valid copp pointer on success.
*/ struct q6copp *q6adm_open(struct device *dev, int port_id, int path, int rate, int channel_mode, int topology, int perf_mode,
uint16_t bit_width, int app_type, int acdb_id)
{ struct q6adm *adm = dev_get_drvdata(dev->parent); struct q6copp *copp; unsignedlong flags; int ret = 0;
ret = q6adm_device_open(adm, copp, port_id, path, topology,
channel_mode, bit_width, rate); if (ret < 0) {
kref_put(&copp->refcount, q6adm_free_copp); return ERR_PTR(ret);
}
return copp;
}
EXPORT_SYMBOL_GPL(q6adm_open);
/** * q6adm_get_copp_id() - get copp index * * @copp: Pointer to valid copp * * Return: Will be an negative on error or a valid copp index on success.
**/ int q6adm_get_copp_id(struct q6copp *copp)
{ if (!copp) return -EINVAL;
/** * q6adm_matrix_map() - Map asm streams and afe ports using payload * * @dev: Pointer to adm child device. * @path: playback or capture path. * @payload_map: map between session id and afe ports. * @perf_mode: Performace mode. * * Return: Will be an negative on error or a zero on success.
*/ int q6adm_matrix_map(struct device *dev, int path, struct route_payload payload_map, int perf_mode)
{ struct q6adm *adm = dev_get_drvdata(dev->parent); struct q6adm_cmd_matrix_map_routings_v5 *route; struct q6adm_session_map_node_v5 *node; struct apr_pkt *pkt;
uint16_t *copps_list; int pkt_size, ret, i, copp_idx; void *matrix_map; struct q6copp *copp;
/* Assumes port_ids have already been validated during adm_open */
pkt_size = (APR_HDR_SIZE + sizeof(*route) + sizeof(*node) +
(sizeof(uint32_t) * payload_map.num_copps));
matrix_map = kzalloc(pkt_size, GFP_KERNEL); if (!matrix_map) return -ENOMEM;
/** * q6adm_close() - Close adm copp * * @dev: Pointer to adm child device. * @copp: pointer to previously opened copp * * Return: Will be an negative on error or a zero on success.
*/ int q6adm_close(struct device *dev, struct q6copp *copp)
{ struct q6adm *adm = dev_get_drvdata(dev->parent); int ret = 0;
ret = q6adm_device_close(adm, copp, copp->afe_port, copp->copp_idx); if (ret < 0) {
dev_err(adm->dev, "Failed to close copp %d\n", ret); return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.