Re: [PATCH net-next v5 2/3] dpll: zl3073x: add channel ToD, phase step and TIE operations
From: Ivan Vecera <ivecera@redhat.com>
Date: 2026-08-09 18:22:57
Also in:
lkml
On 8/7/26 11:58 AM, Ivan Vecera wrote:
Add low-level DPLL channel operations for ToD read/write/adjust,
output phase step, delta frequency offset write and TIE (Time
Interval Error) write. These serve as building blocks for the PTP
clock callbacks added in the next patch.
ToD operations use a wait-before-write pattern to avoid blocking
after each operation.
The tod_ready_wait helper selects the poll timeout based on the
current ToD command - write operations use a longer timeout (1000 ms)
than reads (30 ms).
The ToD read captures system timestamps (ptp_system_timestamp) around
the HW command and completion poll to support cross-timestamping.
The TIE write operation provides sub-picosecond resolution phase
adjustment for modes where the DPLL is tracking a reference
(AUTO and REFLOCK).
Add output step-time mask to struct zl3073x_dev and
zl3073x_dev_out_is_stepped() helper to check if an output
participates in step-time operations.
Reviewed-by: Petr Oros <redacted>
Tested-by: Chris du Quesnay <redacted>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/dpll/zl3073x/chan.c | 321 +++++++++++++++++++++++++++++++++++-
drivers/dpll/zl3073x/chan.h | 32 ++++
drivers/dpll/zl3073x/core.c | 13 ++
drivers/dpll/zl3073x/core.h | 23 +++
drivers/dpll/zl3073x/regs.h | 52 ++++++
5 files changed, 439 insertions(+), 2 deletions(-)
...
+/**
+ * zl3073x_chan_tod_adjust - atomic ToD read-modify-write with rollover guard
+ * @zldev: pointer to zl3073x device
+ * @ch: DPLL channel index
+ * @delta: time adjustment to apply
+ *
+ * Reads the next-Hz ToD and current ToD, then checks whether enough time
+ * remains before the next 1 Hz rollover to safely complete the write.
+ * Re-reads if the 1 Hz tick crossed between the two reads or if less
+ * than 20 ms remains before the next rollover. Applies @delta and writes
+ * the result back.
+ *
+ * Context: Caller must serialize all zl3073x_chan_tod_* calls externally.
+ * Return: 0 on success, <0 on error
+ */
+#define ZL_TOD_MAX_RETRIES 20
+int zl3073x_chan_tod_adjust(struct zl3073x_dev *zldev, u8 ch,
+ struct timespec64 delta)
+{
Oops, wrongly placed macro causing...
/logs/build/1142084/14736686/kdoc/stdout 0 ok |
raw
Warnings before patch:
files: ['drivers/dpll/zl3073x/chan.c', 'drivers/dpll/zl3073x/chan.h',
'drivers/dpll/zl3073x/core.c', 'drivers/dpll/zl3073x/core.h',
'drivers/dpll/zl3073x/regs.h']
Current warnings:
files: ['drivers/dpll/zl3073x/chan.c', 'drivers/dpll/zl3073x/chan.h',
'drivers/dpll/zl3073x/core.c', 'drivers/dpll/zl3073x/core.h',
'drivers/dpll/zl3073x/regs.h']
Warning: drivers/dpll/zl3073x/chan.c:399 expecting prototype for
zl3073x_chan_tod_adjust(). Prototype was for ZL_TOD_MAX_RETRIES() instead
Warnings before: 0 after: 1 (add: 1)
New warnings added:
Warning: drivers/dpll/zl3073x/chan.c:399 expecting prototype for
zl3073x_chan_tod_adjust(). Prototype was for ZL_TOD_MAX_RETRIES() instead
Per-file breakdown:
1 drivers/dpll/zl3073x/chan.c
Will fix in v6.
Ivan