]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ptp: Add adjust_phase to ptp_clock_caps capability.
authorVincent Cheng <vincent.cheng.xh@renesas.com>
Sat, 2 May 2020 03:35:37 +0000 (23:35 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sat, 2 May 2020 23:31:45 +0000 (16:31 -0700)
Add adjust_phase to ptp_clock_caps capability to allow
user to query if a PHC driver supports adjust phase with
ioctl PTP_CLOCK_GETCAPS command.

Signed-off-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
Reviewed-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_chardev.c
include/uapi/linux/ptp_clock.h
tools/testing/selftests/ptp/testptp.c

index 93d574faf1fed421d338b0e5cb14f023967e78d3..375cd6e4aade296f036ea07401b19e99b73083a8 100644 (file)
@@ -136,6 +136,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
                caps.pps = ptp->info->pps;
                caps.n_pins = ptp->info->n_pins;
                caps.cross_timestamping = ptp->info->getcrosststamp != NULL;
+               caps.adjust_phase = ptp->info->adjphase != NULL;
                if (copy_to_user((void __user *)arg, &caps, sizeof(caps)))
                        err = -EFAULT;
                break;
index 9dc9d0079e98442be9e9f3f3fb3ce78069524593..ff070aa6427854c4bcbbc6a3b508e07e435f4408 100644 (file)
@@ -89,7 +89,9 @@ struct ptp_clock_caps {
        int n_pins;    /* Number of input/output pins. */
        /* Whether the clock supports precise system-device cross timestamps */
        int cross_timestamping;
-       int rsv[13];   /* Reserved for future use. */
+       /* Whether the clock supports adjust phase */
+       int adjust_phase;
+       int rsv[12];   /* Reserved for future use. */
 };
 
 struct ptp_extts_request {
index c0dd10257df5a624b04a43d4d34eed8246e653f0..da7a9dda94900b326b8b2c6ac791ebd00680b7d4 100644 (file)
@@ -269,14 +269,16 @@ int main(int argc, char *argv[])
                               "  %d programmable periodic signals\n"
                               "  %d pulse per second\n"
                               "  %d programmable pins\n"
-                              "  %d cross timestamping\n",
+                              "  %d cross timestamping\n"
+                              "  %d adjust_phase\n",
                               caps.max_adj,
                               caps.n_alarm,
                               caps.n_ext_ts,
                               caps.n_per_out,
                               caps.pps,
                               caps.n_pins,
-                              caps.cross_timestamping);
+                              caps.cross_timestamping,
+                              caps.adjust_phase);
                }
        }