Commit eabd5c9d authored by Richard Cochran's avatar Richard Cochran Committed by David S. Miller

ptp_clock: Let the ADJ_OFFSET interface respect the ADJ_NANO flag for PHC devices.

In commit 184ecc9e ("ptp: Add adjphase
function to support phase offset control.") the PTP Hardware Clock
interface expanded to support the ADJ_OFFSET offset mode.  However,
the implementation did not respect the traditional yet pedantic
distinction between units of microseconds and nanoseconds signaled by
the ADJ_NANO flag.  This patch fixes the issue by adding logic to
handle that flag.
Signed-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
Reviewed-by: default avatarVincent Cheng <vincent.cheng.xh@renesas.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 45af29ca
...@@ -147,8 +147,14 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) ...@@ -147,8 +147,14 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
err = ops->adjfreq(ops, ppb); err = ops->adjfreq(ops, ppb);
ptp->dialed_frequency = tx->freq; ptp->dialed_frequency = tx->freq;
} else if (tx->modes & ADJ_OFFSET) { } else if (tx->modes & ADJ_OFFSET) {
if (ops->adjphase) if (ops->adjphase) {
err = ops->adjphase(ops, tx->offset); s32 offset = tx->offset;
if (!(tx->modes & ADJ_NANO))
offset *= NSEC_PER_USEC;
err = ops->adjphase(ops, offset);
}
} else if (tx->modes == 0) { } else if (tx->modes == 0) {
tx->freq = ptp->dialed_frequency; tx->freq = ptp->dialed_frequency;
err = 0; err = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment