greybus: hd: Add TimeSync APBridge commands
This patch adds a number of USB Vendor commands to es2.c to enable TimeSync
in the bridge.
Adds:
- es2.c::timesync_enable(u8 count, u64 frame_time, u32 strobe_delay,
u32 refclk);
Commands APBx to enable timers and clocks to track a pulse-train of
incoming TIME_SYNC strobes with strobe_delay microseconds between each.
Provides the reference clock the AP is using to track FrameTime. It is
the responsibility of APBx to adequately track the FrameTime based on
the indicated AP refclk. Once this command has succeeded APBx may not
transition to a low-power state were FrameTime counters stop.
This function is initiated from the timesync worker thread logic when
re-synchronizing frame-time throughout the system.
TimeSync is at this time enabled for all APBx active in the system i.e.
currently APB2 will not receive TimeSync commands until it becomes a
registered host-device in Greybus.
- es2.c::timesync_disable(void)
Commands APBx to discontinue tracking of FrameTime. After this operation
completes APBx may transition to a low-power state where timer-clocks
stop operating.
- es2.c::timesync_authoritative(u64 *frame_time)
Provides an authoritative time for each TIME_SYNC strobe to APBx.
APBx must align its local FrameTime to the authoritative clock.
- es2.c::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>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>