Lines Matching refs:apm

32 int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt, uint32_t rsp_opcode)  in q6apm_send_cmd_sync()  argument
34 gpr_device_t *gdev = apm->gdev; in q6apm_send_cmd_sync()
36 return audioreach_send_cmd_sync(&gdev->dev, gdev, &apm->result, &apm->lock, in q6apm_send_cmd_sync()
37 NULL, &apm->wait, pkt, rsp_opcode); in q6apm_send_cmd_sync()
40 static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, uint32_t graph_id) in q6apm_get_audioreach_graph() argument
46 mutex_lock(&apm->lock); in q6apm_get_audioreach_graph()
47 graph = idr_find(&apm->graph_idr, graph_id); in q6apm_get_audioreach_graph()
48 mutex_unlock(&apm->lock); in q6apm_get_audioreach_graph()
55 info = idr_find(&apm->graph_info_idr, graph_id); in q6apm_get_audioreach_graph()
64 graph->apm = apm; in q6apm_get_audioreach_graph()
68 graph->graph = audioreach_alloc_graph_pkt(apm, info); in q6apm_get_audioreach_graph()
76 mutex_lock(&apm->lock); in q6apm_get_audioreach_graph()
77 id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL); in q6apm_get_audioreach_graph()
79 dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id); in q6apm_get_audioreach_graph()
82 mutex_unlock(&apm->lock); in q6apm_get_audioreach_graph()
85 mutex_unlock(&apm->lock); in q6apm_get_audioreach_graph()
89 q6apm_send_cmd_sync(apm, graph->graph, 0); in q6apm_get_audioreach_graph()
101 struct q6apm *apm = graph->apm; in audioreach_graph_mgmt_cmd() local
123 rc = q6apm_send_cmd_sync(apm, pkt, 0); in audioreach_graph_mgmt_cmd()
133 struct q6apm *apm; in q6apm_put_audioreach_graph() local
136 apm = graph->apm; in q6apm_put_audioreach_graph()
140 mutex_lock(&apm->lock); in q6apm_put_audioreach_graph()
141 graph = idr_remove(&apm->graph_idr, graph->id); in q6apm_put_audioreach_graph()
142 mutex_unlock(&apm->lock); in q6apm_put_audioreach_graph()
149 static int q6apm_get_apm_state(struct q6apm *apm) in q6apm_get_apm_state() argument
157 q6apm_send_cmd_sync(apm, pkt, APM_CMD_RSP_GET_SPF_STATE); in q6apm_get_apm_state()
161 return apm->state; in q6apm_get_apm_state()
173 static struct audioreach_module *__q6apm_find_module_by_mid(struct q6apm *apm, in __q6apm_find_module_by_mid() argument
536 struct q6apm *apm = dev_get_drvdata(dev->parent); in q6apm_graph_open() local
541 ar_graph = q6apm_get_audioreach_graph(apm, graph_id); in q6apm_graph_open()
553 graph->apm = apm; in q6apm_graph_open()
564 graph->port = gpr_alloc_port(apm->gdev, dev, graph_callback, graph); in q6apm_graph_open()
651 struct q6apm *apm; in apm_probe() local
654 apm = devm_kzalloc(dev, sizeof(*apm), GFP_KERNEL); in apm_probe()
655 if (!apm) in apm_probe()
658 dev_set_drvdata(dev, apm); in apm_probe()
660 mutex_init(&apm->lock); in apm_probe()
661 apm->dev = dev; in apm_probe()
662 apm->gdev = gdev; in apm_probe()
663 init_waitqueue_head(&apm->wait); in apm_probe()
665 INIT_LIST_HEAD(&apm->widget_list); in apm_probe()
666 idr_init(&apm->graph_idr); in apm_probe()
667 idr_init(&apm->graph_info_idr); in apm_probe()
668 idr_init(&apm->sub_graphs_idr); in apm_probe()
669 idr_init(&apm->containers_idr); in apm_probe()
671 idr_init(&apm->modules_idr); in apm_probe()
673 g_apm = apm; in apm_probe()
675 q6apm_get_apm_state(apm); in apm_probe()
689 struct q6apm *apm = graph->apm; in q6apm_find_module_by_mid() local
691 return __q6apm_find_module_by_mid(apm, info, mid); in q6apm_find_module_by_mid()
698 struct q6apm *apm = dev_get_drvdata(&gdev->dev); in apm_callback() local
707 apm->result.opcode = hdr->opcode; in apm_callback()
708 apm->result.status = 0; in apm_callback()
710 apm->state = result->opcode; in apm_callback()
711 wake_up(&apm->wait); in apm_callback()
722 apm->result.opcode = result->opcode; in apm_callback()
723 apm->result.status = result->status; in apm_callback()
727 wake_up(&apm->wait); in apm_callback()