Skip to content

Commit d3f1cbd

Browse files
vincentc-renesasdavem330
authored andcommitted
ptp: Add adjust_phase to ptp_clock_caps capability.
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 <[email protected]> Reviewed-by: Richard Cochran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 184ecc9 commit d3f1cbd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

drivers/ptp/ptp_chardev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
136136
caps.pps = ptp->info->pps;
137137
caps.n_pins = ptp->info->n_pins;
138138
caps.cross_timestamping = ptp->info->getcrosststamp != NULL;
139+
caps.adjust_phase = ptp->info->adjphase != NULL;
139140
if (copy_to_user((void __user *)arg, &caps, sizeof(caps)))
140141
err = -EFAULT;
141142
break;

include/uapi/linux/ptp_clock.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ struct ptp_clock_caps {
8989
int n_pins; /* Number of input/output pins. */
9090
/* Whether the clock supports precise system-device cross timestamps */
9191
int cross_timestamping;
92-
int rsv[13]; /* Reserved for future use. */
92+
/* Whether the clock supports adjust phase */
93+
int adjust_phase;
94+
int rsv[12]; /* Reserved for future use. */
9395
};
9496

9597
struct ptp_extts_request {

tools/testing/selftests/ptp/testptp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,16 @@ int main(int argc, char *argv[])
269269
" %d programmable periodic signals\n"
270270
" %d pulse per second\n"
271271
" %d programmable pins\n"
272-
" %d cross timestamping\n",
272+
" %d cross timestamping\n"
273+
" %d adjust_phase\n",
273274
caps.max_adj,
274275
caps.n_alarm,
275276
caps.n_ext_ts,
276277
caps.n_per_out,
277278
caps.pps,
278279
caps.n_pins,
279-
caps.cross_timestamping);
280+
caps.cross_timestamping,
281+
caps.adjust_phase);
280282
}
281283
}
282284

0 commit comments

Comments
 (0)