From 2d48b5b4a8ca12aeff6551796357add7c05ce8cf Mon Sep 17 00:00:00 2001 From: David Lin Date: Thu, 14 Jul 2016 15:13:00 -0500 Subject: [PATCH] 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 Signed-off-by: Axel Haslam Reviewed-by: Johan Hovold Signed-off-by: Alex Elder --- drivers/staging/greybus/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c index dacc49c55253..ca3bad910aae 100644 --- a/drivers/staging/greybus/core.c +++ b/drivers/staging/greybus/core.c @@ -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; } -- 2.39.5