aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ptp_clock_kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ptp_clock_kernel.h')
-rw-r--r--include/linux/ptp_clock_kernel.h73
1 files changed, 49 insertions, 24 deletions
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 5ad54fc66cf0..a026bfd089db 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -58,7 +58,14 @@ struct system_device_crosststamp;
58 * 58 *
59 * clock operations 59 * clock operations
60 * 60 *
61 * @adjfine: Adjusts the frequency of the hardware clock.
62 * parameter scaled_ppm: Desired frequency offset from
63 * nominal frequency in parts per million, but with a
64 * 16 bit binary fractional field.
65 *
61 * @adjfreq: Adjusts the frequency of the hardware clock. 66 * @adjfreq: Adjusts the frequency of the hardware clock.
67 * This method is deprecated. New drivers should implement
68 * the @adjfine method instead.
62 * parameter delta: Desired frequency offset from nominal frequency 69 * parameter delta: Desired frequency offset from nominal frequency
63 * in parts per billion 70 * in parts per billion
64 * 71 *
@@ -108,6 +115,7 @@ struct ptp_clock_info {
108 int n_pins; 115 int n_pins;
109 int pps; 116 int pps;
110 struct ptp_pin_desc *pin_config; 117 struct ptp_pin_desc *pin_config;
118 int (*adjfine)(struct ptp_clock_info *ptp, long scaled_ppm);
111 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 119 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
112 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 120 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
113 int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts); 121 int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);
@@ -122,30 +130,6 @@ struct ptp_clock_info {
122 130
123struct ptp_clock; 131struct ptp_clock;
124 132
125/**
126 * ptp_clock_register() - register a PTP hardware clock driver
127 *
128 * @info: Structure describing the new clock.
129 * @parent: Pointer to the parent device of the new clock.
130 *
131 * Returns a valid pointer on success or PTR_ERR on failure. If PHC
132 * support is missing at the configuration level, this function
133 * returns NULL, and drivers are expected to gracefully handle that
134 * case separately.
135 */
136
137extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
138 struct device *parent);
139
140/**
141 * ptp_clock_unregister() - unregister a PTP hardware clock driver
142 *
143 * @ptp: The clock to remove from service.
144 */
145
146extern int ptp_clock_unregister(struct ptp_clock *ptp);
147
148
149enum ptp_clock_events { 133enum ptp_clock_events {
150 PTP_CLOCK_ALARM, 134 PTP_CLOCK_ALARM,
151 PTP_CLOCK_EXTTS, 135 PTP_CLOCK_EXTTS,
@@ -171,6 +155,31 @@ struct ptp_clock_event {
171 }; 155 };
172}; 156};
173 157
158#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
159
160/**
161 * ptp_clock_register() - register a PTP hardware clock driver
162 *
163 * @info: Structure describing the new clock.
164 * @parent: Pointer to the parent device of the new clock.
165 *
166 * Returns a valid pointer on success or PTR_ERR on failure. If PHC
167 * support is missing at the configuration level, this function
168 * returns NULL, and drivers are expected to gracefully handle that
169 * case separately.
170 */
171
172extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
173 struct device *parent);
174
175/**
176 * ptp_clock_unregister() - unregister a PTP hardware clock driver
177 *
178 * @ptp: The clock to remove from service.
179 */
180
181extern int ptp_clock_unregister(struct ptp_clock *ptp);
182
174/** 183/**
175 * ptp_clock_event() - notify the PTP layer about an event 184 * ptp_clock_event() - notify the PTP layer about an event
176 * 185 *
@@ -202,4 +211,20 @@ extern int ptp_clock_index(struct ptp_clock *ptp);
202int ptp_find_pin(struct ptp_clock *ptp, 211int ptp_find_pin(struct ptp_clock *ptp,
203 enum ptp_pin_function func, unsigned int chan); 212 enum ptp_pin_function func, unsigned int chan);
204 213
214#else
215static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
216 struct device *parent)
217{ return NULL; }
218static inline int ptp_clock_unregister(struct ptp_clock *ptp)
219{ return 0; }
220static inline void ptp_clock_event(struct ptp_clock *ptp,
221 struct ptp_clock_event *event)
222{ }
223static inline int ptp_clock_index(struct ptp_clock *ptp)
224{ return -1; }
225static inline int ptp_find_pin(struct ptp_clock *ptp,
226 enum ptp_pin_function func, unsigned int chan)
227{ return -1; }
228#endif
229
205#endif 230#endif