Lines Matching refs:edge

163 	struct qcom_smd_edge *edge;  member
200 struct qcom_smd_edge *edge; member
372 struct qcom_smd_edge *edge = channel->edge; in qcom_smd_signal_channel() local
374 if (edge->mbox_chan) { in qcom_smd_signal_channel()
380 mbox_send_message(edge->mbox_chan, NULL); in qcom_smd_signal_channel()
381 mbox_client_txdone(edge->mbox_chan, 0); in qcom_smd_signal_channel()
383 regmap_write(edge->ipc_regmap, edge->ipc_offset, BIT(edge->ipc_bit)); in qcom_smd_signal_channel()
444 struct qcom_smd_edge *edge = channel->edge; in qcom_smd_channel_set_state() local
450 dev_dbg(&edge->dev, "set_state(%s, %d)\n", channel->name, state); in qcom_smd_channel_set_state()
644 struct qcom_smd_edge *edge = data; in qcom_smd_edge_intr() local
653 spin_lock(&edge->channels_lock); in qcom_smd_edge_intr()
654 list_for_each_entry(channel, &edge->channels, list) { in qcom_smd_edge_intr()
659 spin_unlock(&edge->channels_lock); in qcom_smd_edge_intr()
666 available = qcom_smem_get_free_space(edge->remote_pid); in qcom_smd_edge_intr()
667 if (available != edge->smem_available) { in qcom_smd_edge_intr()
668 edge->smem_available = available; in qcom_smd_edge_intr()
673 schedule_work(&edge->scan_work); in qcom_smd_edge_intr()
675 schedule_work(&edge->state_work); in qcom_smd_edge_intr()
818 struct qcom_smd_edge *edge = channel->edge; in qcom_smd_channel_open() local
839 dev_err(&edge->dev, "remote side did not enter opening state\n"); in qcom_smd_channel_open()
850 dev_err(&edge->dev, "remote side did not enter open state\n"); in qcom_smd_channel_open()
876 qcom_smd_find_channel(struct qcom_smd_edge *edge, const char *name) in qcom_smd_find_channel() argument
882 spin_lock_irqsave(&edge->channels_lock, flags); in qcom_smd_find_channel()
883 list_for_each_entry(channel, &edge->channels, list) { in qcom_smd_find_channel()
889 spin_unlock_irqrestore(&edge->channels_lock, flags); in qcom_smd_find_channel()
908 struct qcom_smd_edge *edge = qsdev->edge; in qcom_smd_create_ept() local
914 ret = wait_event_interruptible_timeout(edge->new_channel_event, in qcom_smd_create_ept()
915 (channel = qcom_smd_find_channel(edge, name)) != NULL, in qcom_smd_create_ept()
1042 schedule_work(&channel->edge->state_work); in qcom_smd_announce_create()
1076 struct qcom_smd_edge *edge = channel->edge; in qcom_smd_create_device() local
1078 dev_dbg(&edge->dev, "registering '%s'\n", channel->name); in qcom_smd_create_device()
1085 qsdev->edge = edge; in qcom_smd_create_device()
1096 rpdev->dev.of_node = qcom_smd_match_channel(edge->of_node, channel->name); in qcom_smd_create_device()
1097 rpdev->dev.parent = &edge->dev; in qcom_smd_create_device()
1103 static int qcom_smd_create_chrdev(struct qcom_smd_edge *edge) in qcom_smd_create_chrdev() argument
1111 qsdev->edge = edge; in qcom_smd_create_chrdev()
1113 qsdev->rpdev.dev.parent = &edge->dev; in qcom_smd_create_chrdev()
1123 static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *edge, in qcom_smd_create_channel() argument
1139 channel->edge = edge; in qcom_smd_create_channel()
1151 info = qcom_smem_get(edge->remote_pid, smem_info_item, &info_size); in qcom_smd_create_channel()
1166 dev_err(&edge->dev, in qcom_smd_create_channel()
1172 fifo_base = qcom_smem_get(edge->remote_pid, smem_fifo_item, &fifo_size); in qcom_smd_create_channel()
1181 dev_dbg(&edge->dev, "new channel '%s' info-size: %zu fifo-size: %zu\n", in qcom_smd_create_channel()
1207 struct qcom_smd_edge *edge = container_of(work, struct qcom_smd_edge, scan_work); in qcom_channel_scan_worker() local
1219 alloc_tbl = qcom_smem_get(edge->remote_pid, in qcom_channel_scan_worker()
1227 if (test_bit(i, edge->allocated[tbl])) in qcom_channel_scan_worker()
1239 if ((eflags & SMD_CHANNEL_FLAGS_EDGE_MASK) != edge->edge_id) in qcom_channel_scan_worker()
1246 channel = qcom_smd_create_channel(edge, info_id, fifo_id, entry->name); in qcom_channel_scan_worker()
1250 spin_lock_irqsave(&edge->channels_lock, flags); in qcom_channel_scan_worker()
1251 list_add(&channel->list, &edge->channels); in qcom_channel_scan_worker()
1252 spin_unlock_irqrestore(&edge->channels_lock, flags); in qcom_channel_scan_worker()
1254 dev_dbg(&edge->dev, "new channel found: '%s'\n", channel->name); in qcom_channel_scan_worker()
1255 set_bit(i, edge->allocated[tbl]); in qcom_channel_scan_worker()
1257 wake_up_interruptible_all(&edge->new_channel_event); in qcom_channel_scan_worker()
1261 schedule_work(&edge->state_work); in qcom_channel_scan_worker()
1275 struct qcom_smd_edge *edge = container_of(work, in qcom_channel_state_worker() local
1286 spin_lock_irqsave(&edge->channels_lock, flags); in qcom_channel_state_worker()
1287 list_for_each_entry(channel, &edge->channels, list) { in qcom_channel_state_worker()
1304 spin_unlock_irqrestore(&edge->channels_lock, flags); in qcom_channel_state_worker()
1306 spin_lock_irqsave(&edge->channels_lock, flags); in qcom_channel_state_worker()
1314 list_for_each_entry(channel, &edge->channels, list) { in qcom_channel_state_worker()
1324 spin_unlock_irqrestore(&edge->channels_lock, flags); in qcom_channel_state_worker()
1329 rpmsg_unregister_device(&edge->dev, &chinfo); in qcom_channel_state_worker()
1331 spin_lock_irqsave(&edge->channels_lock, flags); in qcom_channel_state_worker()
1333 spin_unlock_irqrestore(&edge->channels_lock, flags); in qcom_channel_state_worker()
1341 struct qcom_smd_edge *edge) in qcom_smd_parse_edge() argument
1348 INIT_LIST_HEAD(&edge->channels); in qcom_smd_parse_edge()
1349 spin_lock_init(&edge->channels_lock); in qcom_smd_parse_edge()
1351 INIT_WORK(&edge->scan_work, qcom_channel_scan_worker); in qcom_smd_parse_edge()
1352 INIT_WORK(&edge->state_work, qcom_channel_state_worker); in qcom_smd_parse_edge()
1354 edge->of_node = of_node_get(node); in qcom_smd_parse_edge()
1357 ret = of_property_read_u32(node, key, &edge->edge_id); in qcom_smd_parse_edge()
1363 edge->remote_pid = QCOM_SMEM_HOST_ANY; in qcom_smd_parse_edge()
1365 of_property_read_u32(node, key, &edge->remote_pid); in qcom_smd_parse_edge()
1367 edge->mbox_client.dev = dev; in qcom_smd_parse_edge()
1368 edge->mbox_client.knows_txdone = true; in qcom_smd_parse_edge()
1369 edge->mbox_chan = mbox_request_channel(&edge->mbox_client, 0); in qcom_smd_parse_edge()
1370 if (IS_ERR(edge->mbox_chan)) { in qcom_smd_parse_edge()
1371 if (PTR_ERR(edge->mbox_chan) != -ENODEV) { in qcom_smd_parse_edge()
1372 ret = PTR_ERR(edge->mbox_chan); in qcom_smd_parse_edge()
1376 edge->mbox_chan = NULL; in qcom_smd_parse_edge()
1385 edge->ipc_regmap = syscon_node_to_regmap(syscon_np); in qcom_smd_parse_edge()
1387 if (IS_ERR(edge->ipc_regmap)) { in qcom_smd_parse_edge()
1388 ret = PTR_ERR(edge->ipc_regmap); in qcom_smd_parse_edge()
1393 ret = of_property_read_u32_index(node, key, 1, &edge->ipc_offset); in qcom_smd_parse_edge()
1399 ret = of_property_read_u32_index(node, key, 2, &edge->ipc_bit); in qcom_smd_parse_edge()
1406 ret = of_property_read_string(node, "label", &edge->name); in qcom_smd_parse_edge()
1408 edge->name = node->name; in qcom_smd_parse_edge()
1419 node->name, edge); in qcom_smd_parse_edge()
1425 edge->irq = irq; in qcom_smd_parse_edge()
1431 edge->of_node = NULL; in qcom_smd_parse_edge()
1443 struct qcom_smd_edge *edge = to_smd_edge(dev); in qcom_smd_edge_release() local
1445 list_for_each_entry_safe(channel, tmp, &edge->channels, list) { in qcom_smd_edge_release()
1451 kfree(edge); in qcom_smd_edge_release()
1457 struct qcom_smd_edge *edge = to_smd_edge(dev); in rpmsg_name_show() local
1459 return sprintf(buf, "%s\n", edge->name); in rpmsg_name_show()
1479 struct qcom_smd_edge *edge; in qcom_smd_register_edge() local
1482 edge = kzalloc(sizeof(*edge), GFP_KERNEL); in qcom_smd_register_edge()
1483 if (!edge) in qcom_smd_register_edge()
1486 init_waitqueue_head(&edge->new_channel_event); in qcom_smd_register_edge()
1488 edge->dev.parent = parent; in qcom_smd_register_edge()
1489 edge->dev.release = qcom_smd_edge_release; in qcom_smd_register_edge()
1490 edge->dev.of_node = node; in qcom_smd_register_edge()
1491 edge->dev.groups = qcom_smd_edge_groups; in qcom_smd_register_edge()
1492 dev_set_name(&edge->dev, "%s:%pOFn", dev_name(parent), node); in qcom_smd_register_edge()
1493 ret = device_register(&edge->dev); in qcom_smd_register_edge()
1496 put_device(&edge->dev); in qcom_smd_register_edge()
1500 ret = qcom_smd_parse_edge(&edge->dev, node, edge); in qcom_smd_register_edge()
1502 dev_err(&edge->dev, "failed to parse smd edge\n"); in qcom_smd_register_edge()
1506 ret = qcom_smd_create_chrdev(edge); in qcom_smd_register_edge()
1508 dev_err(&edge->dev, "failed to register chrdev for edge\n"); in qcom_smd_register_edge()
1512 schedule_work(&edge->scan_work); in qcom_smd_register_edge()
1514 return edge; in qcom_smd_register_edge()
1517 if (!IS_ERR_OR_NULL(edge->mbox_chan)) in qcom_smd_register_edge()
1518 mbox_free_channel(edge->mbox_chan); in qcom_smd_register_edge()
1520 device_unregister(&edge->dev); in qcom_smd_register_edge()
1536 int qcom_smd_unregister_edge(struct qcom_smd_edge *edge) in qcom_smd_unregister_edge() argument
1540 disable_irq(edge->irq); in qcom_smd_unregister_edge()
1541 cancel_work_sync(&edge->scan_work); in qcom_smd_unregister_edge()
1542 cancel_work_sync(&edge->state_work); in qcom_smd_unregister_edge()
1544 ret = device_for_each_child(&edge->dev, NULL, qcom_smd_remove_device); in qcom_smd_unregister_edge()
1546 dev_warn(&edge->dev, "can't remove smd device: %d\n", ret); in qcom_smd_unregister_edge()
1548 mbox_free_channel(edge->mbox_chan); in qcom_smd_unregister_edge()
1549 device_unregister(&edge->dev); in qcom_smd_unregister_edge()
1573 struct qcom_smd_edge *edge = to_smd_edge(dev); in qcom_smd_remove_edge() local
1575 return qcom_smd_unregister_edge(edge); in qcom_smd_remove_edge()