]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys_linux: don't require configurable pin for external PPS
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 23 Feb 2022 10:31:24 +0000 (11:31 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 23 Feb 2022 13:43:39 +0000 (14:43 +0100)
Some PHCs that have a PPS input don't have configurable pins (their
function is hardcoded). Accept a negative pin index to skip the pin
configuration before requesting external timestamping.

doc/chrony.conf.adoc
sys_linux.c

index 6cecc1b34e5207f24244e49f5da5754f557a6373..9140c623a110545796e65ce7991bb2060b9c3c9a 100644 (file)
@@ -511,8 +511,10 @@ Note that some PTP clocks cannot be configured to timestamp only assert or
 clear events, and it is necessary to use the *width* option to filter wrong
 PPS samples.
 *pin*=_index_::::
-This option specifies the index of the pin to which is connected the PPS
-signal. The default value is 0.
+This option specifies the index of the pin which should be enabled for the
+PPS timestamping. If the PHC does not have configurable pins (i.e. the channel
+function is fixed), the index needs to be set to -1 to disable the pin
+configuration. The default value is 0.
 *channel*=_index_::::
 This option specifies the index of the channel for the PPS mode. The default
 value is 0.
index cc3c9311d306e5a1d9153848b2def6670ab92a31..762bf0a41864abc9c277b3992b1a8569d42ac848 100644 (file)
@@ -1008,7 +1008,7 @@ SYS_Linux_SetPHCExtTimestamping(int fd, int pin, int channel,
   pin_desc.func = enable ? PTP_PF_EXTTS : PTP_PF_NONE;
   pin_desc.chan = channel;
 
-  if (ioctl(fd, PTP_PIN_SETFUNC, &pin_desc)) {
+  if (pin >= 0 && ioctl(fd, PTP_PIN_SETFUNC, &pin_desc)) {
     DEBUG_LOG("ioctl(%s) failed : %s", "PTP_PIN_SETFUNC", strerror(errno));
     return 0;
   }