Lines Matching refs:smp2p

79  * @smp2p:	reference to the device driver context
92 struct qcom_smp2p *smp2p;
151 static void qcom_smp2p_kick(struct qcom_smp2p *smp2p)
156 if (smp2p->mbox_chan) {
157 mbox_send_message(smp2p->mbox_chan, NULL);
158 mbox_client_txdone(smp2p->mbox_chan, 0);
160 regmap_write(smp2p->ipc_regmap, smp2p->ipc_offset, BIT(smp2p->ipc_bit));
167 * @data: smp2p driver context
176 struct qcom_smp2p *smp2p = data;
177 unsigned smem_id = smp2p->smem_items[SMP2P_INBOUND];
178 unsigned pid = smp2p->remote_pid;
186 in = smp2p->in;
192 dev_err(smp2p->dev,
193 "Unable to acquire remote smp2p item\n");
197 smp2p->in = in;
201 for (i = smp2p->valid_entries; i < in->valid_entries; i++) {
202 list_for_each_entry(entry, &smp2p->inbound, node) {
210 smp2p->valid_entries = i;
213 list_for_each_entry(entry, &smp2p->inbound, node) {
280 .name = "smp2p",
305 static int qcom_smp2p_inbound_entry(struct qcom_smp2p *smp2p,
311 dev_err(smp2p->dev, "failed to add irq_domain\n");
333 qcom_smp2p_kick(entry->smp2p);
342 static int qcom_smp2p_outbound_entry(struct qcom_smp2p *smp2p,
346 struct smp2p_smem_item *out = smp2p->out;
360 dev_err(smp2p->dev, "failed to register qcom_smem_state\n");
367 static int qcom_smp2p_alloc_outbound_item(struct qcom_smp2p *smp2p)
370 unsigned smem_id = smp2p->smem_items[SMP2P_OUTBOUND];
371 unsigned pid = smp2p->remote_pid;
377 dev_err(smp2p->dev,
378 "unable to allocate local smp2p item\n");
384 dev_err(smp2p->dev, "Unable to acquire local smp2p item\n");
390 out->local_pid = smp2p->local_pid;
391 out->remote_pid = smp2p->remote_pid;
402 qcom_smp2p_kick(smp2p);
404 smp2p->out = out;
409 static int smp2p_parse_ipc(struct qcom_smp2p *smp2p)
412 struct device *dev = smp2p->dev;
422 smp2p->ipc_regmap = syscon_node_to_regmap(syscon);
424 if (IS_ERR(smp2p->ipc_regmap))
425 return PTR_ERR(smp2p->ipc_regmap);
428 ret = of_property_read_u32_index(dev->of_node, key, 1, &smp2p->ipc_offset);
434 ret = of_property_read_u32_index(dev->of_node, key, 2, &smp2p->ipc_bit);
447 struct qcom_smp2p *smp2p;
452 smp2p = devm_kzalloc(&pdev->dev, sizeof(*smp2p), GFP_KERNEL);
453 if (!smp2p)
456 smp2p->dev = &pdev->dev;
457 INIT_LIST_HEAD(&smp2p->inbound);
458 INIT_LIST_HEAD(&smp2p->outbound);
460 platform_set_drvdata(pdev, smp2p);
464 smp2p->smem_items, 2);
469 ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->local_pid);
474 ret = of_property_read_u32(pdev->dev.of_node, key, &smp2p->remote_pid);
482 smp2p->mbox_client.dev = &pdev->dev;
483 smp2p->mbox_client.knows_txdone = true;
484 smp2p->mbox_chan = mbox_request_channel(&smp2p->mbox_client, 0);
485 if (IS_ERR(smp2p->mbox_chan)) {
486 if (PTR_ERR(smp2p->mbox_chan) != -ENODEV)
487 return PTR_ERR(smp2p->mbox_chan);
489 smp2p->mbox_chan = NULL;
491 ret = smp2p_parse_ipc(smp2p);
496 ret = qcom_smp2p_alloc_outbound_item(smp2p);
507 entry->smp2p = smp2p;
515 ret = qcom_smp2p_inbound_entry(smp2p, entry, node);
519 list_add(&entry->node, &smp2p->inbound);
521 ret = qcom_smp2p_outbound_entry(smp2p, entry, node);
525 list_add(&entry->node, &smp2p->outbound);
530 qcom_smp2p_kick(smp2p);
535 "smp2p", (void *)smp2p);
545 list_for_each_entry(entry, &smp2p->inbound, node)
548 list_for_each_entry(entry, &smp2p->outbound, node)
551 smp2p->out->valid_entries = 0;
554 mbox_free_channel(smp2p->mbox_chan);
565 struct qcom_smp2p *smp2p = platform_get_drvdata(pdev);
568 list_for_each_entry(entry, &smp2p->inbound, node)
571 list_for_each_entry(entry, &smp2p->outbound, node)
574 mbox_free_channel(smp2p->mbox_chan);
576 smp2p->out->valid_entries = 0;
582 { .compatible = "qcom,smp2p" },