]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
greybus: connection: add latency tag enable/disable callbacks
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Thu, 15 Oct 2015 15:10:42 +0000 (16:10 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 15 Oct 2015 18:31:08 +0000 (11:31 -0700)
This patch adds a layered wrapper around optional latency tag
enable/disable commands to APBridge. When set APBridge and GPBridge will
insert timing information into reserved fields in the loopback response
header. Correspondingly when unset no timing information will be included
in the response payload.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/connection.h

index 743ea67d022fb7fe7f1fbcc7fe5c7cde05d3b150..3b731dab81f0696a120437cfb02fe7b14e47c2dd 100644 (file)
@@ -527,6 +527,38 @@ void gb_connection_destroy(struct gb_connection *connection)
        device_unregister(&connection->dev);
 }
 
+void gb_connection_latency_tag_enable(struct gb_connection *connection)
+{
+       struct greybus_host_device *hd = connection->hd;
+       int ret;
+
+       if (!hd->driver->latency_tag_enable)
+               return;
+
+       ret = hd->driver->latency_tag_enable(hd, connection->hd_cport_id);
+       if (ret) {
+               dev_err(&connection->dev,
+                       "failed to enable latency tag: %d\n", ret);
+       }
+}
+EXPORT_SYMBOL_GPL(gb_connection_latency_tag_enable);
+
+void gb_connection_latency_tag_disable(struct gb_connection *connection)
+{
+       struct greybus_host_device *hd = connection->hd;
+       int ret;
+
+       if (!hd->driver->latency_tag_disable)
+               return;
+
+       ret = hd->driver->latency_tag_disable(hd, connection->hd_cport_id);
+       if (ret) {
+               dev_err(&connection->dev,
+                       "failed to disable latency tag: %d\n", ret);
+       }
+}
+EXPORT_SYMBOL_GPL(gb_connection_latency_tag_disable);
+
 void gb_hd_connections_exit(struct greybus_host_device *hd)
 {
        struct gb_connection *connection;
index 27ec5975bbe09ce144ff9a09751089fe150e9eee..2eaf186ab60e46e0d2c25796d67f6cac051cfe70 100644 (file)
@@ -66,4 +66,7 @@ void greybus_data_rcvd(struct greybus_host_device *hd, u16 cport_id,
 
 int gb_connection_bind_protocol(struct gb_connection *connection);
 
+void gb_connection_latency_tag_enable(struct gb_connection *connection);
+void gb_connection_latency_tag_disable(struct gb_connection *connection);
+
 #endif /* __CONNECTION_H */