summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/svc.c
diff options
context:
space:
mode:
authorJeffrey Carlyle <jcarlyle@google.com>2016-05-06 12:43:53 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-05-09 08:47:18 +0200
commit140026b32f953593eb8678d67fcc95534efe1b49 (patch)
tree3b9a52bd6cede5e9cb4eb5b65444a5150d820ca4 /drivers/staging/greybus/svc.c
parent144763bf8efd8bfc6b0c582fdf3f77564fc0296f (diff)
greybus: svc: implement svc_intf_activate
With upcoming firmware changes we will switch from an SVC-driven module boot sequence to an AP-driven module sequence. This operation allows the AP to request the SVC to boot a module to which the AP has previouslt requested power be applied. This operation will also determine if the remote interface is a dummy module, UniPro-only module, or full Greybus module. Testing done: Tested together with "new" firmware boot sequence to verify that modules are detected and booted as expected. Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/svc.c')
-rw-r--r--drivers/staging/greybus/svc.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c
index 1e6cab0173c4..a98593c0a39b 100644
--- a/drivers/staging/greybus/svc.c
+++ b/drivers/staging/greybus/svc.c
@@ -15,7 +15,8 @@
#define SVC_KEY_ARA_BUTTON KEY_A
-#define SVC_INTF_EJECT_TIMEOUT 9000
+#define SVC_INTF_EJECT_TIMEOUT 9000
+#define SVC_INTF_ACTIVATE_TIMEOUT 6000
struct gb_svc_deferred_request {
struct work_struct work;
@@ -326,9 +327,21 @@ int gb_svc_intf_unipro_set(struct gb_svc *svc, u8 intf_id, bool enable)
int gb_svc_intf_activate(struct gb_svc *svc, u8 intf_id, u8 *intf_type)
{
- /* FIXME: implement */
+ struct gb_svc_intf_activate_request request;
+ struct gb_svc_intf_activate_response response;
+ int ret;
+
+ request.intf_id = intf_id;
+
+ ret = gb_operation_sync_timeout(svc->connection,
+ GB_SVC_TYPE_INTF_ACTIVATE,
+ &request, sizeof(request),
+ &response, sizeof(response),
+ SVC_INTF_ACTIVATE_TIMEOUT);
+ if (ret < 0)
+ return ret;
- *intf_type = GB_SVC_INTF_TYPE_GREYBUS;
+ *intf_type = response.intf_type;
return 0;
}