Commit 0be363bf authored by Bjorn Andersson's avatar Bjorn Andersson

rpmsg: smd: Register rpmsg user space interface for edges

Create and register a rpmsg device for use with the rpmsg user space
interface, allowing user space to access SMD channels.

Also provide the "rpmsg_name" device attribute to expose the edge name
in sysfs, allowing the user to write udev rules for specific rpmsg
devices and their children.
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent c0cdc19f
...@@ -1002,6 +1002,20 @@ static int qcom_smd_create_device(struct qcom_smd_channel *channel) ...@@ -1002,6 +1002,20 @@ static int qcom_smd_create_device(struct qcom_smd_channel *channel)
return rpmsg_register_device(rpdev); return rpmsg_register_device(rpdev);
} }
static int qcom_smd_create_chrdev(struct qcom_smd_edge *edge)
{
struct qcom_smd_device *qsdev;
qsdev = kzalloc(sizeof(*qsdev), GFP_KERNEL);
if (!qsdev)
return -ENOMEM;
qsdev->edge = edge;
qsdev->rpdev.ops = &qcom_smd_device_ops;
qsdev->rpdev.dev.parent = &edge->dev;
return rpmsg_chrdev_register_device(&qsdev->rpdev);
}
/* /*
* Allocate the qcom_smd_channel object for a newly found smd channel, * Allocate the qcom_smd_channel object for a newly found smd channel,
* retrieving and validating the smem items involved. * retrieving and validating the smem items involved.
...@@ -1357,6 +1371,12 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent, ...@@ -1357,6 +1371,12 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent,
goto unregister_dev; goto unregister_dev;
} }
ret = qcom_smd_create_chrdev(edge);
if (ret) {
dev_err(&edge->dev, "failed to register chrdev for edge\n");
goto unregister_dev;
}
schedule_work(&edge->scan_work); schedule_work(&edge->scan_work);
return edge; return edge;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment