summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/control.c
diff options
context:
space:
mode:
authorDavid Lin <dtwlin@google.com>2016-07-07 22:07:00 -0500
committerAlex Elder <elder@linaro.org>2016-07-08 14:56:28 -0500
commit385227fce67959a1ab2094fdc9afb78ac19a0dfe (patch)
tree58fa97753e0262d09faef9d96f16ca04dbb937ab /drivers/staging/greybus/control.c
parent30ea26bdd403396c62d6c9fa26477ca1f7af5676 (diff)
greybus: control: add interface hibernate abort operation
Add the AP implementation for the Greybus Control Hibernate Abort Operation. AP may use this Operation to abort a previous Control Interface Suspend or Control Interface Deactivate Prepare Operation. Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/staging/greybus/control.c')
-rw-r--r--drivers/staging/greybus/control.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/staging/greybus/control.c b/drivers/staging/greybus/control.c
index a1c78fc68509..55bb465e16f1 100644
--- a/drivers/staging/greybus/control.c
+++ b/drivers/staging/greybus/control.c
@@ -406,6 +406,30 @@ int gb_control_interface_deactivate_prepare(struct gb_control *control)
return 0;
}
+int gb_control_interface_hibernate_abort(struct gb_control *control)
+{
+ struct gb_control_intf_pm_response response;
+ int ret;
+
+ ret = gb_operation_sync(control->connection,
+ GB_CONTROL_TYPE_INTF_HIBERNATE_ABORT, NULL, 0,
+ &response, sizeof(response));
+ if (ret) {
+ dev_err(&control->dev,
+ "failed to send interface aborting hibernate: %d\n",
+ ret);
+ return ret;
+ }
+
+ if (response.status != GB_CONTROL_INTF_PM_OK) {
+ dev_err(&control->dev, "interface error while aborting hibernate: %d\n",
+ response.status);
+ return gb_control_interface_pm_status_map(response.status);
+ }
+
+ return 0;
+}
+
static ssize_t vendor_string_show(struct device *dev,
struct device_attribute *attr, char *buf)
{