diff options
Diffstat (limited to 'drivers/staging/greybus/control.c')
-rw-r--r-- | drivers/staging/greybus/control.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/staging/greybus/control.c b/drivers/staging/greybus/control.c index ba2754a..bac412ef 100644 --- a/drivers/staging/greybus/control.c +++ b/drivers/staging/greybus/control.c @@ -241,3 +241,39 @@ void gb_control_destroy(struct gb_control *control) gb_connection_destroy(control->connection); kfree(control); } + +int gb_control_timesync_enable(struct gb_control *control, u8 count, + u64 frame_time, u32 strobe_delay, u32 refclk) +{ + struct gb_control_timesync_enable_request request; + + request.count = count; + request.frame_time = cpu_to_le64(frame_time); + request.strobe_delay = cpu_to_le32(strobe_delay); + request.refclk = cpu_to_le32(refclk); + return gb_operation_sync(control->connection, + GB_CONTROL_TYPE_TIMESYNC_ENABLE, &request, + sizeof(request), NULL, 0); +} + +int gb_control_timesync_disable(struct gb_control *control) +{ + return gb_operation_sync(control->connection, + GB_CONTROL_TYPE_TIMESYNC_DISABLE, NULL, 0, + NULL, 0); +} + +int gb_control_timesync_authoritative(struct gb_control *control, + u64 *frame_time, u8 count) +{ + struct gb_control_timesync_authoritative_request request; + int i; + + for (i = 0; i < GB_TIMESYNC_MAX_STROBES; i++) + request.frame_time[i] = frame_time[i]; + + return gb_operation_sync(control->connection, + GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE, + &request, sizeof(request), + NULL, 0); +} |