Lines Matching defs:copp

130 	struct q6copp *copp;
144 dev_err(&adev->dev, "Invalid copp idx %d token %d\n",
158 copp = q6adm_find_copp(adm, port_idx, copp_idx);
159 if (!copp)
162 copp->result = *result;
163 wake_up(&copp->wait);
164 kref_put(&copp->refcount, q6adm_free_copp);
185 copp = q6adm_find_copp(adm, port_idx, copp_idx);
186 if (!copp)
192 copp->result.status = ADSP_EBADPARAM;
193 wake_up(&copp->wait);
194 kref_put(&copp->refcount, q6adm_free_copp);
197 copp->result.opcode = hdr->opcode;
198 copp->id = open->copp_id;
199 wake_up(&copp->wait);
200 kref_put(&copp->refcount, q6adm_free_copp);
237 static int q6adm_apr_send_copp_pkt(struct q6adm *adm, struct q6copp *copp,
245 copp->result.opcode = 0;
246 copp->result.status = 0;
254 /* Wait for the callback with copp id */
256 ret = wait_event_timeout(copp->wait,
257 (copp->result.opcode == opcode) ||
258 (copp->result.opcode == rsp_opcode),
261 ret = wait_event_timeout(copp->wait,
262 (copp->result.opcode == opcode),
266 dev_err(dev, "ADM copp cmd timedout\n");
268 } else if (copp->result.status > 0) {
270 copp->result.status);
279 static int q6adm_device_close(struct q6adm *adm, struct q6copp *copp,
289 close.hdr.dest_port = copp->id;
293 return q6adm_apr_send_copp_pkt(adm, copp, &close, 0);
321 static int q6adm_device_open(struct q6adm *adm, struct q6copp *copp,
344 pkt->hdr.token = port_id << 16 | copp->copp_idx;
359 ret = q6adm_apr_send_copp_pkt(adm, copp, pkt,
368 * q6adm_open() - open adm and grab a free copp
373 * @rate: rate at which copp is required.
381 * Return: Will be an negative on error or a valid copp pointer on success.
388 struct q6copp *copp;
397 copp = q6adm_find_matching_copp(adm, port_id, topology, perf_mode,
399 if (copp) {
400 dev_err(dev, "Found Matching Copp 0x%x\n", copp->copp_idx);
401 return copp;
405 copp = q6adm_alloc_copp(adm, port_id);
406 if (IS_ERR(copp)) {
408 return ERR_CAST(copp);
411 list_add_tail(&copp->node, &adm->copps_list);
414 kref_init(&copp->refcount);
415 copp->topology = topology;
416 copp->mode = perf_mode;
417 copp->rate = rate;
418 copp->channels = channel_mode;
419 copp->bit_width = bit_width;
420 copp->app_type = app_type;
422 ret = q6adm_device_open(adm, copp, port_id, path, topology,
425 kref_put(&copp->refcount, q6adm_free_copp);
429 return copp;
434 * q6adm_get_copp_id() - get copp index
436 * @copp: Pointer to valid copp
438 * Return: Will be an negative on error or a valid copp index on success.
440 int q6adm_get_copp_id(struct q6copp *copp)
442 if (!copp)
445 return copp->copp_idx;
469 struct q6copp *copp;
518 copp = q6adm_find_copp(adm, port_idx, copp_idx);
519 if (!copp) {
524 copps_list[i] = copp->id;
525 kref_put(&copp->refcount, q6adm_free_copp);
561 * q6adm_close() - Close adm copp
564 * @copp: pointer to previously opened copp
568 int q6adm_close(struct device *dev, struct q6copp *copp)
573 ret = q6adm_device_close(adm, copp, copp->afe_port, copp->copp_idx);
575 dev_err(adm->dev, "Failed to close copp %d\n", ret);
579 kref_put(&copp->refcount, q6adm_free_copp);