Loading Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt +5 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ edge. Value type: <stringlist> Definition: must be "qcom,glink-rpm" - label: Usage: optional Value type: <string> Definition: should specify the subsystem name this edge corresponds to. - interrupts: Usage: required Value type: <prop-encoded-array> Loading drivers/rpmsg/qcom_glink_native.c +46 −0 Original line number Diff line number Diff line /* * Copyright (c) 2016-2017, Linaro Ltd * Copyright (c) 2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -101,6 +102,8 @@ struct glink_core_rx_intent { struct qcom_glink { struct device *dev; const char *name; struct mbox_client mbox_client; struct mbox_chan *mbox_chan; Loading Loading @@ -130,6 +133,13 @@ enum { GLINK_STATE_CLOSING, }; struct qcom_glink_device { struct rpmsg_device rpdev; struct qcom_glink *glink; }; #define to_glink_device(_x) container_of(_x, struct qcom_glink_device, rpdev) /** * struct glink_channel - internal representation of a channel * @rpdev: rpdev reference, only used for primary endpoints Loading Loading @@ -1337,6 +1347,10 @@ static struct device_node *qcom_glink_match_channel(struct device_node *node, return NULL; } static const struct rpmsg_device_ops glink_chrdev_ops = { .create_ept = qcom_glink_create_ept, }; static const struct rpmsg_device_ops glink_device_ops = { .create_ept = qcom_glink_create_ept, .announce_create = qcom_glink_announce_create, Loading Loading @@ -1545,6 +1559,30 @@ static void qcom_glink_work(struct work_struct *work) } } static void qcom_glink_device_release(struct device *dev) { struct rpmsg_device *rpdev = to_rpmsg_device(dev); struct qcom_glink_device *gdev = to_glink_device(rpdev); kfree(gdev); } static int qcom_glink_create_chrdev(struct qcom_glink *glink) { struct qcom_glink_device *gdev; gdev = kzalloc(sizeof(*gdev), GFP_KERNEL); if (!gdev) return -ENOMEM; gdev->glink = glink; gdev->rpdev.ops = &glink_chrdev_ops; gdev->rpdev.dev.parent = glink->dev; gdev->rpdev.dev.release = qcom_glink_device_release; return rpmsg_chrdev_register_device(&gdev->rpdev); } struct qcom_glink *qcom_glink_native_probe(struct device *dev, unsigned long features, struct qcom_glink_pipe *rx, Loading Loading @@ -1575,6 +1613,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, idr_init(&glink->lcids); idr_init(&glink->rcids); ret = of_property_read_string(dev->of_node, "label", &glink->name); if (ret < 0) glink->name = dev->of_node->name; glink->mbox_client.dev = dev; glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0); if (IS_ERR(glink->mbox_chan)) { Loading @@ -1599,6 +1641,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, if (ret) return ERR_PTR(ret); ret = qcom_glink_create_chrdev(glink); if (ret) dev_err(glink->dev, "failed to register chrdev\n"); return glink; } EXPORT_SYMBOL_GPL(qcom_glink_native_probe); Loading Loading
Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt +5 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ edge. Value type: <stringlist> Definition: must be "qcom,glink-rpm" - label: Usage: optional Value type: <string> Definition: should specify the subsystem name this edge corresponds to. - interrupts: Usage: required Value type: <prop-encoded-array> Loading
drivers/rpmsg/qcom_glink_native.c +46 −0 Original line number Diff line number Diff line /* * Copyright (c) 2016-2017, Linaro Ltd * Copyright (c) 2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -101,6 +102,8 @@ struct glink_core_rx_intent { struct qcom_glink { struct device *dev; const char *name; struct mbox_client mbox_client; struct mbox_chan *mbox_chan; Loading Loading @@ -130,6 +133,13 @@ enum { GLINK_STATE_CLOSING, }; struct qcom_glink_device { struct rpmsg_device rpdev; struct qcom_glink *glink; }; #define to_glink_device(_x) container_of(_x, struct qcom_glink_device, rpdev) /** * struct glink_channel - internal representation of a channel * @rpdev: rpdev reference, only used for primary endpoints Loading Loading @@ -1337,6 +1347,10 @@ static struct device_node *qcom_glink_match_channel(struct device_node *node, return NULL; } static const struct rpmsg_device_ops glink_chrdev_ops = { .create_ept = qcom_glink_create_ept, }; static const struct rpmsg_device_ops glink_device_ops = { .create_ept = qcom_glink_create_ept, .announce_create = qcom_glink_announce_create, Loading Loading @@ -1545,6 +1559,30 @@ static void qcom_glink_work(struct work_struct *work) } } static void qcom_glink_device_release(struct device *dev) { struct rpmsg_device *rpdev = to_rpmsg_device(dev); struct qcom_glink_device *gdev = to_glink_device(rpdev); kfree(gdev); } static int qcom_glink_create_chrdev(struct qcom_glink *glink) { struct qcom_glink_device *gdev; gdev = kzalloc(sizeof(*gdev), GFP_KERNEL); if (!gdev) return -ENOMEM; gdev->glink = glink; gdev->rpdev.ops = &glink_chrdev_ops; gdev->rpdev.dev.parent = glink->dev; gdev->rpdev.dev.release = qcom_glink_device_release; return rpmsg_chrdev_register_device(&gdev->rpdev); } struct qcom_glink *qcom_glink_native_probe(struct device *dev, unsigned long features, struct qcom_glink_pipe *rx, Loading Loading @@ -1575,6 +1613,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, idr_init(&glink->lcids); idr_init(&glink->rcids); ret = of_property_read_string(dev->of_node, "label", &glink->name); if (ret < 0) glink->name = dev->of_node->name; glink->mbox_client.dev = dev; glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0); if (IS_ERR(glink->mbox_chan)) { Loading @@ -1599,6 +1641,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, if (ret) return ERR_PTR(ret); ret = qcom_glink_create_chrdev(glink); if (ret) dev_err(glink->dev, "failed to register chrdev\n"); return glink; } EXPORT_SYMBOL_GPL(qcom_glink_native_probe); Loading