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.h65
1 files changed, 41 insertions, 24 deletions
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index b76d47aba564..a026bfd089db 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -130,30 +130,6 @@ struct ptp_clock_info {
130 130
131struct ptp_clock; 131struct ptp_clock;
132 132
133/**
134 * ptp_clock_register() - register a PTP hardware clock driver
135 *
136 * @info: Structure describing the new clock.
137 * @parent: Pointer to the parent device of the new clock.
138 *
139 * Returns a valid pointer on success or PTR_ERR on failure. If PHC
140 * support is missing at the configuration level, this function
141 * returns NULL, and drivers are expected to gracefully handle that
142 * case separately.
143 */
144
145extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
146 struct device *parent);
147
148/**
149 * ptp_clock_unregister() - unregister a PTP hardware clock driver
150 *
151 * @ptp: The clock to remove from service.
152 */
153
154extern int ptp_clock_unregister(struct ptp_clock *ptp);
155
156
157enum ptp_clock_events { 133enum ptp_clock_events {
158 PTP_CLOCK_ALARM, 134 PTP_CLOCK_ALARM,
159 PTP_CLOCK_EXTTS, 135 PTP_CLOCK_EXTTS,
@@ -179,6 +155,31 @@ struct ptp_clock_event {
179 }; 155 };
180}; 156};
181 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
182/** 183/**
183 * ptp_clock_event() - notify the PTP layer about an event 184 * ptp_clock_event() - notify the PTP layer about an event
184 * 185 *
@@ -210,4 +211,20 @@ extern int ptp_clock_index(struct ptp_clock *ptp);
210int ptp_find_pin(struct ptp_clock *ptp, 211int ptp_find_pin(struct ptp_clock *ptp,
211 enum ptp_pin_function func, unsigned int chan); 212 enum ptp_pin_function func, unsigned int chan);
212 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
213#endif 230#endif