greybus: bundle: add activate and deactivate

AP shall send the Bundle Activate Operation to power on a bundle, and
send the Bundle Deactivate Request after closing all the associated
connections for power down.

Testing Done:
 - Check for the return code of the bundle activate and deactivate
  operation sent

Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Alex Elder <elder@linaro.org>
This commit is contained in:
David Lin 2016-07-14 15:13:00 -05:00 committed by Alex Elder
parent 165a74ab14
commit 2d48b5b4a8
1 changed files with 12 additions and 0 deletions

View File

@ -162,6 +162,13 @@ static int greybus_probe(struct device *dev)
if (!id)
return -ENODEV;
/*
* FIXME: We need to perform error handling on bundle activate call
* below when firmware is ready. We just allow the activate operation to
* fail for now since bundle may be in active already.
*/
gb_control_bundle_activate(bundle->intf->control, bundle->id);
retval = driver->probe(bundle, id);
if (retval) {
/*
@ -169,6 +176,8 @@ static int greybus_probe(struct device *dev)
*/
WARN_ON(!list_empty(&bundle->connections));
gb_control_bundle_deactivate(bundle->intf->control, bundle->id);
return retval;
}
@ -203,6 +212,9 @@ static int greybus_remove(struct device *dev)
/* Catch buggy drivers that fail to destroy their connections. */
WARN_ON(!list_empty(&bundle->connections));
if (!bundle->intf->disconnected)
gb_control_bundle_deactivate(bundle->intf->control, bundle->id);
return 0;
}