Lines Matching refs:apm
30 int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt, uint32_t rsp_opcode) in q6apm_send_cmd_sync() argument
32 gpr_device_t *gdev = apm->gdev; in q6apm_send_cmd_sync()
34 return audioreach_send_cmd_sync(&gdev->dev, gdev, &apm->result, &apm->lock, in q6apm_send_cmd_sync()
35 NULL, &apm->wait, pkt, rsp_opcode); in q6apm_send_cmd_sync()
38 static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, uint32_t graph_id) in q6apm_get_audioreach_graph() argument
44 mutex_lock(&apm->lock); in q6apm_get_audioreach_graph()
45 graph = idr_find(&apm->graph_idr, graph_id); in q6apm_get_audioreach_graph()
46 mutex_unlock(&apm->lock); in q6apm_get_audioreach_graph()
53 info = idr_find(&apm->graph_info_idr, graph_id); in q6apm_get_audioreach_graph()
62 graph->apm = apm; in q6apm_get_audioreach_graph()
66 graph->graph = audioreach_alloc_graph_pkt(apm, &info->sg_list, graph_id); in q6apm_get_audioreach_graph()
74 mutex_lock(&apm->lock); in q6apm_get_audioreach_graph()
75 id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL); in q6apm_get_audioreach_graph()
77 dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id); in q6apm_get_audioreach_graph()
80 mutex_unlock(&apm->lock); in q6apm_get_audioreach_graph()
83 mutex_unlock(&apm->lock); in q6apm_get_audioreach_graph()
87 q6apm_send_cmd_sync(apm, graph->graph, 0); in q6apm_get_audioreach_graph()
99 struct q6apm *apm = graph->apm; in audioreach_graph_mgmt_cmd() local
121 rc = q6apm_send_cmd_sync(apm, pkt, 0); in audioreach_graph_mgmt_cmd()
131 struct q6apm *apm; in q6apm_put_audioreach_graph() local
134 apm = graph->apm; in q6apm_put_audioreach_graph()
138 mutex_lock(&apm->lock); in q6apm_put_audioreach_graph()
139 graph = idr_remove(&apm->graph_idr, graph->id); in q6apm_put_audioreach_graph()
140 mutex_unlock(&apm->lock); in q6apm_put_audioreach_graph()
146 static int q6apm_get_apm_state(struct q6apm *apm) in q6apm_get_apm_state() argument
154 q6apm_send_cmd_sync(apm, pkt, APM_CMD_RSP_GET_SPF_STATE); in q6apm_get_apm_state()
158 return apm->state; in q6apm_get_apm_state()
161 static struct audioreach_module *__q6apm_find_module_by_mid(struct q6apm *apm, in __q6apm_find_module_by_mid() argument
181 static struct audioreach_module *q6apm_graph_get_last_module(struct q6apm *apm, u32 sgid) in q6apm_graph_get_last_module() argument
187 mutex_lock(&apm->lock); in q6apm_graph_get_last_module()
188 sg = idr_find(&apm->sub_graphs_idr, sgid); in q6apm_graph_get_last_module()
189 mutex_unlock(&apm->lock); in q6apm_graph_get_last_module()
199 static struct audioreach_module *q6apm_graph_get_first_module(struct q6apm *apm, u32 sgid) in q6apm_graph_get_first_module() argument
205 mutex_lock(&apm->lock); in q6apm_graph_get_first_module()
206 sg = idr_find(&apm->sub_graphs_idr, sgid); in q6apm_graph_get_first_module()
207 mutex_unlock(&apm->lock); in q6apm_graph_get_first_module()
217 bool q6apm_is_sub_graphs_connected(struct q6apm *apm, u32 src_sgid, u32 dst_sgid) in q6apm_is_sub_graphs_connected() argument
222 module = q6apm_graph_get_last_module(apm, src_sgid); in q6apm_is_sub_graphs_connected()
227 module = q6apm_graph_get_first_module(apm, dst_sgid); in q6apm_is_sub_graphs_connected()
237 int q6apm_connect_sub_graphs(struct q6apm *apm, u32 src_sgid, u32 dst_sgid, bool connect) in q6apm_connect_sub_graphs() argument
243 module = q6apm_graph_get_last_module(apm, src_sgid); in q6apm_connect_sub_graphs()
252 module = q6apm_graph_get_first_module(apm, dst_sgid); in q6apm_connect_sub_graphs()
605 struct q6apm *apm = dev_get_drvdata(dev->parent); in q6apm_graph_open() local
610 ar_graph = q6apm_get_audioreach_graph(apm, graph_id); in q6apm_graph_open()
622 graph->apm = apm; in q6apm_graph_open()
633 graph->port = gpr_alloc_port(apm->gdev, dev, graph_callback, graph); in q6apm_graph_open()
720 struct q6apm *apm; in apm_probe() local
723 apm = devm_kzalloc(dev, sizeof(*apm), GFP_KERNEL); in apm_probe()
724 if (!apm) in apm_probe()
727 dev_set_drvdata(dev, apm); in apm_probe()
729 mutex_init(&apm->lock); in apm_probe()
730 apm->dev = dev; in apm_probe()
731 apm->gdev = gdev; in apm_probe()
732 init_waitqueue_head(&apm->wait); in apm_probe()
734 idr_init(&apm->graph_idr); in apm_probe()
735 idr_init(&apm->graph_info_idr); in apm_probe()
736 idr_init(&apm->sub_graphs_idr); in apm_probe()
737 idr_init(&apm->containers_idr); in apm_probe()
739 idr_init(&apm->modules_idr); in apm_probe()
741 q6apm_get_apm_state(apm); in apm_probe()
755 struct q6apm *apm = graph->apm; in q6apm_find_module_by_mid() local
757 return __q6apm_find_module_by_mid(apm, info, mid); in q6apm_find_module_by_mid()
764 struct q6apm *apm = dev_get_drvdata(&gdev->dev); in apm_callback() local
773 apm->result.opcode = hdr->opcode; in apm_callback()
774 apm->result.status = 0; in apm_callback()
776 apm->state = result->opcode; in apm_callback()
777 wake_up(&apm->wait); in apm_callback()
788 apm->result.opcode = result->opcode; in apm_callback()
789 apm->result.status = result->status; in apm_callback()
793 wake_up(&apm->wait); in apm_callback()