Lines Matching defs:apm
32 int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt, uint32_t rsp_opcode)
34 gpr_device_t *gdev = apm->gdev;
36 return audioreach_send_cmd_sync(&gdev->dev, gdev, &apm->result, &apm->lock,
37 NULL, &apm->wait, pkt, rsp_opcode);
40 static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, uint32_t graph_id)
46 mutex_lock(&apm->lock);
47 graph = idr_find(&apm->graph_idr, graph_id);
48 mutex_unlock(&apm->lock);
55 info = idr_find(&apm->graph_info_idr, graph_id);
64 graph->apm = apm;
68 graph->graph = audioreach_alloc_graph_pkt(apm, info);
76 mutex_lock(&apm->lock);
77 id = idr_alloc(&apm->graph_idr, graph, graph_id, graph_id + 1, GFP_KERNEL);
79 dev_err(apm->dev, "Unable to allocate graph id (%d)\n", graph_id);
82 mutex_unlock(&apm->lock);
85 mutex_unlock(&apm->lock);
89 q6apm_send_cmd_sync(apm, graph->graph, 0);
101 struct q6apm *apm = graph->apm;
123 rc = q6apm_send_cmd_sync(apm, pkt, 0);
133 struct q6apm *apm;
136 apm = graph->apm;
140 mutex_lock(&apm->lock);
141 graph = idr_remove(&apm->graph_idr, graph->id);
142 mutex_unlock(&apm->lock);
149 static int q6apm_get_apm_state(struct q6apm *apm)
157 q6apm_send_cmd_sync(apm, pkt, APM_CMD_RSP_GET_SPF_STATE);
161 return apm->state;
173 static struct audioreach_module *__q6apm_find_module_by_mid(struct q6apm *apm,
608 struct q6apm *apm = dev_get_drvdata(dev->parent);
613 ar_graph = q6apm_get_audioreach_graph(apm, graph_id);
625 graph->apm = apm;
636 graph->port = gpr_alloc_port(apm->gdev, dev, graph_callback, graph);
724 struct q6apm *apm;
727 apm = devm_kzalloc(dev, sizeof(*apm), GFP_KERNEL);
728 if (!apm)
731 dev_set_drvdata(dev, apm);
733 mutex_init(&apm->lock);
734 apm->dev = dev;
735 apm->gdev = gdev;
736 init_waitqueue_head(&apm->wait);
738 INIT_LIST_HEAD(&apm->widget_list);
739 idr_init(&apm->graph_idr);
740 idr_init(&apm->graph_info_idr);
741 idr_init(&apm->sub_graphs_idr);
742 idr_init(&apm->containers_idr);
744 idr_init(&apm->modules_idr);
746 g_apm = apm;
748 q6apm_get_apm_state(apm);
762 struct q6apm *apm = graph->apm;
764 return __q6apm_find_module_by_mid(apm, info, mid);
771 struct q6apm *apm = dev_get_drvdata(&gdev->dev);
780 apm->result.opcode = hdr->opcode;
781 apm->result.status = 0;
783 apm->state = result->opcode;
784 wake_up(&apm->wait);
795 apm->result.opcode = result->opcode;
796 apm->result.status = result->status;
800 wake_up(&apm->wait);
825 .name = "qcom-apm",