summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/interface.c
diff options
context:
space:
mode:
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>2016-06-05 14:03:27 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-06 20:50:08 -0700
commit4a4484274f7431c68e104a66b497639e1ac9022c (patch)
treedcbfee4f8cb5700cf650f66ab84c93dffc7cc8fd /drivers/staging/greybus/interface.c
parent970dc85bd95d931def5926ae81b5aa84ef14fb7c (diff)
greybus: timesync: Bind TimeSync into Greybus
TimeSync needs to bind into Greybus in a few places. - core.c To initialize its internal state and tear-down its internal state. To schedule a timesync to a newly added Bundle after probe() completes. - svc.c To get access to the SVC and enable/disable timesync as well as extracting the authoritative time from the SVC to subsequently disseminate to other entities in the system. - interface.c To get access to an Interface in order to inform APBx of timesync enable/disable and authoritative operations. This patch adds those bindings into Greybus core. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Acked-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/interface.c')
-rw-r--r--drivers/staging/greybus/interface.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c
index 3eb8754961f1..9b90209e8fe0 100644
--- a/drivers/staging/greybus/interface.c
+++ b/drivers/staging/greybus/interface.c
@@ -805,6 +805,12 @@ int gb_interface_enable(struct gb_interface *intf)
if (ret)
goto err_destroy_bundles;
+ ret = gb_timesync_interface_add(intf);
+ if (ret) {
+ dev_err(&intf->dev, "failed to add to timesync: %d\n", ret);
+ goto err_destroy_bundles;
+ }
+
list_for_each_entry_safe_reverse(bundle, tmp, &intf->bundles, links) {
ret = gb_bundle_add(bundle);
if (ret) {
@@ -857,6 +863,7 @@ void gb_interface_disable(struct gb_interface *intf)
list_for_each_entry_safe(bundle, next, &intf->bundles, links)
gb_bundle_destroy(bundle);
+ gb_timesync_interface_remove(intf);
gb_control_del(intf->control);
gb_control_disable(intf->control);
gb_control_put(intf->control);