Lines Matching full: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
608 struct q6apm *apm = dev_get_drvdata(dev->parent); in q6apm_graph_open() local
613 ar_graph = q6apm_get_audioreach_graph(apm, graph_id); in q6apm_graph_open()
625 graph->apm = apm; in q6apm_graph_open()
636 graph->port = gpr_alloc_port(apm->gdev, dev, graph_callback, graph); in q6apm_graph_open()
724 struct q6apm *apm; in apm_probe() local
727 apm = devm_kzalloc(dev, sizeof(*apm), GFP_KERNEL); in apm_probe()
728 if (!apm) in apm_probe()
731 dev_set_drvdata(dev, apm); in apm_probe()
733 mutex_init(&apm->lock); in apm_probe()
734 apm->dev = dev; in apm_probe()
735 apm->gdev = gdev; in apm_probe()
736 init_waitqueue_head(&apm->wait); in apm_probe()
738 INIT_LIST_HEAD(&apm->widget_list); in apm_probe()
739 idr_init(&apm->graph_idr); in apm_probe()
740 idr_init(&apm->graph_info_idr); in apm_probe()
741 idr_init(&apm->sub_graphs_idr); in apm_probe()
742 idr_init(&apm->containers_idr); in apm_probe()
744 idr_init(&apm->modules_idr); in apm_probe()
746 g_apm = apm; in apm_probe()
748 q6apm_get_apm_state(apm); in apm_probe()
762 struct q6apm *apm = graph->apm; in q6apm_find_module_by_mid() local
764 return __q6apm_find_module_by_mid(apm, info, mid); in q6apm_find_module_by_mid()
771 struct q6apm *apm = dev_get_drvdata(&gdev->dev); in apm_callback() local
780 apm->result.opcode = hdr->opcode; in apm_callback()
781 apm->result.status = 0; in apm_callback()
783 apm->state = result->opcode; in apm_callback()
784 wake_up(&apm->wait); in apm_callback()
795 apm->result.opcode = result->opcode; in apm_callback()
796 apm->result.status = result->status; in apm_callback()
800 wake_up(&apm->wait); in apm_callback()
825 .name = "qcom-apm",