]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
greybus: control: Add TimeSync get-last-event logic
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Thu, 12 May 2016 11:43:51 +0000 (12:43 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 14 May 2016 16:26:24 +0000 (18:26 +0200)
gb_control_timesync_get_last_event() sends a request asking for the
FrameTime at the last SVC strobe event. The responding entity returns the
FrameTime in the response phase of the request. Performing this operation
to an Interface after previously:

1. Synchronizing time using timesync-enable/timesync-authoritative
2. Sending an SVC_TIMESYNC_PING

will return the FrameTime of the responding entity at the SVC-ping. If
this command is sent before synchronization has been initiated or
successfully completed the responding entity should return an error
code.

- control.c::gb_control_timesync_get_last_event(u64 *frame_time)
  Returns the FrameTime at the last SVC_TIMESYNC_PING to the AP Module.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/control.c
drivers/staging/greybus/control.h
drivers/staging/greybus/greybus_protocols.h

index 13c68f3f01debc645d904e08a9f789d3d78dc879..7a838068c1adde500bff616b391d5df3f6c715c9 100644 (file)
@@ -177,6 +177,20 @@ int gb_control_timesync_disable(struct gb_control *control)
                                 NULL, 0);
 }
 
+int gb_control_timesync_get_last_event(struct gb_control *control,
+                                      u64 *frame_time)
+{
+       struct gb_control_timesync_get_last_event_response response;
+       int ret;
+
+       ret = gb_operation_sync(control->connection,
+                               GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT,
+                               NULL, 0, &response, sizeof(response));
+       if (!ret)
+               *frame_time = le64_to_cpu(response.frame_time);
+       return ret;
+}
+
 int gb_control_timesync_authoritative(struct gb_control *control,
                                      u64 *frame_time, u8 count)
 {
index 773cdde4dc44d0ad6ce8dae70cbfcaa9507912ae..02b5839010292c541c5fdd93b0ebd01d7b65d206 100644 (file)
@@ -43,6 +43,8 @@ int gb_control_get_manifest_operation(struct gb_interface *intf, void *manifest,
 int gb_control_timesync_enable(struct gb_control *control, u8 count,
                               u64 frame_time, u32 strobe_delay, u32 refclk);
 int gb_control_timesync_disable(struct gb_control *control);
+int gb_control_timesync_get_last_event(struct gb_control *control,
+                                      u64 *frame_time);
 int gb_control_timesync_authoritative(struct gb_control *control,
                                      u64 *frame_time, u8 count);
 
index ca5eb3b580aae764b2c4b727d191fe30fa9b8ff8..40bd6c0a4a629880b7c4948110dd1c8eb4cbeabd 100644 (file)
@@ -123,6 +123,7 @@ struct gb_protocol_version_response {
 #define GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE 0x09
 /*     Unused                                  0x0a */
 #define GB_CONTROL_TYPE_BUNDLE_VERSION         0x0b
+#define GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT        0x0d
 #define GB_CONTROL_TYPE_MODE_SWITCH            0x0e
 
 struct gb_control_version_request {
@@ -179,6 +180,11 @@ struct gb_control_timesync_authoritative_request {
 } __packed;
 /* timesync authoritative response has no payload */
 
+/* timesync get_last_event_request has no payload */
+struct gb_control_timesync_get_last_event_response {
+       __le64  frame_time;
+} __packed;
+
 /* APBridge protocol */
 
 /* request APB1 log */