diff options
Diffstat (limited to 'include/linux/ptp_clock_kernel.h')
| -rw-r--r-- | include/linux/ptp_clock_kernel.h | 65 |
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 | ||
| 131 | struct ptp_clock; | 131 | struct 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 | |||
| 145 | extern 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 | |||
| 154 | extern int ptp_clock_unregister(struct ptp_clock *ptp); | ||
| 155 | |||
| 156 | |||
| 157 | enum ptp_clock_events { | 133 | enum 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 | |||
| 172 | extern 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 | |||
| 181 | extern 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); | |||
| 210 | int ptp_find_pin(struct ptp_clock *ptp, | 211 | int 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 | ||
| 215 | static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, | ||
| 216 | struct device *parent) | ||
| 217 | { return NULL; } | ||
| 218 | static inline int ptp_clock_unregister(struct ptp_clock *ptp) | ||
| 219 | { return 0; } | ||
| 220 | static inline void ptp_clock_event(struct ptp_clock *ptp, | ||
| 221 | struct ptp_clock_event *event) | ||
| 222 | { } | ||
| 223 | static inline int ptp_clock_index(struct ptp_clock *ptp) | ||
| 224 | { return -1; } | ||
| 225 | static 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 |
