Recently the Linux kernel's PTP Hardware Clock interface was expanded
to include a "write phase" mode where the clock servo in implemented
in hardware. This mode hearkens back to the tradition ntp_adjtime
interface, passing a measured offset into the kernel's servo.
This patch adds a new configuration option and logic to support the
write phase mode.
Because the hardware's adjustment bandwidth may be limited, this mode
is only activated when the servo reaches SERVO_LOCKED_STABLE state, in
order to achieve reasonably fast locking times. Users may control the
SERVO_LOCKED_STABLE state by configuring 'servo_offset_threshold' and
'servo_num_offset_values' accordingly.
Example configuration file highlights:
unicast_listen 1
logSyncInterval 0
logMinDelayReqInterval 0
first_step_threshold 0.001000000
step_threshold 0
clock_servo pi
write_phase_mode 1
servo_offset_threshold 50
servo_num_offset_values 10
tsproc_mode raw
Signed-off-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This novel use of the STA_UNSYNC flag breaks with the established,
traditional meaning of that flag, which is:
The clock has is believed to have an error larger than 16 seconds.
This reverts commit 944f5f7ac6.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
In case there is no connection to the server, notify the kernel
that the clock is currently unsynchronized.
Signed-off-by: Ville Heikkinen <ville.heikkinen@nokia.com>
I have reduced the requirements for the -p option to accept
any type of device. With this it should be possible to use
ptp4l to syncronize any clock device that implements the kernel
POSIX clock interface.
[ RC - Initialize struct timex. ]
Signed-off-by: Dimitrios Katsaros <patcherwork@gmail.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
When synchronizing the system clock and the PTP UTC offset is valid and
traceable, set the TAI offset of the clock to have correct CLOCK_TAI
(which is implemented in the kernel as CLOCK_REALTIME + TAI offset).
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Reset the STA_UNSYNC flag and maxerror value with every frequency update
to let the kernel synchronize the RTC to the system clock (11 minute mode).
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The clockid parameter to the function to get the system clock's maximum
adjustment is redundant, so let us just remove it.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Update the currentUtcOffset and leap61/59 values at one minute
interval. When a leap second is detected, set the STA_INS/STA_DEL
bit for the system clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>