aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-18 19:43:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-18 19:43:57 -0400
commit9a96d63aa83c629e0c71f377fea7066fcf66d765 (patch)
treea4e412082af999004018a4087625acec2891b10f
parentc54fc8658b501b412d006886ebe3e8543a30a122 (diff)
parent00b645e0b4e4a3e5f8d88a4e9acf7e80045c34b4 (diff)
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
-rw-r--r--Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt5
-rw-r--r--drivers/rpmsg/qcom_glink_native.c51
-rw-r--r--drivers/rpmsg/qcom_smd.c10
-rw-r--r--drivers/rpmsg/rpmsg_char.c2
-rw-r--r--drivers/rpmsg/rpmsg_core.c7
5 files changed, 53 insertions, 22 deletions
diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
index 9663cab52246..0b8cc533ca83 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt
@@ -10,6 +10,11 @@ edge.
10 Value type: <stringlist> 10 Value type: <stringlist>
11 Definition: must be "qcom,glink-rpm" 11 Definition: must be "qcom,glink-rpm"
12 12
13- label:
14 Usage: optional
15 Value type: <string>
16 Definition: should specify the subsystem name this edge corresponds to.
17
13- interrupts: 18- interrupts:
14 Usage: required 19 Usage: required
15 Value type: <prop-encoded-array> 20 Value type: <prop-encoded-array>
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index f505f58b797d..e2ce4e638258 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -40,7 +40,7 @@ struct glink_msg {
40 * struct glink_defer_cmd - deferred incoming control message 40 * struct glink_defer_cmd - deferred incoming control message
41 * @node: list node 41 * @node: list node
42 * @msg: message header 42 * @msg: message header
43 * data: payload of the message 43 * @data: payload of the message
44 * 44 *
45 * Copy of a received control message, to be added to @rx_queue and processed 45 * Copy of a received control message, to be added to @rx_queue and processed
46 * by @rx_work of @qcom_glink. 46 * by @rx_work of @qcom_glink.
@@ -56,12 +56,13 @@ struct glink_defer_cmd {
56 * struct glink_core_rx_intent - RX intent 56 * struct glink_core_rx_intent - RX intent
57 * RX intent 57 * RX intent
58 * 58 *
59 * data: pointer to the data (may be NULL for zero-copy) 59 * @data: pointer to the data (may be NULL for zero-copy)
60 * id: remote or local intent ID 60 * @id: remote or local intent ID
61 * size: size of the original intent (do not modify) 61 * @size: size of the original intent (do not modify)
62 * reuse: To mark if the intent can be reused after first use 62 * @reuse: To mark if the intent can be reused after first use
63 * in_use: To mark if intent is already in use for the channel 63 * @in_use: To mark if intent is already in use for the channel
64 * offset: next write offset (initially 0) 64 * @offset: next write offset (initially 0)
65 * @node: list node
65 */ 66 */
66struct glink_core_rx_intent { 67struct glink_core_rx_intent {
67 void *data; 68 void *data;
@@ -89,10 +90,14 @@ struct glink_core_rx_intent {
89 * @idr_lock: synchronizes @lcids and @rcids modifications 90 * @idr_lock: synchronizes @lcids and @rcids modifications
90 * @lcids: idr of all channels with a known local channel id 91 * @lcids: idr of all channels with a known local channel id
91 * @rcids: idr of all channels with a known remote channel id 92 * @rcids: idr of all channels with a known remote channel id
93 * @features: remote features
94 * @intentless: flag to indicate that there is no intent
92 */ 95 */
93struct qcom_glink { 96struct qcom_glink {
94 struct device *dev; 97 struct device *dev;
95 98
99 const char *name;
100
96 struct mbox_client mbox_client; 101 struct mbox_client mbox_client;
97 struct mbox_chan *mbox_chan; 102 struct mbox_chan *mbox_chan;
98 103
@@ -512,8 +517,8 @@ static void qcom_glink_rx_done(struct qcom_glink *glink,
512 * qcom_glink_receive_version() - receive version/features from remote system 517 * qcom_glink_receive_version() - receive version/features from remote system
513 * 518 *
514 * @glink: pointer to transport interface 519 * @glink: pointer to transport interface
515 * @r_version: remote version 520 * @version: remote version
516 * @r_features: remote features 521 * @features: remote features
517 * 522 *
518 * This function is called in response to a remote-initiated version/feature 523 * This function is called in response to a remote-initiated version/feature
519 * negotiation sequence. 524 * negotiation sequence.
@@ -538,8 +543,8 @@ static void qcom_glink_receive_version(struct qcom_glink *glink,
538 * qcom_glink_receive_version_ack() - receive negotiation ack from remote system 543 * qcom_glink_receive_version_ack() - receive negotiation ack from remote system
539 * 544 *
540 * @glink: pointer to transport interface 545 * @glink: pointer to transport interface
541 * @r_version: remote version response 546 * @version: remote version response
542 * @r_features: remote features response 547 * @features: remote features response
543 * 548 *
544 * This function is called in response to a local-initiated version/feature 549 * This function is called in response to a local-initiated version/feature
545 * negotiation sequence and is the counter-offer from the remote side based 550 * 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 572
568/** 573/**
569 * qcom_glink_send_intent_req_ack() - convert an rx intent request ack cmd to 574 * qcom_glink_send_intent_req_ack() - convert an rx intent request ack cmd to
570 wire format and transmit 575 * wire format and transmit
571 * @glink: The transport to transmit on. 576 * @glink: The transport to transmit on.
572 * @channel: The glink channel 577 * @channel: The glink channel
573 * @granted: The request response to encode. 578 * @granted: The request response to encode.
@@ -594,7 +599,7 @@ static int qcom_glink_send_intent_req_ack(struct qcom_glink *glink,
594 * transmit 599 * transmit
595 * @glink: The transport to transmit on. 600 * @glink: The transport to transmit on.
596 * @channel: The local channel 601 * @channel: The local channel
597 * @size: The intent to pass on to remote. 602 * @intent: The intent to pass on to remote.
598 * 603 *
599 * Return: 0 on success or standard Linux error code. 604 * Return: 0 on success or standard Linux error code.
600 */ 605 */
@@ -603,11 +608,11 @@ static int qcom_glink_advertise_intent(struct qcom_glink *glink,
603 struct glink_core_rx_intent *intent) 608 struct glink_core_rx_intent *intent)
604{ 609{
605 struct command { 610 struct command {
606 u16 id; 611 __le16 id;
607 u16 lcid; 612 __le16 lcid;
608 u32 count; 613 __le32 count;
609 u32 size; 614 __le32 size;
610 u32 liid; 615 __le32 liid;
611 } __packed; 616 } __packed;
612 struct command cmd; 617 struct command cmd;
613 618
@@ -698,9 +703,9 @@ static void qcom_glink_handle_rx_done(struct qcom_glink *glink,
698/** 703/**
699 * qcom_glink_handle_intent_req() - Receive a request for rx_intent 704 * qcom_glink_handle_intent_req() - Receive a request for rx_intent
700 * from remote side 705 * from remote side
701 * if_ptr: Pointer to the transport interface 706 * @glink: Pointer to the transport interface
702 * rcid: Remote channel ID 707 * @cid: Remote channel ID
703 * size: size of the intent 708 * @size: size of the intent
704 * 709 *
705 * The function searches for the local channel to which the request for 710 * The function searches for the local channel to which the request for
706 * rx_intent has arrived and allocates and notifies the remote back 711 * 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 idr_init(&glink->lcids); 1577 idr_init(&glink->lcids);
1573 idr_init(&glink->rcids); 1578 idr_init(&glink->rcids);
1574 1579
1580 ret = of_property_read_string(dev->of_node, "label", &glink->name);
1581 if (ret < 0)
1582 glink->name = dev->of_node->name;
1583
1575 glink->mbox_client.dev = dev; 1584 glink->mbox_client.dev = dev;
1576 glink->mbox_client.knows_txdone = true; 1585 glink->mbox_client.knows_txdone = true;
1577 glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0); 1586 glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0);
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 6437bbeebc91..8da83a4ebadc 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -14,6 +14,7 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/regmap.h> 15#include <linux/regmap.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/sizes.h>
17#include <linux/slab.h> 18#include <linux/slab.h>
18#include <linux/soc/qcom/smem.h> 19#include <linux/soc/qcom/smem.h>
19#include <linux/wait.h> 20#include <linux/wait.h>
@@ -93,6 +94,8 @@ static const struct {
93 94
94/** 95/**
95 * struct qcom_smd_edge - representing a remote processor 96 * struct qcom_smd_edge - representing a remote processor
97 * @dev: device associated with this edge
98 * @name: name of this edge
96 * @of_node: of_node handle for information related to this edge 99 * @of_node: of_node handle for information related to this edge
97 * @edge_id: identifier of this edge 100 * @edge_id: identifier of this edge
98 * @remote_pid: identifier of remote processor 101 * @remote_pid: identifier of remote processor
@@ -106,6 +109,7 @@ static const struct {
106 * @channels_lock: guard for modifications of @channels 109 * @channels_lock: guard for modifications of @channels
107 * @allocated: array of bitmaps representing already allocated channels 110 * @allocated: array of bitmaps representing already allocated channels
108 * @smem_available: last available amount of smem triggering a channel scan 111 * @smem_available: last available amount of smem triggering a channel scan
112 * @new_channel_event: wait queue for new channel events
109 * @scan_work: work item for discovering new channels 113 * @scan_work: work item for discovering new channels
110 * @state_work: work item for edge state changes 114 * @state_work: work item for edge state changes
111 */ 115 */
@@ -172,10 +176,12 @@ struct qcom_smd_endpoint {
172/** 176/**
173 * struct qcom_smd_channel - smd channel struct 177 * struct qcom_smd_channel - smd channel struct
174 * @edge: qcom_smd_edge this channel is living on 178 * @edge: qcom_smd_edge this channel is living on
175 * @qsdev: reference to a associated smd client device 179 * @qsept: reference to a associated smd endpoint
180 * @registered: flag to indicate if the channel is registered
176 * @name: name of the channel 181 * @name: name of the channel
177 * @state: local state of the channel 182 * @state: local state of the channel
178 * @remote_state: remote state of the channel 183 * @remote_state: remote state of the channel
184 * @state_change_event: state change event
179 * @info: byte aligned outgoing/incoming channel info 185 * @info: byte aligned outgoing/incoming channel info
180 * @info_word: word aligned outgoing/incoming channel info 186 * @info_word: word aligned outgoing/incoming channel info
181 * @tx_lock: lock to make writes to the channel mutually exclusive 187 * @tx_lock: lock to make writes to the channel mutually exclusive
@@ -187,6 +193,7 @@ struct qcom_smd_endpoint {
187 * @cb: callback function registered for this channel 193 * @cb: callback function registered for this channel
188 * @recv_lock: guard for rx info modifications and cb pointer 194 * @recv_lock: guard for rx info modifications and cb pointer
189 * @pkt_size: size of the currently handled packet 195 * @pkt_size: size of the currently handled packet
196 * @drvdata: driver private data
190 * @list: lite entry for @channels in qcom_smd_edge 197 * @list: lite entry for @channels in qcom_smd_edge
191 */ 198 */
192struct qcom_smd_channel { 199struct qcom_smd_channel {
@@ -726,6 +733,7 @@ static int qcom_smd_write_fifo(struct qcom_smd_channel *channel,
726 * @channel: channel handle 733 * @channel: channel handle
727 * @data: buffer of data to write 734 * @data: buffer of data to write
728 * @len: number of bytes to write 735 * @len: number of bytes to write
736 * @wait: flag to indicate if write has ca wait
729 * 737 *
730 * This is a blocking write of len bytes into the channel's tx ring buffer and 738 * This is a blocking write of len bytes into the channel's tx ring buffer and
731 * signal the remote end. It will sleep until there is enough space available 739 * signal the remote end. It will sleep until there is enough space available
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 76a4477c6364..a76b963a7e50 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -285,6 +285,7 @@ static const struct file_operations rpmsg_eptdev_fops = {
285 .write = rpmsg_eptdev_write, 285 .write = rpmsg_eptdev_write,
286 .poll = rpmsg_eptdev_poll, 286 .poll = rpmsg_eptdev_poll,
287 .unlocked_ioctl = rpmsg_eptdev_ioctl, 287 .unlocked_ioctl = rpmsg_eptdev_ioctl,
288 .compat_ioctl = rpmsg_eptdev_ioctl,
288}; 289};
289 290
290static ssize_t name_show(struct device *dev, struct device_attribute *attr, 291static ssize_t name_show(struct device *dev, struct device_attribute *attr,
@@ -445,6 +446,7 @@ static const struct file_operations rpmsg_ctrldev_fops = {
445 .open = rpmsg_ctrldev_open, 446 .open = rpmsg_ctrldev_open,
446 .release = rpmsg_ctrldev_release, 447 .release = rpmsg_ctrldev_release,
447 .unlocked_ioctl = rpmsg_ctrldev_ioctl, 448 .unlocked_ioctl = rpmsg_ctrldev_ioctl,
449 .compat_ioctl = rpmsg_ctrldev_ioctl,
448}; 450};
449 451
450static void rpmsg_ctrldev_release_device(struct device *dev) 452static void rpmsg_ctrldev_release_device(struct device *dev)
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index b714a543a91d..8122807db380 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/rpmsg.h> 16#include <linux/rpmsg.h>
17#include <linux/of_device.h> 17#include <linux/of_device.h>
18#include <linux/pm_domain.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19 20
20#include "rpmsg_internal.h" 21#include "rpmsg_internal.h"
@@ -449,6 +450,10 @@ static int rpmsg_dev_probe(struct device *dev)
449 struct rpmsg_endpoint *ept = NULL; 450 struct rpmsg_endpoint *ept = NULL;
450 int err; 451 int err;
451 452
453 err = dev_pm_domain_attach(dev, true);
454 if (err)
455 goto out;
456
452 if (rpdrv->callback) { 457 if (rpdrv->callback) {
453 strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE); 458 strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE);
454 chinfo.src = rpdev->src; 459 chinfo.src = rpdev->src;
@@ -490,6 +495,8 @@ static int rpmsg_dev_remove(struct device *dev)
490 495
491 rpdrv->remove(rpdev); 496 rpdrv->remove(rpdev);
492 497
498 dev_pm_domain_detach(dev, true);
499
493 if (rpdev->ept) 500 if (rpdev->ept)
494 rpmsg_destroy_ept(rpdev->ept); 501 rpmsg_destroy_ept(rpdev->ept);
495 502