Commit 9a96d63a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'rpmsg-v4.19' of git://github.com/andersson/remoteproc

Pull rpmsg updates from Bjorn Andersson:
 "This fixes a few compile and kerneldoc warnings, allows rpmsg devices
  to handle power domains, allow for labeling GLINK edges and supports
  compat for rpmsg_char"

* tag 'rpmsg-v4.19' of git://github.com/andersson/remoteproc:
  rpmsg: Add compat ioctl for rpmsg char driver
  rpmsg: glink: Store edge name for glink device
  dt-bindings: soc: qcom: Add label for GLINK bindings
  rpmsg: core: add support to power domains for devices
  rpmsg: smd: fix kerneldoc warnings
  rpmsg: glink: Fix various kerneldoc warnings.
  rpmsg: glink: correctly annotate intent members
  rpmsg: smd: Add missing include of sizes.h
parents c54fc865 00b645e0
...@@ -10,6 +10,11 @@ edge. ...@@ -10,6 +10,11 @@ edge.
Value type: <stringlist> Value type: <stringlist>
Definition: must be "qcom,glink-rpm" Definition: must be "qcom,glink-rpm"
- label:
Usage: optional
Value type: <string>
Definition: should specify the subsystem name this edge corresponds to.
- interrupts: - interrupts:
Usage: required Usage: required
Value type: <prop-encoded-array> Value type: <prop-encoded-array>
......
...@@ -40,7 +40,7 @@ struct glink_msg { ...@@ -40,7 +40,7 @@ struct glink_msg {
* struct glink_defer_cmd - deferred incoming control message * struct glink_defer_cmd - deferred incoming control message
* @node: list node * @node: list node
* @msg: message header * @msg: message header
* data: payload of the message * @data: payload of the message
* *
* Copy of a received control message, to be added to @rx_queue and processed * Copy of a received control message, to be added to @rx_queue and processed
* by @rx_work of @qcom_glink. * by @rx_work of @qcom_glink.
...@@ -56,12 +56,13 @@ struct glink_defer_cmd { ...@@ -56,12 +56,13 @@ struct glink_defer_cmd {
* struct glink_core_rx_intent - RX intent * struct glink_core_rx_intent - RX intent
* RX intent * RX intent
* *
* data: pointer to the data (may be NULL for zero-copy) * @data: pointer to the data (may be NULL for zero-copy)
* id: remote or local intent ID * @id: remote or local intent ID
* size: size of the original intent (do not modify) * @size: size of the original intent (do not modify)
* reuse: To mark if the intent can be reused after first use * @reuse: To mark if the intent can be reused after first use
* in_use: To mark if intent is already in use for the channel * @in_use: To mark if intent is already in use for the channel
* offset: next write offset (initially 0) * @offset: next write offset (initially 0)
* @node: list node
*/ */
struct glink_core_rx_intent { struct glink_core_rx_intent {
void *data; void *data;
...@@ -89,10 +90,14 @@ struct glink_core_rx_intent { ...@@ -89,10 +90,14 @@ struct glink_core_rx_intent {
* @idr_lock: synchronizes @lcids and @rcids modifications * @idr_lock: synchronizes @lcids and @rcids modifications
* @lcids: idr of all channels with a known local channel id * @lcids: idr of all channels with a known local channel id
* @rcids: idr of all channels with a known remote channel id * @rcids: idr of all channels with a known remote channel id
* @features: remote features
* @intentless: flag to indicate that there is no intent
*/ */
struct qcom_glink { struct qcom_glink {
struct device *dev; struct device *dev;
const char *name;
struct mbox_client mbox_client; struct mbox_client mbox_client;
struct mbox_chan *mbox_chan; struct mbox_chan *mbox_chan;
...@@ -512,8 +517,8 @@ static void qcom_glink_rx_done(struct qcom_glink *glink, ...@@ -512,8 +517,8 @@ static void qcom_glink_rx_done(struct qcom_glink *glink,
* qcom_glink_receive_version() - receive version/features from remote system * qcom_glink_receive_version() - receive version/features from remote system
* *
* @glink: pointer to transport interface * @glink: pointer to transport interface
* @r_version: remote version * @version: remote version
* @r_features: remote features * @features: remote features
* *
* This function is called in response to a remote-initiated version/feature * This function is called in response to a remote-initiated version/feature
* negotiation sequence. * negotiation sequence.
...@@ -538,8 +543,8 @@ static void qcom_glink_receive_version(struct qcom_glink *glink, ...@@ -538,8 +543,8 @@ static void qcom_glink_receive_version(struct qcom_glink *glink,
* qcom_glink_receive_version_ack() - receive negotiation ack from remote system * qcom_glink_receive_version_ack() - receive negotiation ack from remote system
* *
* @glink: pointer to transport interface * @glink: pointer to transport interface
* @r_version: remote version response * @version: remote version response
* @r_features: remote features response * @features: remote features response
* *
* This function is called in response to a local-initiated version/feature * This function is called in response to a local-initiated version/feature
* negotiation sequence and is the counter-offer from the remote side based * negotiation sequence and is the counter-offer from the remote side based
...@@ -567,7 +572,7 @@ static void qcom_glink_receive_version_ack(struct qcom_glink *glink, ...@@ -567,7 +572,7 @@ static void qcom_glink_receive_version_ack(struct qcom_glink *glink,
/** /**
* qcom_glink_send_intent_req_ack() - convert an rx intent request ack cmd to * qcom_glink_send_intent_req_ack() - convert an rx intent request ack cmd to
wire format and transmit * wire format and transmit
* @glink: The transport to transmit on. * @glink: The transport to transmit on.
* @channel: The glink channel * @channel: The glink channel
* @granted: The request response to encode. * @granted: The request response to encode.
...@@ -594,7 +599,7 @@ static int qcom_glink_send_intent_req_ack(struct qcom_glink *glink, ...@@ -594,7 +599,7 @@ static int qcom_glink_send_intent_req_ack(struct qcom_glink *glink,
* transmit * transmit
* @glink: The transport to transmit on. * @glink: The transport to transmit on.
* @channel: The local channel * @channel: The local channel
* @size: The intent to pass on to remote. * @intent: The intent to pass on to remote.
* *
* Return: 0 on success or standard Linux error code. * Return: 0 on success or standard Linux error code.
*/ */
...@@ -603,11 +608,11 @@ static int qcom_glink_advertise_intent(struct qcom_glink *glink, ...@@ -603,11 +608,11 @@ static int qcom_glink_advertise_intent(struct qcom_glink *glink,
struct glink_core_rx_intent *intent) struct glink_core_rx_intent *intent)
{ {
struct command { struct command {
u16 id; __le16 id;
u16 lcid; __le16 lcid;
u32 count; __le32 count;
u32 size; __le32 size;
u32 liid; __le32 liid;
} __packed; } __packed;
struct command cmd; struct command cmd;
...@@ -698,9 +703,9 @@ static void qcom_glink_handle_rx_done(struct qcom_glink *glink, ...@@ -698,9 +703,9 @@ static void qcom_glink_handle_rx_done(struct qcom_glink *glink,
/** /**
* qcom_glink_handle_intent_req() - Receive a request for rx_intent * qcom_glink_handle_intent_req() - Receive a request for rx_intent
* from remote side * from remote side
* if_ptr: Pointer to the transport interface * @glink: Pointer to the transport interface
* rcid: Remote channel ID * @cid: Remote channel ID
* size: size of the intent * @size: size of the intent
* *
* The function searches for the local channel to which the request for * The function searches for the local channel to which the request for
* rx_intent has arrived and allocates and notifies the remote back * rx_intent has arrived and allocates and notifies the remote back
...@@ -1572,6 +1577,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, ...@@ -1572,6 +1577,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
idr_init(&glink->lcids); idr_init(&glink->lcids);
idr_init(&glink->rcids); 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_client.dev = dev;
glink->mbox_client.knows_txdone = true; glink->mbox_client.knows_txdone = true;
glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0); glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sizes.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/soc/qcom/smem.h> #include <linux/soc/qcom/smem.h>
#include <linux/wait.h> #include <linux/wait.h>
...@@ -93,6 +94,8 @@ static const struct { ...@@ -93,6 +94,8 @@ static const struct {
/** /**
* struct qcom_smd_edge - representing a remote processor * struct qcom_smd_edge - representing a remote processor
* @dev: device associated with this edge
* @name: name of this edge
* @of_node: of_node handle for information related to this edge * @of_node: of_node handle for information related to this edge
* @edge_id: identifier of this edge * @edge_id: identifier of this edge
* @remote_pid: identifier of remote processor * @remote_pid: identifier of remote processor
...@@ -106,6 +109,7 @@ static const struct { ...@@ -106,6 +109,7 @@ static const struct {
* @channels_lock: guard for modifications of @channels * @channels_lock: guard for modifications of @channels
* @allocated: array of bitmaps representing already allocated channels * @allocated: array of bitmaps representing already allocated channels
* @smem_available: last available amount of smem triggering a channel scan * @smem_available: last available amount of smem triggering a channel scan
* @new_channel_event: wait queue for new channel events
* @scan_work: work item for discovering new channels * @scan_work: work item for discovering new channels
* @state_work: work item for edge state changes * @state_work: work item for edge state changes
*/ */
...@@ -172,10 +176,12 @@ struct qcom_smd_endpoint { ...@@ -172,10 +176,12 @@ struct qcom_smd_endpoint {
/** /**
* struct qcom_smd_channel - smd channel struct * struct qcom_smd_channel - smd channel struct
* @edge: qcom_smd_edge this channel is living on * @edge: qcom_smd_edge this channel is living on
* @qsdev: reference to a associated smd client device * @qsept: reference to a associated smd endpoint
* @registered: flag to indicate if the channel is registered
* @name: name of the channel * @name: name of the channel
* @state: local state of the channel * @state: local state of the channel
* @remote_state: remote state of the channel * @remote_state: remote state of the channel
* @state_change_event: state change event
* @info: byte aligned outgoing/incoming channel info * @info: byte aligned outgoing/incoming channel info
* @info_word: word aligned outgoing/incoming channel info * @info_word: word aligned outgoing/incoming channel info
* @tx_lock: lock to make writes to the channel mutually exclusive * @tx_lock: lock to make writes to the channel mutually exclusive
...@@ -187,6 +193,7 @@ struct qcom_smd_endpoint { ...@@ -187,6 +193,7 @@ struct qcom_smd_endpoint {
* @cb: callback function registered for this channel * @cb: callback function registered for this channel
* @recv_lock: guard for rx info modifications and cb pointer * @recv_lock: guard for rx info modifications and cb pointer
* @pkt_size: size of the currently handled packet * @pkt_size: size of the currently handled packet
* @drvdata: driver private data
* @list: lite entry for @channels in qcom_smd_edge * @list: lite entry for @channels in qcom_smd_edge
*/ */
struct qcom_smd_channel { struct qcom_smd_channel {
...@@ -726,6 +733,7 @@ static int qcom_smd_write_fifo(struct qcom_smd_channel *channel, ...@@ -726,6 +733,7 @@ static int qcom_smd_write_fifo(struct qcom_smd_channel *channel,
* @channel: channel handle * @channel: channel handle
* @data: buffer of data to write * @data: buffer of data to write
* @len: number of bytes to write * @len: number of bytes to write
* @wait: flag to indicate if write has ca wait
* *
* This is a blocking write of len bytes into the channel's tx ring buffer and * This is a blocking write of len bytes into the channel's tx ring buffer and
* signal the remote end. It will sleep until there is enough space available * signal the remote end. It will sleep until there is enough space available
......
...@@ -285,6 +285,7 @@ static const struct file_operations rpmsg_eptdev_fops = { ...@@ -285,6 +285,7 @@ static const struct file_operations rpmsg_eptdev_fops = {
.write = rpmsg_eptdev_write, .write = rpmsg_eptdev_write,
.poll = rpmsg_eptdev_poll, .poll = rpmsg_eptdev_poll,
.unlocked_ioctl = rpmsg_eptdev_ioctl, .unlocked_ioctl = rpmsg_eptdev_ioctl,
.compat_ioctl = rpmsg_eptdev_ioctl,
}; };
static ssize_t name_show(struct device *dev, struct device_attribute *attr, static ssize_t name_show(struct device *dev, struct device_attribute *attr,
...@@ -445,6 +446,7 @@ static const struct file_operations rpmsg_ctrldev_fops = { ...@@ -445,6 +446,7 @@ static const struct file_operations rpmsg_ctrldev_fops = {
.open = rpmsg_ctrldev_open, .open = rpmsg_ctrldev_open,
.release = rpmsg_ctrldev_release, .release = rpmsg_ctrldev_release,
.unlocked_ioctl = rpmsg_ctrldev_ioctl, .unlocked_ioctl = rpmsg_ctrldev_ioctl,
.compat_ioctl = rpmsg_ctrldev_ioctl,
}; };
static void rpmsg_ctrldev_release_device(struct device *dev) static void rpmsg_ctrldev_release_device(struct device *dev)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/rpmsg.h> #include <linux/rpmsg.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/pm_domain.h>
#include <linux/slab.h> #include <linux/slab.h>
#include "rpmsg_internal.h" #include "rpmsg_internal.h"
...@@ -449,6 +450,10 @@ static int rpmsg_dev_probe(struct device *dev) ...@@ -449,6 +450,10 @@ static int rpmsg_dev_probe(struct device *dev)
struct rpmsg_endpoint *ept = NULL; struct rpmsg_endpoint *ept = NULL;
int err; int err;
err = dev_pm_domain_attach(dev, true);
if (err)
goto out;
if (rpdrv->callback) { if (rpdrv->callback) {
strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE); strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE);
chinfo.src = rpdev->src; chinfo.src = rpdev->src;
...@@ -490,6 +495,8 @@ static int rpmsg_dev_remove(struct device *dev) ...@@ -490,6 +495,8 @@ static int rpmsg_dev_remove(struct device *dev)
rpdrv->remove(rpdev); rpdrv->remove(rpdev);
dev_pm_domain_detach(dev, true);
if (rpdev->ept) if (rpdev->ept)
rpmsg_destroy_ept(rpdev->ept); rpmsg_destroy_ept(rpdev->ept);
......
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