From: Neil Armstrong <narmstrong@baylibre.com>
To: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, sudeep.holla@arm.com
Cc: Neil Armstrong <narmstrong@baylibre.com>,
linux-amlogic@lists.infradead.org, khilman@baylibre.com,
heiko@sntech.de, wxt@rock-chips.com, frank.wang@rock-chips.com
Subject: [PATCH 08/13] scpi: add a vendor_msg mechanism in case the mailbox message differs
Date: Thu, 18 Aug 2016 12:11:01 +0200 [thread overview]
Message-ID: <1471515066-3626-9-git-send-email-narmstrong@baylibre.com> (raw)
In-Reply-To: <1471515066-3626-1-git-send-email-narmstrong@baylibre.com>
In case the mailbox message pointer must contain a specific structure.
add a mechanism to override the pointer sent to the mailbox by a
vendor specific data initialized by a vendor speficic function.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/firmware/arm_scpi.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
index d3be4c5..275feef 100644
--- a/drivers/firmware/arm_scpi.c
+++ b/drivers/firmware/arm_scpi.c
@@ -189,6 +189,7 @@ struct scpi_xfer {
unsigned int rx_len;
struct list_head node;
struct completion done;
+ void *vendor_msg;
};
struct scpi_chan {
@@ -203,6 +204,7 @@ struct scpi_chan {
struct mutex xfers_lock;
u8 token;
struct scpi_xfer *t;
+ void *vendor_data;
};
struct scpi_drvinfo {
@@ -302,6 +304,8 @@ struct dev_pstate_set {
struct priv_scpi_ops {
/* Internal Specific Ops */
+ int (*init)(struct device *dev, struct scpi_chan *chan);
+ int (*prepare)(struct scpi_chan *chan);
void (*handle_remote_msg)(struct mbox_client *c, void *msg);
void (*tx_prepare)(struct mbox_client *c, void *msg);
/* Message Specific Ops */
@@ -498,7 +502,18 @@ static int legacy_scpi_send_message(u8 cmd, void *tx_buf, unsigned int tx_len,
init_completion(&msg->done);
scpi_chan->t = msg;
- ret = mbox_send_message(scpi_chan->chan, &msg->cmd);
+ /* Call the prepare hook to eventually set the vendor_msg */
+ if (scpi_info->ops &&
+ scpi_info->ops->prepare) {
+ ret = scpi_info->ops->prepare(scpi_chan);
+ if (ret) {
+ mutex_unlock(&scpi_chan->xfers_lock);
+ return ret;
+ }
+ } else
+ msg->vendor_msg = &msg->cmd;
+
+ ret = mbox_send_message(scpi_chan->chan, msg->vendor_msg);
if (ret < 0)
goto out;
@@ -1069,6 +1084,12 @@ static int scpi_probe(struct platform_device *pdev)
}
pchan->tx_payload = pchan->rx_payload + (size >> 1);
+ if (scpi_info->ops && scpi_info->ops->init) {
+ ret = scpi_info->ops->init(dev, pchan);
+ if (ret)
+ goto err;
+ }
+
cl->dev = dev;
if (scpi_info->ops && scpi_info->ops->handle_remote_msg)
cl->rx_callback = scpi_info->ops->handle_remote_msg;
--
1.9.1
next prev parent reply other threads:[~2016-08-18 10:12 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 10:10 [PATCH 00/13] scpi: Add support for legacy SCPI protocol Neil Armstrong
2016-08-18 10:10 ` [PATCH 01/13] scpi: Add vendor_send_message to enable access to vendor commands Neil Armstrong
2016-08-18 15:53 ` Sudeep Holla
2016-08-19 8:00 ` Neil Armstrong
2016-08-19 10:39 ` Sudeep Holla
2016-08-18 10:10 ` [PATCH 02/13] scpi: Add alternative legacy structures and macros Neil Armstrong
2016-08-18 17:16 ` Sudeep Holla
2016-08-23 8:09 ` Neil Armstrong
2016-08-18 10:10 ` [PATCH 03/13] scpi: Add legacy send, prepare and handle remote functions Neil Armstrong
2016-08-19 16:13 ` Sudeep Holla
2016-08-23 8:15 ` Neil Armstrong
2016-08-23 14:42 ` Sudeep Holla
2016-08-18 10:10 ` [PATCH 04/13] scpi: Add legacy SCP functions calling legacy_scpi_send_message Neil Armstrong
2016-08-19 16:22 ` Sudeep Holla
2016-08-23 8:19 ` Neil Armstrong
2016-08-23 14:47 ` Sudeep Holla
2016-08-18 10:10 ` [PATCH 05/13] scpi: move of_match table before probe functions Neil Armstrong
2016-08-19 16:24 ` Sudeep Holla
2016-08-23 8:20 ` Neil Armstrong
2016-08-18 10:10 ` [PATCH 06/13] scpi: add priv_scpi_ops and fill legacy structure Neil Armstrong
2016-08-19 16:39 ` Sudeep Holla
2016-08-23 8:22 ` Neil Armstrong
2016-08-23 14:50 ` Sudeep Holla
2016-08-18 10:11 ` [PATCH 07/13] scpi: ignore init_versions failure if reported not supported Neil Armstrong
2016-08-19 16:46 ` Sudeep Holla
2016-08-23 8:23 ` Neil Armstrong
2016-08-23 14:54 ` Sudeep Holla
2016-08-23 14:55 ` Neil Armstrong
2016-08-23 15:01 ` Sudeep Holla
2016-08-18 10:11 ` Neil Armstrong [this message]
2016-08-19 16:47 ` [PATCH 08/13] scpi: add a vendor_msg mechanism in case the mailbox message differs Sudeep Holla
2016-08-18 10:11 ` [PATCH 09/13] scpi: implement rockchip support via the vendor_msg mechanism Neil Armstrong
2016-08-18 10:11 ` [PATCH 10/13] scpi: grow MAX_DVFS_OPPS to 16 entries Neil Armstrong
2016-08-18 10:11 ` [PATCH 11/13] dt-bindings: Add support for Amlogic GXBB SCPI Interface Neil Armstrong
2016-08-19 13:45 ` Rob Herring
2016-08-18 10:11 ` [PATCH 12/13] ARM64: dts: meson-gxbb: Add SRAM node Neil Armstrong
2016-08-18 10:11 ` [PATCH 13/13] ARM64: dts: meson-gxbb: Add SCPI with cpufreq & sensors Nodes Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471515066-3626-9-git-send-email-narmstrong@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=frank.wang@rock-chips.com \
--cc=heiko@sntech.de \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=wxt@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).