Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1465106
| From | Neil Armstrong <narmstrong@baylibre.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 08/13] scpi: add a vendor_msg mechanism in case the mailbox message differs |
| Date | 2016-08-18 12:20 +0200 |
| Message-ID | <s7sAz-6Nh-57@gated-at.bofh.it> (permalink) |
| References | <s7sAx-6Nh-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/13] scpi: Add support for legacy SCPI protocol Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
[PATCH 06/13] scpi: add priv_scpi_ops and fill legacy structure Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
Re: [PATCH 06/13] scpi: add priv_scpi_ops and fill legacy structure Sudeep Holla <sudeep.holla@arm.com> - 2016-08-19 18:50 +0200
Re: [PATCH 06/13] scpi: add priv_scpi_ops and fill legacy structure Neil Armstrong <narmstrong@baylibre.com> - 2016-08-23 10:30 +0200
Re: [PATCH 06/13] scpi: add priv_scpi_ops and fill legacy structure Sudeep Holla <sudeep.holla@arm.com> - 2016-08-23 17:00 +0200
[PATCH 04/13] scpi: Add legacy SCP functions calling legacy_scpi_send_message Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
Re: [PATCH 04/13] scpi: Add legacy SCP functions calling legacy_scpi_send_message Sudeep Holla <sudeep.holla@arm.com> - 2016-08-19 18:30 +0200
Re: [PATCH 04/13] scpi: Add legacy SCP functions calling legacy_scpi_send_message Neil Armstrong <narmstrong@baylibre.com> - 2016-08-23 10:20 +0200
Re: [PATCH 04/13] scpi: Add legacy SCP functions calling legacy_scpi_send_message Sudeep Holla <sudeep.holla@arm.com> - 2016-08-23 16:50 +0200
[PATCH 09/13] scpi: implement rockchip support via the vendor_msg mechanism Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
[PATCH 01/13] scpi: Add vendor_send_message to enable access to vendor commands Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
Re: [PATCH 01/13] scpi: Add vendor_send_message to enable access to vendor commands Sudeep Holla <sudeep.holla@arm.com> - 2016-08-19 03:30 +0200
Re: [PATCH 01/13] scpi: Add vendor_send_message to enable access to vendor commands Neil Armstrong <narmstrong@baylibre.com> - 2016-08-19 10:10 +0200
Re: [PATCH 01/13] scpi: Add vendor_send_message to enable access to vendor commands Sudeep Holla <sudeep.holla@arm.com> - 2016-08-19 12:40 +0200
[PATCH 11/13] dt-bindings: Add support for Amlogic GXBB SCPI Interface Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
Re: [PATCH 11/13] dt-bindings: Add support for Amlogic GXBB SCPI Interface Rob Herring <robh@kernel.org> - 2016-08-19 15:50 +0200
[PATCH 08/13] scpi: add a vendor_msg mechanism in case the mailbox message differs Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
Re: [PATCH 08/13] scpi: add a vendor_msg mechanism in case the mailbox message differs Sudeep Holla <sudeep.holla@arm.com> - 2016-08-19 18:50 +0200
[PATCH 07/13] scpi: ignore init_versions failure if reported not supported Neil Armstrong <narmstrong@baylibre.com> - 2016-08-18 12:20 +0200
Re: [PATCH 07/13] scpi: ignore init_versions failure if reported not supported Sudeep Holla <sudeep.holla@arm.com> - 2016-08-19 18:50 +0200
Re: [PATCH 07/13] scpi: ignore init_versions failure if reported not supported Neil Armstrong <narmstrong@baylibre.com> - 2016-08-23 10:30 +0200
Re: [PATCH 07/13] scpi: ignore init_versions failure if reported not supported Sudeep Holla <sudeep.holla@arm.com> - 2016-08-23 17:00 +0200
Re: [PATCH 07/13] scpi: ignore init_versions failure if reported not supported Sudeep Holla <sudeep.holla@arm.com> - 2016-08-23 17:10 +0200
Re: [PATCH 07/13] scpi: ignore init_versions failure if reported not supported Neil Armstrong <narmstrong@baylibre.com> - 2016-08-23 17:10 +0200
csiph-web