Lines Matching refs:adm
53 struct q6adm *adm; member
90 static struct q6copp *q6adm_find_copp(struct q6adm *adm, int port_idx, in q6adm_find_copp() argument
97 spin_lock_irqsave(&adm->copps_list_lock, flags); in q6adm_find_copp()
98 list_for_each_entry(c, &adm->copps_list, node) { in q6adm_find_copp()
106 spin_unlock_irqrestore(&adm->copps_list_lock, flags); in q6adm_find_copp()
115 struct q6adm *adm = c->adm; in q6adm_free_copp() local
118 spin_lock_irqsave(&adm->copps_list_lock, flags); in q6adm_free_copp()
119 clear_bit(c->copp_idx, &adm->copp_bitmap[c->afe_port]); in q6adm_free_copp()
121 spin_unlock_irqrestore(&adm->copps_list_lock, flags); in q6adm_free_copp()
131 struct q6adm *adm = dev_get_drvdata(&adev->dev); in q6adm_callback() local
158 copp = q6adm_find_copp(adm, port_idx, copp_idx); in q6adm_callback()
167 adm->result = *result; in q6adm_callback()
168 wake_up(&adm->matrix_map_wait); in q6adm_callback()
185 copp = q6adm_find_copp(adm, port_idx, copp_idx); in q6adm_callback()
212 static struct q6copp *q6adm_alloc_copp(struct q6adm *adm, int port_idx) in q6adm_alloc_copp() argument
217 idx = find_first_zero_bit(&adm->copp_bitmap[port_idx], in q6adm_alloc_copp()
227 set_bit(idx, &adm->copp_bitmap[port_idx]); in q6adm_alloc_copp()
230 c->adm = adm; in q6adm_alloc_copp()
237 static int q6adm_apr_send_copp_pkt(struct q6adm *adm, struct q6copp *copp, in q6adm_apr_send_copp_pkt() argument
240 struct device *dev = adm->dev; in q6adm_apr_send_copp_pkt()
244 mutex_lock(&adm->lock); in q6adm_apr_send_copp_pkt()
247 ret = apr_send_pkt(adm->apr, pkt); in q6adm_apr_send_copp_pkt()
275 mutex_unlock(&adm->lock); in q6adm_apr_send_copp_pkt()
279 static int q6adm_device_close(struct q6adm *adm, struct q6copp *copp, in q6adm_device_close() argument
293 return q6adm_apr_send_copp_pkt(adm, copp, &close, 0); in q6adm_device_close()
296 static struct q6copp *q6adm_find_matching_copp(struct q6adm *adm, in q6adm_find_matching_copp() argument
306 spin_lock_irqsave(&adm->copps_list_lock, flags); in q6adm_find_matching_copp()
308 list_for_each_entry(c, &adm->copps_list, node) { in q6adm_find_matching_copp()
316 spin_unlock_irqrestore(&adm->copps_list_lock, flags); in q6adm_find_matching_copp()
321 static int q6adm_device_open(struct q6adm *adm, struct q6copp *copp, in q6adm_device_open() argument
359 ret = q6adm_apr_send_copp_pkt(adm, copp, pkt, in q6adm_device_open()
387 struct q6adm *adm = dev_get_drvdata(dev->parent); in q6adm_open() local
397 copp = q6adm_find_matching_copp(adm, port_id, topology, perf_mode, in q6adm_open()
404 spin_lock_irqsave(&adm->copps_list_lock, flags); in q6adm_open()
405 copp = q6adm_alloc_copp(adm, port_id); in q6adm_open()
407 spin_unlock_irqrestore(&adm->copps_list_lock, flags); in q6adm_open()
411 list_add_tail(&copp->node, &adm->copps_list); in q6adm_open()
412 spin_unlock_irqrestore(&adm->copps_list_lock, flags); in q6adm_open()
422 ret = q6adm_device_open(adm, copp, port_id, path, topology, in q6adm_open()
462 struct q6adm *adm = dev_get_drvdata(dev->parent); in q6adm_matrix_map() local
518 copp = q6adm_find_copp(adm, port_idx, copp_idx); in q6adm_matrix_map()
528 mutex_lock(&adm->lock); in q6adm_matrix_map()
529 adm->result.status = 0; in q6adm_matrix_map()
530 adm->result.opcode = 0; in q6adm_matrix_map()
532 ret = apr_send_pkt(adm->apr, pkt); in q6adm_matrix_map()
538 ret = wait_event_timeout(adm->matrix_map_wait, in q6adm_matrix_map()
539 adm->result.opcode == pkt->hdr.opcode, in q6adm_matrix_map()
546 } else if (adm->result.status > 0) { in q6adm_matrix_map()
548 adm->result.status); in q6adm_matrix_map()
554 mutex_unlock(&adm->lock); in q6adm_matrix_map()
570 struct q6adm *adm = dev_get_drvdata(dev->parent); in q6adm_close() local
573 ret = q6adm_device_close(adm, copp, copp->afe_port, copp->copp_idx); in q6adm_close()
575 dev_err(adm->dev, "Failed to close copp %d\n", ret); in q6adm_close()
588 struct q6adm *adm; in q6adm_probe() local
590 adm = devm_kzalloc(dev, sizeof(*adm), GFP_KERNEL); in q6adm_probe()
591 if (!adm) in q6adm_probe()
594 adm->apr = adev; in q6adm_probe()
595 dev_set_drvdata(dev, adm); in q6adm_probe()
596 adm->dev = dev; in q6adm_probe()
597 q6core_get_svc_api_info(adev->svc_id, &adm->ainfo); in q6adm_probe()
598 mutex_init(&adm->lock); in q6adm_probe()
599 init_waitqueue_head(&adm->matrix_map_wait); in q6adm_probe()
601 INIT_LIST_HEAD(&adm->copps_list); in q6adm_probe()
602 spin_lock_init(&adm->copps_list_lock); in q6adm_probe()