Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptp: Add adjphase function to support phase offset control.

Adds adjust phase function to take advantage of a PHC
clock's hardware filtering capability that uses phase offset
control word instead of frequency offset control word.

Signed-off-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
Reviewed-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vincent Cheng and committed by
David S. Miller
184ecc9e 115506fe

+8 -1
+3
drivers/ptp/ptp_clock.c
··· 146 146 else 147 147 err = ops->adjfreq(ops, ppb); 148 148 ptp->dialed_frequency = tx->freq; 149 + } else if (tx->modes & ADJ_OFFSET) { 150 + if (ops->adjphase) 151 + err = ops->adjphase(ops, tx->offset); 149 152 } else if (tx->modes == 0) { 150 153 tx->freq = ptp->dialed_frequency; 151 154 err = 0;
+5 -1
include/linux/ptp_clock_kernel.h
··· 36 36 }; 37 37 38 38 /** 39 - * struct ptp_clock_info - decribes a PTP hardware clock 39 + * struct ptp_clock_info - describes a PTP hardware clock 40 40 * 41 41 * @owner: The clock driver should set to THIS_MODULE. 42 42 * @name: A short "friendly name" to identify the clock and to ··· 64 64 * the @adjfine method instead. 65 65 * parameter delta: Desired frequency offset from nominal frequency 66 66 * in parts per billion 67 + * 68 + * @adjphase: Adjusts the phase offset of the hardware clock. 69 + * parameter delta: Desired change in nanoseconds. 67 70 * 68 71 * @adjtime: Shifts the time of the hardware clock. 69 72 * parameter delta: Desired change in nanoseconds. ··· 131 128 struct ptp_pin_desc *pin_config; 132 129 int (*adjfine)(struct ptp_clock_info *ptp, long scaled_ppm); 133 130 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 131 + int (*adjphase)(struct ptp_clock_info *ptp, s32 phase); 134 132 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 135 133 int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts); 136 134 int (*gettimex64)(struct ptp_clock_info *ptp, struct timespec64 *ts,