1972bf40bSBjoern A. Zeeb /*-
2972bf40bSBjoern A. Zeeb  * Copyright (c) 2023 The FreeBSD Foundation
3972bf40bSBjoern A. Zeeb  *
4972bf40bSBjoern A. Zeeb  * This software was developed by Björn Zeeb under sponsorship from
5972bf40bSBjoern A. Zeeb  * the FreeBSD Foundation.
6972bf40bSBjoern A. Zeeb  *
7972bf40bSBjoern A. Zeeb  * Redistribution and use in source and binary forms, with or without
8972bf40bSBjoern A. Zeeb  * modification, are permitted provided that the following conditions
9972bf40bSBjoern A. Zeeb  * are met:
10972bf40bSBjoern A. Zeeb  * 1. Redistributions of source code must retain the above copyright
11972bf40bSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer.
12972bf40bSBjoern A. Zeeb  * 2. Redistributions in binary form must reproduce the above copyright
13972bf40bSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer in the
14972bf40bSBjoern A. Zeeb  *    documentation and/or other materials provided with the distribution.
15972bf40bSBjoern A. Zeeb  *
16972bf40bSBjoern A. Zeeb  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17972bf40bSBjoern A. Zeeb  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18972bf40bSBjoern A. Zeeb  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19972bf40bSBjoern A. Zeeb  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20972bf40bSBjoern A. Zeeb  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21972bf40bSBjoern A. Zeeb  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22972bf40bSBjoern A. Zeeb  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23972bf40bSBjoern A. Zeeb  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24972bf40bSBjoern A. Zeeb  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25972bf40bSBjoern A. Zeeb  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26972bf40bSBjoern A. Zeeb  * SUCH DAMAGE.
27972bf40bSBjoern A. Zeeb  */
28972bf40bSBjoern A. Zeeb 
29972bf40bSBjoern A. Zeeb #ifndef	_LINUXKPI_LINUX_PTP_CLOCK_KERNEL_H
30972bf40bSBjoern A. Zeeb #define	_LINUXKPI_LINUX_PTP_CLOCK_KERNEL_H
31972bf40bSBjoern A. Zeeb 
32972bf40bSBjoern A. Zeeb #include <linux/types.h>
33972bf40bSBjoern A. Zeeb #include <linux/device.h>
34972bf40bSBjoern A. Zeeb #include <linux/kernel.h>	/* pr_debug */
35972bf40bSBjoern A. Zeeb #include <linux/ktime.h>	/* system_device_crosststamp */
36972bf40bSBjoern A. Zeeb 
37972bf40bSBjoern A. Zeeb /* This very likely belongs elsewhere. */
38972bf40bSBjoern A. Zeeb struct system_device_crosststamp {
39972bf40bSBjoern A. Zeeb 	ktime_t	device;
40972bf40bSBjoern A. Zeeb 	ktime_t	sys_realtime;
41972bf40bSBjoern A. Zeeb 	ktime_t	sys_monotonic_raw;	/* name guessed based on comment */
42972bf40bSBjoern A. Zeeb };
43972bf40bSBjoern A. Zeeb 
44972bf40bSBjoern A. Zeeb struct ptp_clock_info {
45972bf40bSBjoern A. Zeeb 	char		name[32];
46972bf40bSBjoern A. Zeeb 	int		max_adj;
47972bf40bSBjoern A. Zeeb 	void		*owner;			/* THIS_MODULE */
48972bf40bSBjoern A. Zeeb 	int (*adjfine)(struct ptp_clock_info *, long);
49972bf40bSBjoern A. Zeeb 	int (*adjtime)(struct ptp_clock_info *, s64);
50972bf40bSBjoern A. Zeeb 	int (*getcrosststamp)(struct ptp_clock_info *, struct system_device_crosststamp *);
51972bf40bSBjoern A. Zeeb 	int (*gettime64)(struct ptp_clock_info *, struct timespec *);
52972bf40bSBjoern A. Zeeb };
53972bf40bSBjoern A. Zeeb 
54972bf40bSBjoern A. Zeeb static inline struct ptp_clock *
ptp_clock_register(struct ptp_clock_info * ptpci,struct device * dev)55972bf40bSBjoern A. Zeeb ptp_clock_register(struct ptp_clock_info *ptpci, struct device *dev)
56972bf40bSBjoern A. Zeeb {
57972bf40bSBjoern A. Zeeb 
58972bf40bSBjoern A. Zeeb 	pr_debug("%s: TODO\n", __func__);
59972bf40bSBjoern A. Zeeb 	return (NULL);
60972bf40bSBjoern A. Zeeb }
61972bf40bSBjoern A. Zeeb 
62972bf40bSBjoern A. Zeeb static inline void
ptp_clock_unregister(struct ptp_clock * ptpc)63972bf40bSBjoern A. Zeeb ptp_clock_unregister(struct ptp_clock *ptpc)
64972bf40bSBjoern A. Zeeb {
65972bf40bSBjoern A. Zeeb 	pr_debug("%s: TODO\n", __func__);
66972bf40bSBjoern A. Zeeb }
67972bf40bSBjoern A. Zeeb 
68972bf40bSBjoern A. Zeeb static inline int
ptp_clock_index(struct ptp_clock * ptpc)69972bf40bSBjoern A. Zeeb ptp_clock_index(struct ptp_clock *ptpc)
70972bf40bSBjoern A. Zeeb {
71972bf40bSBjoern A. Zeeb 	pr_debug("%s: TODO\n", __func__);
72972bf40bSBjoern A. Zeeb 	return (0);
73972bf40bSBjoern A. Zeeb }
74972bf40bSBjoern A. Zeeb 
75972bf40bSBjoern A. Zeeb #endif	/* _LINUXKPI_LINUX_PTP_CLOCK_KERNEL_H */
76