diff options
Diffstat (limited to 'include/linux/ptp_clock_kernel.h')
| -rw-r--r-- | include/linux/ptp_clock_kernel.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index 38a993508327..0d8ff3fb84ba 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h | |||
| @@ -49,7 +49,11 @@ struct ptp_clock_request { | |||
| 49 | * @n_alarm: The number of programmable alarms. | 49 | * @n_alarm: The number of programmable alarms. |
| 50 | * @n_ext_ts: The number of external time stamp channels. | 50 | * @n_ext_ts: The number of external time stamp channels. |
| 51 | * @n_per_out: The number of programmable periodic signals. | 51 | * @n_per_out: The number of programmable periodic signals. |
| 52 | * @n_pins: The number of programmable pins. | ||
| 52 | * @pps: Indicates whether the clock supports a PPS callback. | 53 | * @pps: Indicates whether the clock supports a PPS callback. |
| 54 | * @pin_config: Array of length 'n_pins'. If the number of | ||
| 55 | * programmable pins is nonzero, then drivers must | ||
| 56 | * allocate and initialize this array. | ||
| 53 | * | 57 | * |
| 54 | * clock operations | 58 | * clock operations |
| 55 | * | 59 | * |
| @@ -70,6 +74,18 @@ struct ptp_clock_request { | |||
| 70 | * parameter request: Desired resource to enable or disable. | 74 | * parameter request: Desired resource to enable or disable. |
| 71 | * parameter on: Caller passes one to enable or zero to disable. | 75 | * parameter on: Caller passes one to enable or zero to disable. |
| 72 | * | 76 | * |
| 77 | * @verify: Confirm that a pin can perform a given function. The PTP | ||
| 78 | * Hardware Clock subsystem maintains the 'pin_config' | ||
| 79 | * array on behalf of the drivers, but the PHC subsystem | ||
| 80 | * assumes that every pin can perform every function. This | ||
| 81 | * hook gives drivers a way of telling the core about | ||
| 82 | * limitations on specific pins. This function must return | ||
| 83 | * zero if the function can be assigned to this pin, and | ||
| 84 | * nonzero otherwise. | ||
| 85 | * parameter pin: index of the pin in question. | ||
| 86 | * parameter func: the desired function to use. | ||
| 87 | * parameter chan: the function channel index to use. | ||
| 88 | * | ||
| 73 | * Drivers should embed their ptp_clock_info within a private | 89 | * Drivers should embed their ptp_clock_info within a private |
| 74 | * structure, obtaining a reference to it using container_of(). | 90 | * structure, obtaining a reference to it using container_of(). |
| 75 | * | 91 | * |
| @@ -83,13 +99,17 @@ struct ptp_clock_info { | |||
| 83 | int n_alarm; | 99 | int n_alarm; |
| 84 | int n_ext_ts; | 100 | int n_ext_ts; |
| 85 | int n_per_out; | 101 | int n_per_out; |
| 102 | int n_pins; | ||
| 86 | int pps; | 103 | int pps; |
| 104 | struct ptp_pin_desc *pin_config; | ||
| 87 | int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); | 105 | int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); |
| 88 | int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); | 106 | int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); |
| 89 | int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); | 107 | int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); |
| 90 | int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); | 108 | int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); |
| 91 | int (*enable)(struct ptp_clock_info *ptp, | 109 | int (*enable)(struct ptp_clock_info *ptp, |
| 92 | struct ptp_clock_request *request, int on); | 110 | struct ptp_clock_request *request, int on); |
| 111 | int (*verify)(struct ptp_clock_info *ptp, unsigned int pin, | ||
| 112 | enum ptp_pin_function func, unsigned int chan); | ||
| 93 | }; | 113 | }; |
| 94 | 114 | ||
| 95 | struct ptp_clock; | 115 | struct ptp_clock; |
| @@ -156,4 +176,17 @@ extern void ptp_clock_event(struct ptp_clock *ptp, | |||
| 156 | 176 | ||
| 157 | extern int ptp_clock_index(struct ptp_clock *ptp); | 177 | extern int ptp_clock_index(struct ptp_clock *ptp); |
| 158 | 178 | ||
| 179 | /** | ||
| 180 | * ptp_find_pin() - obtain the pin index of a given auxiliary function | ||
| 181 | * | ||
| 182 | * @ptp: The clock obtained from ptp_clock_register(). | ||
| 183 | * @func: One of the ptp_pin_function enumerated values. | ||
| 184 | * @chan: The particular functional channel to find. | ||
| 185 | * Return: Pin index in the range of zero to ptp_clock_caps.n_pins - 1, | ||
| 186 | * or -1 if the auxiliary function cannot be found. | ||
| 187 | */ | ||
| 188 | |||
| 189 | int ptp_find_pin(struct ptp_clock *ptp, | ||
| 190 | enum ptp_pin_function func, unsigned int chan); | ||
| 191 | |||
| 159 | #endif | 192 | #endif |
