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.
Unified · Split
| @@ -146,6 +146,9 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) · 145 unmodified lines | |||
| 146 | else | 146 | else |
| 147 | err = ops->adjfreq(ops, ppb); | 147 | err = ops->adjfreq(ops, ppb); |
| 148 | ptp->dialed_frequency = tx->freq; | 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 | } else if (tx->modes == 0) { | 152 | } else if (tx->modes == 0) { |
| 150 | tx->freq = ptp->dialed_frequency; | 153 | tx->freq = ptp->dialed_frequency; |
| 151 | err = 0; | 154 | err = 0; |
| @@ -36,7 +36,7 @@ struct ptp_system_timestamp { · 35 unmodified lines | |||
| 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 | * @owner: The clock driver should set to THIS_MODULE. | 41 | * @owner: The clock driver should set to THIS_MODULE. |
| 42 | * @name: A short "friendly name" to identify the clock and to | 42 | * @name: A short "friendly name" to identify the clock and to |
| @@ -65,6 +65,9 @@ struct ptp_system_timestamp { · 22 unmodified lines | |||
| 65 | * parameter delta: Desired frequency offset from nominal frequency | 65 | * parameter delta: Desired frequency offset from nominal frequency |
| 66 | * in parts per billion | 66 | * in parts per billion |
| 67 | * | 67 | * |
| 68 | * @adjphase: Adjusts the phase offset of the hardware clock. | ||
| 69 | * parameter delta: Desired change in nanoseconds. | ||
| 70 | * | ||
| 68 | * @adjtime: Shifts the time of the hardware clock. | 71 | * @adjtime: Shifts the time of the hardware clock. |
| 69 | * parameter delta: Desired change in nanoseconds. | 72 | * parameter delta: Desired change in nanoseconds. |
| 70 | * | 73 | * |
| @@ -128,6 +131,7 @@ struct ptp_clock_info { · 57 unmodified lines | |||
| 128 | struct ptp_pin_desc *pin_config; | 131 | struct ptp_pin_desc *pin_config; |
| 129 | int (*adjfine)(struct ptp_clock_info *ptp, long scaled_ppm); | 132 | int (*adjfine)(struct ptp_clock_info *ptp, long scaled_ppm); |
| 130 | int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); | 133 | int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); |
| 134 | int (*adjphase)(struct ptp_clock_info *ptp, s32 phase); | ||
| 131 | int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); | 135 | int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); |
| 132 | int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts); | 136 | int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts); |
| 133 | int (*gettimex64)(struct ptp_clock_info *ptp, struct timespec64 *ts, | 137 | int (*gettimex64)(struct ptp_clock_info *ptp, struct timespec64 *ts, |