diff options
author | Bryan O'Donoghue <bryan.odonoghue@linaro.org> | 2016-03-02 16:51:10 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-03-03 15:22:52 -0800 |
commit | 8fd9466b8c324bc87c5db58a46c33731d1ea50bf (patch) | |
tree | cbc9ebcccfe0af736ca35a99c0ffa4f0c6dccf6c /drivers | |
parent | 0bd39ca4898fb554bcba28c82f425cc6c88180b9 (diff) | |
download | op-kernel-dev-8fd9466b8c324bc87c5db58a46c33731d1ea50bf.zip op-kernel-dev-8fd9466b8c324bc87c5db58a46c33731d1ea50bf.tar.gz |
greybus: control: Add TimeSync control commands
Simple addition of the TimeSync commands defined in the specification.
Note for the case of timesync_authoritative we're passing the request
structure directly so as not to have to pass eight parameters into the
function.
Adds:
- control.c::timesync_enable(u8 count, u64 frame_time,
u32 strobe_delay, u32 refclk)
Informs an Interface to expect count TimeSync strobe pulses with
strobe_delay milliseconds delay between each strobe. Once enabled
an Interface may not enter a low-power mode which will result in the
reference timer used to track time switching off.
- control.c::timesync_disable(void)
Commands an Interface to immediately halt TimeSync logic. This will allow
an Interface to transition into low-power modes where the reference time
being used for TimeSync may switch off.
- control.c::timesync_authoritative(u64 *frame_time, u8 count)
Used by the AP Module to inform an Interface of the authoritative
TimeSync clock-master time at each strobe pulse. Down-stream clock slaves
shall adjust their local frame-time appropriately based on the
diseminated authoritative frame-time.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/greybus/control.c | 36 | ||||
-rw-r--r-- | drivers/staging/greybus/control.h | 5 |
2 files changed, 41 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); +} diff --git a/drivers/staging/greybus/control.h b/drivers/staging/greybus/control.h index d31e7c6..949f1a3 100644 --- a/drivers/staging/greybus/control.h +++ b/drivers/staging/greybus/control.h @@ -31,5 +31,10 @@ int gb_control_get_manifest_size_operation(struct gb_interface *intf); int gb_control_get_manifest_operation(struct gb_interface *intf, void *manifest, size_t size); int gb_control_get_interface_version_operation(struct gb_interface *intf); +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_authoritative(struct gb_control *control, + u64 *frame_time, u8 count); #endif /* __CONTROL_H */ |