summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/es2.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-08-10 12:58:42 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2016-08-11 14:13:07 +0200
commita9dc1cf5b7b5ce8183249c2229ae0ab849525e37 (patch)
treeaef720d6ecae783f888b57fae29172108ad7f33a /drivers/staging/greybus/es2.c
parentb3136a77a49026c2f393e8ad6c99e3b5514d1e5a (diff)
greybus: hd/es2: add cport_connected callback and ARPC
Add a host-device cport_connected callback, which will be called after a connection has been created and that can be used by the host-device driver to make sure its internal state is updated to match the CPort attributes set by the SVC. This callback will eventually replace the cport_features_enable callback. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/es2.c')
-rw-r--r--drivers/staging/greybus/es2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index 955b37d0c4c6..9af9b73818f4 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -746,6 +746,25 @@ static int cport_disable(struct gb_host_device *hd, u16 cport_id)
return 0;
}
+static int es2_cport_connected(struct gb_host_device *hd, u16 cport_id)
+{
+ struct es2_ap_dev *es2 = hd_to_es2(hd);
+ struct device *dev = &es2->usb_dev->dev;
+ struct arpc_cport_connected_req req;
+ int ret;
+
+ req.cport_id = cpu_to_le16(cport_id);
+ ret = arpc_sync(es2, ARPC_TYPE_CPORT_CONNECTED, &req, sizeof(req),
+ NULL, ES2_ARPC_CPORT_TIMEOUT);
+ if (ret) {
+ dev_err(dev, "failed to set connected state for cport %u: %d\n",
+ cport_id, ret);
+ return ret;
+ }
+
+ return 0;
+}
+
static int latency_tag_enable(struct gb_host_device *hd, u16 cport_id)
{
int retval;
@@ -930,6 +949,7 @@ static struct gb_hd_driver es2_driver = {
.cport_release = es2_cport_release,
.cport_enable = cport_enable,
.cport_disable = cport_disable,
+ .cport_connected = es2_cport_connected,
.latency_tag_enable = latency_tag_enable,
.latency_tag_disable = latency_tag_disable,
.output = output,