The "free_running" configuration option is meant to allow running the software without actually adjusting the clock at all. However, both the ptp4l and the ts2phc programs set the clock frequency unconditionally on startup. This patch fixes issue by testing whether the clock is free running before setting the frequency.
Signed-off-by: Richard Cochran <richardcoch...@gmail.com> --- clock.c | 5 +++-- ts2phc_slave.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/clock.c b/clock.c index a66d189..0156bc3 100644 --- a/clock.c +++ b/clock.c @@ -1114,8 +1114,9 @@ struct clock *clock_create(enum clock_type type, struct config *config, /* Due to a bug in older kernels, the reading may silently fail and return 0. Set the frequency back to make sure fadj is the actual frequency of the clock. */ - clockadj_set_freq(c->clkid, fadj); - + if (!c->free_running) { + clockadj_set_freq(c->clkid, fadj); + } /* Disable write phase mode if not implemented by driver */ if (c->write_phase_mode && !phc_has_writephase(c->clkid)) { pr_err("clock does not support write phase mode"); diff --git a/ts2phc_slave.c b/ts2phc_slave.c index 749efe5..652d9b7 100644 --- a/ts2phc_slave.c +++ b/ts2phc_slave.c @@ -186,8 +186,9 @@ static struct ts2phc_slave *ts2phc_slave_create(struct config *cfg, const char * /* Due to a bug in older kernels, the reading may silently fail and return 0. Set the frequency back to make sure fadj is the actual frequency of the clock. */ - clockadj_set_freq(slave->clk, fadj); - + if (!slave->no_adj) { + clockadj_set_freq(slave->clk, fadj); + } max_adj = phc_max_adj(slave->clk); slave->servo = servo_create(cfg, servo, -fadj, max_adj, 0); -- 2.20.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel