[Linuxptp-devel] [PATCH V1 1/2] Decouple servo state from automotive profile.

2020-05-16 Thread Richard Cochran
From: Vincent Cheng The logic for the Automotive Profile added a message interval update mechanism that triggers whenever the servo enters the "stable locked" state. This SERVO_LOCKED_STABLE state is active when the configuration option servo_offset_threshold is non-zero and servo_offset_thresho

[Linuxptp-devel] [PATCH V1 2/2] Add support for write phase mode.

2020-05-16 Thread Richard Cochran
Recently the Linux kernel's PTP Hardware Clock interface was expanded to include a "write phase" mode where the clock servo in implemented in hardware. This mode hearkens back to the tradition ntp_adjtime interface, passing a measured offset into the kernel's servo. This patch adds a new configur

[Linuxptp-devel] [PATCH V1 2/3] pmc: Support getting and setting the local synchronization uncertain flag.

2020-05-16 Thread Richard Cochran
Signed-off-by: Richard Cochran --- pmc.c| 5 + pmc_common.c | 22 ++ 2 files changed, 27 insertions(+) diff --git a/pmc.c b/pmc.c index f074621..490c140 100644 --- a/pmc.c +++ b/pmc.c @@ -305,6 +305,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)

[Linuxptp-devel] [PATCH V1 1/3] Implement the synchronization uncertain flag.

2020-05-16 Thread Richard Cochran
IEEE 1588 v2.1 and ITU G.8275.1/2 call for an optional "synchronization uncertain" flag passed in Announce messages along with the other flags from the time properties data set. The value of the flag depends is a logical OR function of the inputs from the remote master and the local process. This

[Linuxptp-devel] [PATCH V1 3/3] Let the free running port state reflect the synchronization uncertain flag.

2020-05-16 Thread Richard Cochran
When using the "free running" option, a slaved port remains in the UNCALIBRATED state. If the actual servo resides in and external program, for example when following the 802.1AS recommendations, that program can signal the synchronization state using the "synchronization uncertain" management mes

[Linuxptp-devel] [PATCH 02/11] udp: Convey transmit path errors to the caller.

2020-05-16 Thread Richard Cochran
The transport layer's functional interface foresees having error codes percolate back up to the caller. However, up until now, the udp module simply returned -1 for any error. This patch lets the code return the specific error instead. Signed-off-by: Richard Cochran --- udp.c | 2 +- 1 file ch

[Linuxptp-devel] [PATCH 09/11] port: Export the value of the wildcard port identity.

2020-05-16 Thread Richard Cochran
Code in other modules will need this special port ID value. This patch makes it available through the port header file. Signed-off-by: Richard Cochran --- port.h | 3 +++ port_signaling.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/port.h b/port.h index e3

[Linuxptp-devel] [PATCH 04/11] uds: Convey transmit path errors to the caller.

2020-05-16 Thread Richard Cochran
The transport layer's functional interface foresees having error codes percolate back up to the caller. However, up until now, the uds module simply returned -1 for any error. This patch lets the code return the specific error instead. In addition, it removes the gratuitous printing of the error

[Linuxptp-devel] [PATCH 07/11] port: Convey targeted forwarding errors to the caller.

2020-05-16 Thread Richard Cochran
The port_forward_to() method clobbers the specific error code returned by the transport layer with -1. This patch lets the code preserve the specific error in question. Signed-off-by: Richard Cochran --- port.c | 6 -- port.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --

[Linuxptp-devel] [PATCH 03/11] udp6: Convey transmit path errors to the caller.

2020-05-16 Thread Richard Cochran
The transport layer's functional interface foresees having error codes percolate back up to the caller. However, up until now, the udp6 module simply returned -1 for any error. This patch lets the code return the specific error instead. Signed-off-by: Richard Cochran --- udp6.c | 2 +- 1 file

[Linuxptp-devel] [PATCH 00/11] Background work for slave event monitoring.

2020-05-16 Thread Richard Cochran
The IEEE 1588v2.1 standard introduces a new optional feature called slave event monitoring. While implementing that, I found a number of small issues that wanted cleaning up. This series presents patches addressing them. Richard Cochran (11): transport: Correct grammar in the doxygen comments.

[Linuxptp-devel] [PATCH 01/11] transport: Correct grammar in the doxygen comments.

2020-05-16 Thread Richard Cochran
Signed-off-by: Richard Cochran --- transport.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transport.h b/transport.h index 5b8c413..7a7f87b 100644 --- a/transport.h +++ b/transport.h @@ -70,7 +70,7 @@ int transport_recv(struct transport *t, int fd, struct ptp_messag

[Linuxptp-devel] [PATCH 11/11] Reject path trace TLVs with excessive elements.

2020-05-16 Thread Richard Cochran
The current code truncates the size of path trace TLVs which exceed the expected maximum based on the largest possible message size. However if another TLV follows, then a gap would appear, that is, an area in the message buffer not pointed to by any TLV descriptor. In order to avoid forwarding s

[Linuxptp-devel] [PATCH 06/11] sk: Convey transmit path errors to the caller.

2020-05-16 Thread Richard Cochran
The transport layer's functional interface foresees having error codes percolate back up to the caller. However, up until now, the sk module simply returned -1 for any error. This patch lets the code return the specific error instead. Signed-off-by: Richard Cochran --- sk.c | 14 +++---

[Linuxptp-devel] [PATCH 05/11] raw: Convey transmit path errors to the caller.

2020-05-16 Thread Richard Cochran
The transport layer's functional interface foresees having error codes percolate back up to the caller. However, up until now, the raw module simply returned -1 for any error. This patch lets the code return the specific error instead. In addition, it removes the gratuitous printing of the error

[Linuxptp-devel] [PATCH 10/11] port: Publish the method for creating signaling messages.

2020-05-16 Thread Richard Cochran
Signed-off-by: Richard Cochran --- port.h | 3 +++ port_signaling.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/port.h b/port.h index 80c543e..0b07d55 100644 --- a/port.h +++ b/port.h @@ -210,6 +210,9 @@ struct port *port_open(const char *phc_device,

[Linuxptp-devel] [PATCH 08/11] util: Mark port identity comparisons as const.

2020-05-16 Thread Richard Cochran
The utility function to compare port IDs takes pointers, but it only needs to read the referenced data. This patch marks the parameters as const, allowing passing constants in the future. Signed-off-by: Richard Cochran --- util.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --g

Re: [Linuxptp-devel] [RFC PATCH 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Richard Cochran
On Fri, Apr 17, 2020 at 10:00:09AM +0530, Lokesh Vutla wrote: > phc2pwm.c | 233 ++ > 2 files changed, 237 insertions(+), 2 deletions(-) > create mode 100644 phc2pwm.c I wanted to try this today. There are some issues: /home/richard/git/linux

Re: [Linuxptp-devel] [RFC PATCH 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Lokesh Vutla via Linuxptp-devel
Hi Richard, On 16/05/20 10:24 PM, Richard Cochran wrote: > On Fri, Apr 17, 2020 at 10:00:09AM +0530, Lokesh Vutla wrote: >> phc2pwm.c | 233 ++ >> 2 files changed, 237 insertions(+), 2 deletions(-) >> create mode 100644 phc2pwm.c > > I wanted

Re: [Linuxptp-devel] [RFC PATCH 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Richard Cochran
On Sat, May 16, 2020 at 10:35:33PM +0530, Lokesh Vutla wrote: > Hi Richard, > > On 16/05/20 10:24 PM, Richard Cochran wrote: > > On Fri, Apr 17, 2020 at 10:00:09AM +0530, Lokesh Vutla wrote: > >> phc2pwm.c | 233 ++ > >> 2 files changed, 237 ins

Re: [Linuxptp-devel] [RFC PATCH 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Lokesh Vutla via Linuxptp-devel
Hi Richard, On 16/05/20 10:44 PM, Richard Cochran wrote: > On Sat, May 16, 2020 at 10:35:33PM +0530, Lokesh Vutla wrote: >> Hi Richard, >> >> On 16/05/20 10:24 PM, Richard Cochran wrote: >>> On Fri, Apr 17, 2020 at 10:00:09AM +0530, Lokesh Vutla wrote: phc2pwm.c | 233 +++

[Linuxptp-devel] [RFC PATCH v2 0/3] Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Lokesh Vutla via Linuxptp-devel
This series adds support for an userpace utility to sync a pwm with PTP clock. This can be used only on a specific hardware configutaion: - A PTP supporting IP that is not capable of generating PPS signal - A PWM signal that is connected to the above PTP hardware - On every rising edge of PWM, PTP

[Linuxptp-devel] [RFC PATCH v2 2/3] pwm: Add helper apis to control pwm

2020-05-16 Thread Lokesh Vutla via Linuxptp-devel
Add pwm helper api calls to control PWM using /sys/class entries. Following apis are supported: - pwm_chan_enable - pwm_chan_disable - pwm_chan_set_period - pwm_chan_set_duty_cycle - pwm_chan_create Signed-off-by: Lokesh Vutla --- makefile | 2 +- pwm.c| 223 +++

[Linuxptp-devel] [RFC PATCH v2 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Lokesh Vutla via Linuxptp-devel
Phc2pwm is an utility program to synchronize a pwm with ptp clock to generate PPS. This is mainly intended for the below hardware configuration: - A PTP supporting IP that is not capable of generating PPS signal - A PWM signal that is connected to the above PTP hardware - On every rising edge of PW

[Linuxptp-devel] [RFC PATCH v2 1/3] phc: Add helper apis to control external timestamps on ptp device

2020-05-16 Thread Lokesh Vutla via Linuxptp-devel
Add helper apis to: - Enable external timestamps - Disable external timestamps - Read external timestamps Signed-off-by: Lokesh Vutla --- phc.c | 48 phc.h | 29 + 2 files changed, 77 insertions(+) diff --git a/phc.c b

Re: [Linuxptp-devel] [RFC PATCH v2 2/3] pwm: Add helper apis to control pwm

2020-05-16 Thread Richard Cochran
On Sat, May 16, 2020 at 11:53:57PM +0530, Lokesh Vutla wrote: > +#define PWM_CHAN_EXPORT "/sys/class/pwm/pwmchip%d/export" > +#define PWM_CHAN_ENABLE "/sys/class/pwm/pwmchip%d/pwm%d/enable" > +#define PWM_CHAN_PERIOD "/sys/class/pwm/pwmchip%d/pwm%d/period" H

Re: [Linuxptp-devel] [RFC PATCH v2 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Richard Cochran
On Sat, May 16, 2020 at 11:53:58PM +0530, Lokesh Vutla wrote: > diff --git a/makefile b/makefile > index a965bd4..094c062 100644 > --- a/makefile > +++ b/makefile > @@ -22,7 +22,7 @@ CC = $(CROSS_COMPILE)gcc > VER = -DVER=$(version) > CFLAGS = -Wall $(VER) $(incdefs) $(DEBUG) $(EXTRA_C

Re: [Linuxptp-devel] [RFC PATCH v2 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Richard Cochran
On Sat, May 16, 2020 at 11:53:58PM +0530, Lokesh Vutla wrote: > + while (is_running()) { > + if (phc_read_extts(clkid, &ts)) > + continue; > + > + fprintf(stdout, "Timestamp = %lld.%09lld\n", ts / NS_PER_SEC, > + ts % NS_PER_SEC);

Re: [Linuxptp-devel] [RFC PATCH v2 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Richard Cochran
On Sat, May 16, 2020 at 11:53:58PM +0530, Lokesh Vutla wrote: > +int main(int argc, char *argv[]) > +{ > + unsigned int pwm_chip = 0, pwm_chan = 0, event_index = 0; > + int c, err, level = LOG_INFO; > + char *progname, *ptp_dev; > + struct pwm_chan *chan; > + struct pwm_servo ps

Re: [Linuxptp-devel] [RFC PATCH v2 3/3] phc2pwm: Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Richard Cochran
On Sat, May 16, 2020 at 01:42:51PM -0700, Richard Cochran wrote: > > + clkid = phc_open(ptp_dev); > > + if (clkid == CLOCK_INVALID) > > + return -1; Also, printing a error message in this case would be helpful to the user. Thanks, Richard __

Re: [Linuxptp-devel] [RFC PATCH 0/3] Introduce an utility to sync pwm with PTP clock

2020-05-16 Thread Richard Cochran
On Fri, Apr 17, 2020 at 10:00:06AM +0530, Lokesh Vutla wrote: > Following dependencies are needed in kernel for testing: > - Grygorii's series to support HW_TS_PUSH[2] > - Add pwm node in BBB DT. > All dependencies are available at[3]. > [3] https://github.com/lokeshvutla/linux.git devel/bbb-pps-g