dpll: add NCO pin type and zl3073x support
Subsystems (5)
Ivan Vecera
maintainerv5 cover dpll: add NCO pin type and zl3073x support
Add a new DPLL_PIN_TYPE_INT_NCO pin type for virtual pins representing the NCO mode of a DPLL and implement support for it in the zl3073x driver.
Patch 1 adds the new pin type to the DPLL netlink spec and UAPI header.
Patch 2 replaces the single 2s poll timeout with per-operation timeouts based on Microchip proprietary source code and own measurement.
Patch 3 adds a per-DPLL serialization mutex taken by all DPLL callbacks and the periodic worker, establishing a single lock that protects all per-channel state. The chan_state_update() call is moved under this lock.
Patch 4 adds a virtual NCO input pin to the zl3073x driver that allows userspace to switch a DPLL channel into NCO mode. The pin reports connected/active state when the channel is in NCO mode and handles the hardware-specific details of mode transitions including automatic df_offset capture and 1PPS phase preservation.
Changes:
v5:
- Rebased on net-next after the freq_monitor per-device fix landed via net.
- Move phase_offset_avg_factor_set notification loop outside lock to avoid lockdep false positive on multi-channel devices (patch 3).
- Configure dpll_df_read register before NCO mode switch (patch 4).
- Add 5ms delay before reading nco_auto_read captured df_offset, determined by HW testing (patch 4).
- Mark df_offset as unknown at probe when firmware left channel in NCO mode (patch 4).
- See individual patches for detailed changelogs.
v4:
- New patch 2: per-operation poll timeouts
- New patch 3: per-DPLL serialization lock
- See individual patches for detailed changelogs.
v3:
- fixed SoB position
v2:
- See individual patches for detailed changelogs.
Ivan Vecera (4):
dpll: add DPLL_PIN_TYPE_INT_NCO pin type
dpll: zl3073x: use per-operation poll timeouts
dpll: zl3073x: add per-DPLL serialization lock
dpll: zl3073x: add NCO virtual input pin
Documentation/netlink/specs/dpll.yaml | 13 + drivers/dpll/dpll_nl.c | 2 +- drivers/dpll/zl3073x/chan.c | 124 ++++++- drivers/dpll/zl3073x/chan.h | 48 +++ drivers/dpll/zl3073x/core.c | 44 +-- drivers/dpll/zl3073x/core.h | 10 +- drivers/dpll/zl3073x/dpll.c | 488 ++++++++++++++++++++++---- drivers/dpll/zl3073x/dpll.h | 4 + drivers/dpll/zl3073x/regs.h | 11 + include/uapi/linux/dpll.h | 4 + 10 files changed, 651 insertions(+), 97 deletions(-)
base-commit: 8415598365503ced2e3d019491b0a2756c85c494
Signature · 1 line
2.53.0
Ivan Vecera
maintainerPATCH v5 1/4 dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Add DPLL_PIN_TYPE_INT_NCO pin type for virtual pins representing the NCO mode of a DPLL. When connected as a DPLL input, the DPLL enters NCO mode where the output frequency is adjusted by the host via the PTP clock interface.
Update the fractional-frequency-offset and fractional-frequency- offset-ppt attribute documentation to note that for INT_NCO pins these attributes represent the DPLL's current output frequency offset from its nominal frequency.
---
v2:
- Clarify int-nco pin type documentation to describe frequency control via the PTP clock interface instead of generic "controlled by the host".
- Tighten FFO attribute documentation for INT_NCO pins to describe the DPLL's output frequency offset from nominal frequency.
- Mention both fractional-frequency-offset (PPM) and fractional-frequency-offset-ppt attributes in the commit message.
--- Documentation/netlink/specs/dpll.yaml | 13 +++++++++++++ drivers/dpll/dpll_nl.c | 2 +- include/uapi/linux/dpll.h | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-)
Documentation/netlink/specs/dpll.yaml +13 -0
@@ -162,6 +162,13 @@ definitions: - name: gnss doc: GNSS recovered clock + - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface. render-max: true - type: enum
@@ -453,6 +460,9 @@ attribute-sets: offset on the media associated with the pin. Inside the pin-parent-device nest it represents the frequency offset between the pin and its parent DPLL device. + For pins of type PIN_TYPE_INT_NCO this represents + the DPLL's current output frequency offset from its + nominal frequency. Value is in PPM (parts per million). This is a lower-precision version of fractional-frequency-offset-ppt.
@@ -499,6 +509,9 @@ attribute-sets: offset on the media associated with the pin. Inside the pin-parent-device nest it represents the frequency offset between the pin and its parent DPLL device. + For pins of type PIN_TYPE_INT_NCO this represents + the DPLL's current output frequency offset from its + nominal frequency. Value is in PPT (parts per trillion, 10^-12). This is a higher-precision version of fractional-frequency-offset.
drivers/dpll/dpll_nl.c +1 -1
@@ -61,7 +61,7 @@ static const struct nla_policy dpll_pin_id_get_nl_policy[DPLL_A_PIN_TYPE + 1] = [DPLL_A_PIN_BOARD_LABEL] = { .type = NLA_NUL_STRING, }, [DPLL_A_PIN_PANEL_LABEL] = { .type = NLA_NUL_STRING, }, [DPLL_A_PIN_PACKAGE_LABEL] = { .type = NLA_NUL_STRING, }, - [DPLL_A_PIN_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 5), + [DPLL_A_PIN_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 6), };/* DPLL_CMD_PIN_GET - do */
include/uapi/linux/dpll.h +4 -0
@@ -127,6 +127,9 @@ enum dpll_type {* @DPLL_PIN_TYPE_SYNCE_ETH_PORT: ethernet port PHY's recovered clock * @DPLL_PIN_TYPE_INT_OSCILLATOR: device internal oscillator * @DPLL_PIN_TYPE_GNSS: GNSS recovered clock +* @DPLL_PIN_TYPE_INT_NCO: Device internal numerically controlled oscillator. +* When connected as a DPLL input, the DPLL enters NCO mode where the output +* frequency is adjusted by the host via the PTP clock interface. */ enum dpll_pin_type {DPLL_PIN_TYPE_MUX =1 ,
@@ -134,6 +137,7 @@ enum dpll_pin_type {DPLL_PIN_TYPE_SYNCE_ETH_PORT ,DPLL_PIN_TYPE_INT_OSCILLATOR ,DPLL_PIN_TYPE_GNSS , +DPLL_PIN_TYPE_INT_NCO ,/* private: */ __DPLL_PIN_TYPE_MAX,
Signature · 1 line
2.53.0
Ivan Vecera
maintainerPATCH v5 2/4 dpll: zl3073x: use per-operation poll timeouts
In reply to Ivan VeceraReplace the single 2s timeout in zl3073x_poll_zero_u8() with a per-caller timeout parameter. Different HW operations have different expected completion times so using per-operation timeouts improves error detection. The timeout values are based on proprietary source code provided by Microchip and own measurement.
--- drivers/dpll/zl3073x/chan.c | 6 ++++-- drivers/dpll/zl3073x/core.c | 29 +++++++++++++++++------------ drivers/dpll/zl3073x/core.h | 10 +++++++++- 3 files changed, 30 insertions(+), 15 deletions(-)
drivers/dpll/zl3073x/chan.c +4 -2
@@ -33,7 +33,8 @@ int zl3073x_chan_state_update(struct zl3073x_dev *zldev, u8 index)/* Read df_offset vs tracked reference */ rc =zl3073x_poll_zero_u8 (zldev,ZL_REG_DPLL_DF_READ (index), -ZL_DPLL_DF_READ_SEM ); +ZL_DPLL_DF_READ_SEM , +ZL_POLL_DF_READ_TIMEOUT_US );if (rc)return rc;
@@ -43,7 +44,8 @@ int zl3073x_chan_state_update(struct zl3073x_dev *zldev, u8 index)return rc; rc =zl3073x_poll_zero_u8 (zldev,ZL_REG_DPLL_DF_READ (index), -ZL_DPLL_DF_READ_SEM ); +ZL_DPLL_DF_READ_SEM , +ZL_POLL_DF_READ_TIMEOUT_US );if (rc)return rc;
drivers/dpll/zl3073x/core.c +17 -12
@@ -311,17 +311,17 @@ int zl3073x_write_u48(struct zl3073x_dev *zldev, unsigned int reg, u64 val)* @zldev: zl3073x device pointer * @reg: register to poll (has to be 8bit register) * @mask: bit mask for polling +* @timeout_us: timeout in microseconds * * Waits for bits specified by @mask in register @reg value to be cleared * by the device. * * Returns: 0 on success, <0 on error */ -int zl3073x_poll_zero_u8 (struct zl3073x_dev *zldev,unsigned int reg,u8 mask) +int zl3073x_poll_zero_u8 (struct zl3073x_dev *zldev,unsigned int reg, +u8 mask,unsigned int timeout_us) { -/* Register polling sleep & timeout */ -#define ZL_POLL_SLEEP_US 10 -#define ZL_POLL_TIMEOUT_US 2000000 +#define ZL_POLL_SLEEP_US 10unsigned int val;/* Check the register is 8bit */
@@ -335,7 +335,7 @@ int zl3073x_poll_zero_u8(struct zl3073x_dev *zldev, unsigned int reg, u8 mask) reg =ZL_REG_ADDR (reg) +ZL_RANGE_OFFSET ;return regmap_read_poll_timeout (zldev->regmap, reg, val, !(val & mask), -ZL_POLL_SLEEP_US ,ZL_POLL_TIMEOUT_US ); +ZL_POLL_SLEEP_US , timeout_us); } int zl3073x_mb_op(struct zl3073x_dev *zldev, unsigned int op_reg, u8 op_val,
@@ -354,7 +354,8 @@ int zl3073x_mb_op(struct zl3073x_dev *zldev, unsigned int op_reg, u8 op_val,return rc;/* Wait for the operation to actually finish */ -return zl3073x_poll_zero_u8 (zldev, op_reg, op_val); +return zl3073x_poll_zero_u8 (zldev, op_reg, op_val, +ZL_POLL_MB_TIMEOUT_US ); }/**
@@ -377,8 +378,8 @@ zl3073x_do_hwreg_op(struct zl3073x_dev *zldev, u8 op)return rc;/* Poll for completion - pending bit cleared */ -return zl3073x_poll_zero_u8 (zldev,ZL_REG_HWREG_OP , -ZL_HWREG_OP_PENDING ); +return zl3073x_poll_zero_u8 (zldev,ZL_REG_HWREG_OP ,ZL_HWREG_OP_PENDING , +ZL_POLL_HWREG_TIMEOUT_US ); }/**
@@ -609,7 +610,8 @@ int zl3073x_ref_phase_offsets_update(struct zl3073x_dev *zldev, int channel)* to be zero to ensure that the measured data are coherent. */ rc =zl3073x_poll_zero_u8 (zldev,ZL_REG_REF_PHASE_ERR_READ_RQST , -ZL_REF_PHASE_ERR_READ_RQST_RD ); +ZL_REF_PHASE_ERR_READ_RQST_RD , +ZL_POLL_PHASE_ERR_TIMEOUT_US );if (rc)return rc;
@@ -628,7 +630,8 @@ int zl3073x_ref_phase_offsets_update(struct zl3073x_dev *zldev, int channel)/* Wait for finish */ return zl3073x_poll_zero_u8 (zldev,ZL_REG_REF_PHASE_ERR_READ_RQST , -ZL_REF_PHASE_ERR_READ_RQST_RD ); +ZL_REF_PHASE_ERR_READ_RQST_RD , +ZL_POLL_PHASE_ERR_TIMEOUT_US ); }/**
@@ -648,7 +651,8 @@ zl3073x_ref_freq_meas_latch(struct zl3073x_dev *zldev, u8 type)/* Wait for previous measurement to finish */ rc =zl3073x_poll_zero_u8 (zldev,ZL_REG_REF_FREQ_MEAS_CTRL , -ZL_REF_FREQ_MEAS_CTRL ); +ZL_REF_FREQ_MEAS_CTRL , +ZL_POLL_FREQ_MEAS_TIMEOUT_US );if (rc)return rc;
@@ -669,7 +673,8 @@ zl3073x_ref_freq_meas_latch(struct zl3073x_dev *zldev, u8 type)/* Wait for finish */ return zl3073x_poll_zero_u8 (zldev,ZL_REG_REF_FREQ_MEAS_CTRL , -ZL_REF_FREQ_MEAS_CTRL ); +ZL_REF_FREQ_MEAS_CTRL , +ZL_POLL_FREQ_MEAS_TIMEOUT_US ); }/**
drivers/dpll/zl3073x/core.h +9 -1
@@ -7,6 +7,7 @@#include <linux/kthread.h> #include <linux/list.h> #include <linux/mutex.h> +#include <linux/time64.h> #include <linux/types.h> #include "chan.h"
@@ -19,6 +20,12 @@ struct device;struct regmap ;struct zl3073x_dpll ; +/* Per-operation poll timeouts */ +#define ZL_POLL_DF_READ_TIMEOUT_US (25 * USEC_PER_MSEC) +#define ZL_POLL_FREQ_MEAS_TIMEOUT_US (50 * USEC_PER_MSEC) +#define ZL_POLL_HWREG_TIMEOUT_US (50 * USEC_PER_MSEC) +#define ZL_POLL_MB_TIMEOUT_US (30 * USEC_PER_MSEC) +#define ZL_POLL_PHASE_ERR_TIMEOUT_US (50 * USEC_PER_MSEC)enum zl3073x_flags {ZL3073X_FLAG_REF_PHASE_COMP_32_BIT ,
@@ -127,7 +134,8 @@ struct zl3073x_hwreg_seq_item {int zl3073x_mb_op (struct zl3073x_dev *zldev,unsigned int op_reg,u8 op_val,unsigned int mask_reg,u16 mask_val); -int zl3073x_poll_zero_u8 (struct zl3073x_dev *zldev,unsigned int reg,u8 mask); +int zl3073x_poll_zero_u8 (struct zl3073x_dev *zldev,unsigned int reg, +u8 mask,unsigned int timeout_us);int zl3073x_read_u8 (struct zl3073x_dev *zldev,unsigned int reg,u8 *val);int zl3073x_read_u16 (struct zl3073x_dev *zldev,unsigned int reg,u16 *val);int zl3073x_read_u32 (struct zl3073x_dev *zldev,unsigned int reg,u32 *val);
Signature · 1 line
2.53.0
Ivan Vecera
maintainerPATCH v5 3/4 dpll: zl3073x: add per-DPLL serialization lock
In reply to Ivan VeceraAdd a per-DPLL mutex that serializes all operations on a given DPLL channel across DPLL netlink callbacks, the periodic kthread worker, and (in subsequent patches) PTP clock callbacks.
All DPLL pin and device callbacks that access mutable state take the lock as the first operation. The periodic worker holds it for the entire check cycle of each channel, deferring change notifications until after the lock is released to avoid ABBA deadlock with dpll_lock. This establishes the lock ordering:dpll_lock (subsystem, outer) -> zldpll->lock (driver, inner).
Move zl3073x_chan_state_update() from the per-device zl3073x_dev_chan_states_update() loop into the per-DPLL zl3073x_dpll_changes_check() so it runs under zldpll->lock. This serializes df_offset writes with all readers and eliminates the need for separate df_offset synchronization.
Change pin->freq_offset from atomic64_t to plain s64 since all readers and writers are now serialized by zldpll->lock, making atomic access unnecessary.
--- drivers/dpll/zl3073x/core.c | 15 --- drivers/dpll/zl3073x/dpll.c | 188 ++++++++++++++++++++++++++++-------- drivers/dpll/zl3073x/dpll.h | 2 + 3 files changed, 149 insertions(+), 56 deletions(-)
drivers/dpll/zl3073x/core.c +0 -15
@@ -567,19 +567,7 @@ zl3073x_dev_ref_states_update(struct zl3073x_dev *zldev) } } -static void -zl3073x_dev_chan_states_update (struct zl3073x_dev *zldev) -{ -int i, rc; -for (i =0 ; i < zldev->info->num_channels; i++) { - rc =zl3073x_chan_state_update (zldev, i); -if (rc) -dev_warn (zldev->dev, -"Failed to get DPLL%u state: %pe\n" , i, -ERR_PTR (rc)); - } -}/** * zl3073x_ref_phase_offsets_update - update reference phase offsets
@@ -720,9 +708,6 @@ zl3073x_dev_periodic_work(struct kthread_work *work)/* Update input references' states */ zl3073x_dev_ref_states_update (zldev); -/* Update DPLL channels' states */ -zl3073x_dev_chan_states_update (zldev); -/* Update DPLL-to-connected-ref phase offsets registers */ rc =zl3073x_ref_phase_offsets_update (zldev,-1 );if (rc)
drivers/dpll/zl3073x/dpll.c +147 -41
552 lines not on this page · raw message
drivers/dpll/zl3073x/dpll.h +2 -0
@@ -18,6 +18,7 @@* @ops: DPLL device operations for this instance * @dpll_dev: pointer to registered DPLL device * @tracker: tracking object for the acquired reference +* @lock: per-DPLL mutex serializing all operations * @lock_status: last saved DPLL lock status * @pins: list of pins */
@@ -30,6 +31,7 @@ struct zl3073x_dpll {struct dpll_device_ops ops;struct dpll_device *dpll_dev;dpll_tracker tracker; +struct mutex lock;enum dpll_lock_status lock_status;struct list_head pins; };
Signature · 1 line
2.53.0
Ivan Vecera
maintainerPATCH v5 4/4 dpll: zl3073x: add NCO virtual input pin
In reply to Ivan VeceraAdd a virtual NCO (Numerically Controlled Oscillator) input pin that lets userspace switch a DPLL channel into NCO mode. A single NCO pin is shared across all DPLL channels - each channel has its own independent connection state. The NCO pin is registered with the new DPLL_PIN_TYPE_INT_NCO type and reports DPLL_PIN_STATE_CONNECTED / DPLL_PIN_OPERSTATE_ACTIVE when the channel is in NCO mode.
At NCO pin registration the following bits are configured in dpll_ctrl_x:
- nco_auto_read: auto-capture tracking offset on NCO entry
- tod_step_reset: apply negated ToD step accumulator on NCO exit
- tie_clear: PPS DPLLs set 1 to re-align outputs on NCO exit, EEC DPLLs keep 0 to prevent an unwanted TIE write
Before switching to NCO mode, dpll_df_read_x is configured with ref_ofst=0 and cmd=ACC_I so that nco_auto_read captures the accumulated I-part offset relative to the master clock. Without this, the captured df_offset would be near zero (offset relative to the input reference after lock).
On NCO entry the df_offset captured by nco_auto_read is read from the register. Per the datasheet, nco_auto_read only captures a valid offset when entering NCO from reflock, auto or holdover mode; from freerun the captured value is not meaningful and df_offset is marked as ZL_DPLL_DF_OFFSET_UNKNOWN. The same sentinel is set in chan_state_update() when the channel is not locked, and both FFO consumers (NCO pin and input pin) guard against it.
Disconnecting the NCO pin switches to freerun rather than holdover because holdover averaging is not updated during NCO mode.
When connecting the NCO pin displaces a previously connected input pin (reflock mode), a change notification is sent for that input pin.
Input reference pins are now always registered regardless of the initial DPLL mode. Previously they were skipped when the DPLL was in NCO mode, but the NCO pin provides the proper mechanism for mode transitions.
---
Changes:
v5:
- Configure dpll_df_read register before NCO mode switch:
ref_ofst=0 to read offset relative to master clock, cmd=ACC_I for accumulated I-part. Without this, nco_auto_read captures incorrect df_offset (reported by Chris du Quesnay).
v4:
- Drop multiop_lock from chan_state_update() and nco_mode_set(), df_offset access is now serialized by the per-DPLL zldpll->lock introduced in the new lock patch.
- Add zldpll->lock guard to all NCO pin callbacks for consistency with the lock patch.
- Use mutex_lock/unlock in nco_pin_register, nco_pin_state_on_dpll_set, and input_pin_state_on_dpll_set instead of guard()/scoped_guard() to avoid mixing cleanup helpers with goto-based error handling.
- Filter NCO pin in the deferred notification loop to match the monitoring loop filter.
- Introduce ZL_DPLL_DF_OFFSET_UNKNOWN (S64_MIN) sentinel for
df_offset: set on read failure, when entering NCO from a freerun mode, and when
chan_state_update() finds the channel not locked. Guard both NCO pin and input pin FFO consumers against the sentinel.
- Send __dpll_pin_change_ntf() for the displaced input pin when connecting the NCO pin from reflock mode.
- Read df_offset from register at probe when firmware left the channel in NCO mode.
- Add comment clarifying that nco_auto_read completes before the mode switch (specified by the datasheet and verified by HW testing).
- Unify df_offset sign convention comments with datasheet
reference (f_offset = f_nom * (-df_offset) / 2^48).
v3:
- Fixed Signed-off-by position
v2:
- Configure nco_auto_read, tod_step_reset and tie_clear once at NCO pin registration since these are persistent R/W bits. In v1 nco_auto_read was set at registration, while tod_step_reset and tie_clear were set on each NCO exit path.
- Add zl3073x_chan_nco_mode_set() helper that writes mode_refsel directly and reads df_offset from the register without the DF_READ semaphore protocol. A short delay (~5 ms) is needed before nco_auto_read populates the df_offset register (determined by HW testing). In v1 the full DF_READ semaphore protocol with zl3073x_chan_state_update() was used.
- Zero df_offset on read failure instead of keeping stale value.
- Serialize zl3073x_chan_state_update() and zl3073x_chan_nco_mode_set() with multiop_lock to prevent concurrent df_offset access from the periodic worker.
- Gate df_offset read in zl3073x_chan_state_update() on LOCK state instead of skipping NCO channels in chan_states_update(). This keeps mon_status and refsel_status fresh in all modes.
- Send __dpll_pin_change_ntf() for the NCO pin when leaving NCO mode via mode_set() or input pin connect, since the periodic worker skips the NCO pin.
- Add comments explaining the inverted sign convention of the dpll_df_offset register.
- Document why NCO disconnect selects freerun over holdover, the shared NCO pin design, and the input pin registration change.
--- drivers/dpll/zl3073x/chan.c | 118 +++++++++++++- drivers/dpll/zl3073x/chan.h | 48 ++++++ drivers/dpll/zl3073x/dpll.c | 308 ++++++++++++++++++++++++++++++++---- drivers/dpll/zl3073x/dpll.h | 2 + drivers/dpll/zl3073x/regs.h | 11 ++ 5 files changed, 458 insertions(+), 29 deletions(-)
drivers/dpll/zl3073x/chan.c +116 -2
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only #include <linux/cleanup.h> +#include <linux/delay.h> #include <linux/dev_printk.h> #include <linux/string.h> #include <linux/types.h>
@@ -31,7 +32,15 @@ int zl3073x_chan_state_update(struct zl3073x_dev *zldev, u8 index)if (rc)return rc; -/* Read df_offset vs tracked reference */ +/* Read df_offset only when locked to a reference. In NCO mode +* df_offset was captured at entry by nco_mode_set() - preserve it. +*/ +if (!zl3073x_chan_is_locked (chan)) { +if (!zl3073x_chan_mode_is_nco (chan)) + chan->df_offset =ZL_DPLL_DF_OFFSET_UNKNOWN ; +return 0 ; + } + rc =zl3073x_poll_zero_u8 (zldev,ZL_REG_DPLL_DF_READ (index),ZL_DPLL_DF_READ_SEM ,ZL_POLL_DF_READ_TIMEOUT_US );
@@ -58,6 +67,92 @@ int zl3073x_chan_state_update(struct zl3073x_dev *zldev, u8 index)return 0 ; } +/** +* zl3073x_chan_nco_mode_set - switch DPLL channel to NCO mode +* @zldev: pointer to zl3073x_dev structure +* @index: DPLL channel index +* +* Switches the channel to NCO mode and reads the df_offset +* auto-captured by nco_auto_read directly from the register. +* No DF_READ handshake is needed as nco_auto_read populates +* the register before the mode switch completes. +* +* Return: 0 on success, <0 on error +*/ +int zl3073x_chan_nco_mode_set (struct zl3073x_dev *zldev,u8 index) +{ +struct zl3073x_chan *chan = &zldev->chan[index]; +u8 prev_mode, df_read; +u64 val; +int rc; + + prev_mode =zl3073x_chan_mode_get (chan); + +/* nco_auto_read captures the tracking offset at NCO entry only +* from reflock, auto or holdover mode. From freerun the captured +* value is not meaningful. +*/ +if (prev_mode ==ZL_DPLL_MODE_REFSEL_MODE_FREERUN ) { +zl3073x_chan_mode_set (chan,ZL_DPLL_MODE_REFSEL_MODE_NCO ); + + rc =zl3073x_write_u8 (zldev,ZL_REG_DPLL_MODE_REFSEL (index), + chan->mode_refsel); +if (rc) { +zl3073x_chan_mode_set (chan, prev_mode); +return rc; + } + + chan->df_offset =ZL_DPLL_DF_OFFSET_UNKNOWN ; +return 0 ; + } + +/* Configure df_read for nco_auto_read: +* ref_ofst=0 - reads offset relative to master clock (not input ref) +* cmd=CMD_ACC_I - accumulated I-part covering both locked and +* holdover entry. +* +* No semaphore is set - this only configures what the df_offset +* value represents after the mode switch; nco_auto_read performs +* the actual read automatically. +*/ + df_read =FIELD_PREP (ZL_DPLL_DF_READ_REF_OFST ,0 ) | +FIELD_PREP (ZL_DPLL_DF_READ_CMD ,ZL_DPLL_DF_READ_CMD_ACC_I ); + rc =zl3073x_write_u8 (zldev,ZL_REG_DPLL_DF_READ (index), df_read); +if (rc) +return rc; + +zl3073x_chan_mode_set (chan,ZL_DPLL_MODE_REFSEL_MODE_NCO ); + rc =zl3073x_write_u8 (zldev,ZL_REG_DPLL_MODE_REFSEL (index), + chan->mode_refsel); +if (rc) { +zl3073x_chan_mode_set (chan, prev_mode); +return rc; + } + +/* Wait for nco_auto_read to populate df_offset. The datasheet +* does not specify a delay but HW testing shows ~3 ms is needed +* before the register contains the captured value. Use 5 ms to +* provide margin. +*/ +fsleep (5000 ); + +/* Read df_offset captured by nco_auto_read during mode switch. +* No DF_READ semaphore handshake needed. Mode switch already +* succeeded, so don't propagate a read failure back to userspace. +*/ + rc =zl3073x_read_u48 (zldev,ZL_REG_DPLL_DF_OFFSET (index), &val); +if (rc) { +dev_warn (zldev->dev, +"Failed to read DPLL%u df_offset: %pe\n" , + index,ERR_PTR (rc)); + chan->df_offset =ZL_DPLL_DF_OFFSET_UNKNOWN ; + }else { + chan->df_offset =sign_extend64 (val,47 ); + } + +return 0 ; +} +/** * zl3073x_chan_state_fetch - fetch DPLL channel state from hardware * @zldev: pointer to zl3073x_dev structure
@@ -73,6 +168,10 @@ int zl3073x_chan_state_fetch(struct zl3073x_dev *zldev, u8 index)struct zl3073x_chan *chan = &zldev->chan[index];int rc, i; + rc =zl3073x_read_u8 (zldev,ZL_REG_DPLL_CTRL (index), &chan->ctrl); +if (rc) +return rc; + rc =zl3073x_read_u8 (zldev,ZL_REG_DPLL_MODE_REFSEL (index), &chan->mode_refsel);if (rc)
@@ -85,6 +184,13 @@ int zl3073x_chan_state_fetch(struct zl3073x_dev *zldev, u8 index)if (rc)return rc; +/* If firmware left the channel in NCO mode, mark df_offset as +* unknown - we cannot know whether the preconditions for a valid +* nco_auto_read capture were met. +*/ +if (zl3073x_chan_mode_is_nco (chan)) + chan->df_offset =ZL_DPLL_DF_OFFSET_UNKNOWN ; + dev_dbg(zldev->dev, "DPLL%u lock_state: %u, ho: %u, sel_state: %u, sel_ref: %u\n", index, zl3073x_chan_lock_state_get(chan),
@@ -147,7 +253,15 @@ int zl3073x_chan_state_set(struct zl3073x_dev *zldev, u8 index,if (!memcmp (&dchan->cfg, &chan->cfg,sizeof (chan->cfg)))return 0 ; -/* Direct register write for mode_refsel */ +/* Direct register writes for ctrl and mode_refsel */ +if (dchan->ctrl != chan->ctrl) { + rc =zl3073x_write_u8 (zldev,ZL_REG_DPLL_CTRL (index), + chan->ctrl); +if (rc) +return rc; + dchan->ctrl = chan->ctrl; + } +if (dchan->mode_refsel != chan->mode_refsel) { rc =zl3073x_write_u8 (zldev,ZL_REG_DPLL_MODE_REFSEL (index), chan->mode_refsel);
drivers/dpll/zl3073x/chan.h +48 -0
72 lines not on this page · raw message
drivers/dpll/zl3073x/dpll.c +281 -27
436 lines not on this page · raw message
drivers/dpll/zl3073x/dpll.h +2 -0
@@ -19,6 +19,7 @@* @dpll_dev: pointer to registered DPLL device * @tracker: tracking object for the acquired reference * @lock: per-DPLL mutex serializing all operations +* @type: DPLL type (PPS or EEC) * @lock_status: last saved DPLL lock status * @pins: list of pins */
@@ -32,6 +33,7 @@ struct zl3073x_dpll {struct dpll_device *dpll_dev;dpll_tracker tracker;struct mutex lock; +enum dpll_type type;enum dpll_lock_status lock_status;struct list_head pins; };
drivers/dpll/zl3073x/regs.h +11 -0
@@ -5,6 +5,7 @@#include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/limits.h> /* * Hardware limits for ZL3073x chip family
@@ -17,6 +18,7 @@#define ZL3073X_NUM_OUTPUT_PINS (ZL3073X_NUM_OUTS * 2)#define ZL3073X_NUM_PINS (ZL3073X_NUM_INPUT_PINS + \ ZL3073X_NUM_OUTPUT_PINS) +#define ZL3073X_NCO_PIN_ID ZL3073X_NUM_PINS/* * Register address structure:
@@ -164,10 +166,18 @@#define ZL_DPLL_MODE_REFSEL_MODE_NCO 4#define ZL_DPLL_MODE_REFSEL_REF GENMASK(7, 4) +#define ZL_REG_DPLL_CTRL (_idx) \ + ZL_REG_IDX(_idx, 5, 0x05, 1, ZL3073X_MAX_CHANNELS, 4) +#define ZL_DPLL_CTRL_TIE_CLEAR BIT(0) +#define ZL_DPLL_CTRL_TOD_STEP_RST BIT(2) +#define ZL_DPLL_CTRL_NCO_AUTO_READ BIT(7) +#define ZL_REG_DPLL_DF_READ (_idx) \ ZL_REG_IDX(_idx, 5, 0x28, 1, ZL3073X_MAX_CHANNELS, 1)#define ZL_DPLL_DF_READ_SEM BIT(4)#define ZL_DPLL_DF_READ_REF_OFST BIT(3) +#define ZL_DPLL_DF_READ_CMD GENMASK(2, 0) +#define ZL_DPLL_DF_READ_CMD_ACC_I 4#define ZL_REG_DPLL_MEAS_CTRL ZL_REG(5, 0x50, 1)#define ZL_DPLL_MEAS_CTRL_EN BIT(0)
@@ -190,6 +200,7 @@#define ZL_REG_DPLL_DF_OFFSET_4 ZL_REG(7, 0x00, 6)#define ZL_REG_DPLL_DF_OFFSET (_idx) \ ((_idx) < 4 ? ZL_REG_DPLL_DF_OFFSET_03(_idx) : ZL_REG_DPLL_DF_OFFSET_4) +#define ZL_DPLL_DF_OFFSET_UNKNOWN S64_MIN/*********************************** * Register Page 9, Synth and Output
Signature · 1 line
2.53.0
Jakub Kicinski
maintainerRe: [PATCH net-next v5 3/4] dpll: zl3073x: add per-DPLL serialization lock
In reply to Ivan VeceraQuoted 2 lines · On Sun, 31 May 2026 21:44:22 +0200 Ivan Vecera wrote:
Add a per-DPLL mutex that serializes all operations on a given DPLL channel across DPLL netlink callbacks, the periodic kthread worker,
Sounds like there are already two entities accessing the state? If so why is this not a fix?
Quoted 1 line
and (in subsequent patches) PTP clock callbacks.
Jakub Kicinski
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Ivan VeceraQuoted 5 lines · On Sun, 31 May 2026 21:44:20 +0200 Ivan Vecera wrote:
Add
DPLL_PIN_TYPE_INT_NCOpin type for virtual pins representing the NCO mode of a DPLL. When connected as a DPLL input, the DPLL enters NCO mode where the output frequency is adjusted by the host via the PTP clock interface.
Quoted 7 lines
Update the fractional-frequency-offset and fractional-frequency- offset-ppt attribute documentation to note that for
INT_NCOpins these attributes represent the DPLL's current output frequency offset from its nominal frequency.Reviewed-by Jiri Pirko <[email protected]>Signed-off-by Ivan Vecera <[email protected]>
Purely going on intuition here but feels like NCO should be a mode (enum dpll_mode) rather than one of the input pins?
More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
Quoted 87 lines
v2:
- Clarify int-nco pin type documentation to describe frequency control via the PTP clock interface instead of generic "controlled by the host".
- Tighten FFO attribute documentation forINT_NCOpins to describe the DPLL's output frequency offset from nominal frequency.
- Mention both fractional-frequency-offset (PPM) and fractional-frequency-offset-ppt attributes in the commit message.--- Documentation/netlink/specs/dpll.yaml | 13 +++++++++++++ drivers/dpll/dpll_nl.c | 2 +- include/uapi/linux/dpll.h | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-)Documentation/netlink/specs/dpll.yaml +13
-0@@ -162,6 +162,13 @@ definitions: - name: gnss doc: GNSS recovered clock + - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface. render-max: true - type: enum@@ -453,6 +460,9 @@ attribute-sets: offset on the media associated with the pin. Inside the pin-parent-device nest it represents the frequency offset between the pin and its parent DPLL device. + For pins of type PIN_TYPE_INT_NCO this represents + the DPLL's current output frequency offset from its + nominal frequency. Value is in PPM (parts per million). This is a lower-precision version of fractional-frequency-offset-ppt.@@ -499,6 +509,9 @@ attribute-sets: offset on the media associated with the pin. Inside the pin-parent-device nest it represents the frequency offset between the pin and its parent DPLL device. + For pins of type PIN_TYPE_INT_NCO this represents + the DPLL's current output frequency offset from its + nominal frequency. Value is in PPT (parts per trillion, 10^-12). This is a higher-precision version of fractional-frequency-offset.drivers/dpll/dpll_nl.c +1
-1@@ -61,7 +61,7 @@ static const struct nla_policy dpll_pin_id_get_nl_policy[DPLL_A_PIN_TYPE + 1] = [DPLL_A_PIN_BOARD_LABEL] = { .type = NLA_NUL_STRING, }, [DPLL_A_PIN_PANEL_LABEL] = { .type = NLA_NUL_STRING, }, [DPLL_A_PIN_PACKAGE_LABEL] = { .type = NLA_NUL_STRING, }, - [DPLL_A_PIN_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 5), + [DPLL_A_PIN_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 6), };/* DPLL_CMD_PIN_GET - do */ include/uapi/linux/dpll.h +4
-0@@ -127,6 +127,9 @@ enum dpll_type {* @DPLL_PIN_TYPE_SYNCE_ETH_PORT: ethernet port PHY's recovered clock * @DPLL_PIN_TYPE_INT_OSCILLATOR: device internal oscillator * @DPLL_PIN_TYPE_GNSS: GNSS recovered clock +* @DPLL_PIN_TYPE_INT_NCO: Device internal numerically controlled oscillator. +* When connected as a DPLL input, the DPLL enters NCO mode where the output +* frequency is adjusted by the host via the PTP clock interface. */ enum dpll_pin_type {DPLL_PIN_TYPE_MUX =1 ,@@ -134,6 +137,7 @@ enum dpll_pin_type {DPLL_PIN_TYPE_SYNCE_ETH_PORT ,DPLL_PIN_TYPE_INT_OSCILLATOR ,DPLL_PIN_TYPE_GNSS , +DPLL_PIN_TYPE_INT_NCO ,/* private: */ __DPLL_PIN_TYPE_MAX,
Jakub Kicinski
maintainerRe: [PATCH net-next v5 3/4] dpll: zl3073x: add per-DPLL serialization lock
In reply to Ivan VeceraThis is an AI-generated review of your patch. The human sending this email says "While we wait for more acks - claude says.."
---
dpll: zl3073x: add per-DPLL serialization lock
This patch adds a per-DPLL mutex serializing netlink callbacks and the periodic worker, moves zl3073x_chan_state_update() under the new lock, defers change notifications outside the lock to avoid ABBA with dpll_lock, and converts pin->freq_offset from atomic64_t to plain s64.
Quoted 21 lines
drivers/dpll/zl3073x/core.c +0
-12@@ -567,19 +567,7 @@ zl3073x_dev_ref_states_update(struct zl3073x_dev *zldev) } } -static void -zl3073x_dev_chan_states_update (struct zl3073x_dev *zldev) -{ -int i, rc; -for (i =0 ; i < zldev->info->num_channels; i++) { - rc =zl3073x_chan_state_update (zldev, i); -if (rc) -dev_warn (zldev->dev, -"Failed to get DPLL%u state: %pe\n" , i, -ERR_PTR (rc)); - } -}
[ ... ]
Quoted 4 lines
drivers/dpll/zl3073x/dpll.c +0
-0
[ ... ]
Quoted 17 lines
drivers/dpll/zl3073x/dpll.c +6
-0@@ -1817,27 +1906,37 @@ zl3073x_dpll_pin_measured_freq_check(struct zl3073x_dpll_pin *pin)void zl3073x_dpll_changes_check (struct zl3073x_dpll *zldpll) { +DECLARE_BITMAP (changed_pins,ZL3073X_NUM_INPUT_PINS );struct zl3073x_dev *zldev = zldpll->dev;enum dpll_lock_status lock_status;struct device *dev = zldev->dev;struct zl3073x_dpll_pin *pin; +bool dev_changed = false;int rc; +bitmap_zero (changed_pins,ZL3073X_NUM_INPUT_PINS ); + +mutex_lock (&zldpll->lock); + zldpll->check_count++;
drivers/dpll/zl3073x/dpll.c zl3073x_dpll_pin_measured_freq_check(struct zl3073x_dpll_pin *pin) · line 1928
Quoted 10 lines
drivers/dpll/zl3073x/dpll.c +6
-3-/* Get current lock status for the DPLL */ - rc =zl3073x_dpll_lock_status_get (zldpll->dpll_dev, zldpll, - &lock_status,NULL ,NULL ); + rc =zl3073x_chan_state_update (zldev, zldpll->id); +if (rc) { +dev_err (dev,"Failed to get DPLL%u state: %pe\n" , + zldpll->id,ERR_PTR (rc)); + goto unlock; + }
[Low]
The previous code path, zl3073x_dev_chan_states_update() in core.c, used dev_warn() and continued the periodic update for the device, allowing the subsequent lock-status, phase-offset and per-pin checks to run for every DPLL even when an individual chan_state_update() failed.
After this change, a single failure of zl3073x_chan_state_update() inside zl3073x_dpll_changes_check() is logged at dev_err and triggers goto unlock, skipping all remaining work for that DPLL in that cycle:
rc = zl3073x_chan_state_update(zldev, zldpll->id);
if (rc) {
dev_err(dev, "Failed to get DPLL%u state: %pe\n",
zldpll->id, ERR_PTR(rc));
goto unlock;
}The commit message describes the move only as a serialization change so that it "runs under zldpll->lock". Should the log-level promotion from warn to err and the new short-circuit of the rest of the cycle on transient register-read failures be mentioned in the commit message, or alternatively preserved as warn-and-continue?
Quoted 8 lines
drivers/dpll/zl3073x/dpll.c +3
-1+ + rc =__zl3073x_dpll_lock_status_get (zldpll, &lock_status);if (rc) {dev_err (dev,"Failed to get DPLL%u lock status: %pe\n" , zldpll->id,ERR_PTR (rc)); -return ; + goto unlock; }
[ ... ]
Quoted 1 line
}
The commit message states:
All DPLL pin and device callbacks that access mutable state take the lock as the first operation.
[Low]
Does this hold for zl3073x_dpll_freq_monitor_get() and zl3073x_dpll_freq_monitor_set()? Both are device callbacks that read or write zldpll->dev->freq_monitor, but neither takes zldpll->lock:
static int
zl3073x_dpll_freq_monitor_get(const struct dpll_device *dpll, ...)
{
struct zl3073x_dpll *zldpll = dpll_priv;
if (zldpll->dev->freq_monitor)
*state = DPLL_FEATURE_STATE_ENABLE;
else
*state = DPLL_FEATURE_STATE_DISABLE;
return 0;
}
static int
zl3073x_dpll_freq_monitor_set(const struct dpll_device *dpll, ...)
{
struct zl3073x_dpll *item, *zldpll = dpll_priv;
zldpll->dev->freq_monitor = (state == DPLL_FEATURE_STATE_ENABLE);
...
}The same field is read in zl3073x_dpll_pin_measured_freq_check() under lockdep_assert_held(&zldpll->lock):
static bool
zl3073x_dpll_pin_measured_freq_check(struct zl3073x_dpll_pin *pin)
{
...
lockdep_assert_held(&zldpll->lock);
if (!zldpll->dev->freq_monitor)
return false;
...
}freq_monitor is a per-device bool shared by all channels, so the per-DPLL lock would not provide cross-DPLL serialization for it anyway. Should the commit message carve out an exception for this per-device field, or should some appropriate lock be taken in the freq_monitor get/set callbacks to match the stated invariant?
Ivan Vecera
maintainerRe: [PATCH net-next v5 3/4] dpll: zl3073x: add per-DPLL serialization lock
In reply to Jakub KicinskiQuoted 6 lines · Jakub Kicinski
Quoted 2 lines · On Sun, 31 May 2026 21:44:22 +0200 Ivan Vecera wrote:
Add a per-DPLL mutex that serializes all operations on a given DPLL channel across DPLL netlink callbacks, the periodic kthread worker,
Sounds like there are already two entities accessing the state? If so why is this not a fix?
Yes, but prior NCO pin implementation (patch 4) this was not a problem.
1. All DPLL callbacks are serialized by the DPLL subsys mutex and they
- read status and measurements from cache (ref, chan, out and synth)
- writes config into HW and cache
2. Periodic function
- reads config from cache (...)
- reads status and measurements from HW and writes to cache (...)
- emits notifications when something was changed
All accesses to cache objects' fields are atomic.
With patch 4 there is a change because at least df_offset can be written by both (DPLL callback during switching or periodic function during measurement). At this point it is reasonable and safe to do explicit locking on DPLL level.
And the next series I have in my queue (that depends on this series) introduces the PHC support into zl3073x and there will be a need to serialize DPLL and PTP callbacks.
Thanks,
Ivan
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Jakub KicinskiQuoted 11 lines · Jakub Kicinski
Quoted 10 lines · On Sun, 31 May 2026 21:44:20 +0200 Ivan Vecera wrote:
Add
DPLL_PIN_TYPE_INT_NCOpin type for virtual pins representing the NCO mode of a DPLL. When connected as a DPLL input, the DPLL enters NCO mode where the output frequency is adjusted by the host via the PTP clock interface.Update the fractional-frequency-offset and fractional-frequency- offset-ppt attribute documentation to note that for
INT_NCOpins these attributes represent the DPLL's current output frequency offset from its nominal frequency.
Quoted 7 lines
Quoted 2 lines
Reviewed-by Jiri Pirko <[email protected]>Signed-off-by Ivan Vecera <[email protected]>Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that dpll_mode represents a reference (input pin) selection strategy mode and not a DPLL device running mode.
See [1]
Thanks,
Ivan
Ivan Vecera
maintainerRe: [PATCH net-next v5 3/4] dpll: zl3073x: add per-DPLL serialization lock
In reply to Jakub KicinskiHi Kuba,
Quoted 59 lines · Jakub Kicinski
This is an AI-generated review of your patch. The human sending this email says "While we wait for more acks - claude says.."
---
dpll: zl3073x: add per-DPLL serialization lockThis patch adds a per-DPLL mutex serializing netlink callbacks and the periodic worker, moves
zl3073x_chan_state_update()under the new lock, defers change notifications outside the lock to avoid ABBA withdpll_lock, and convertspin->freq_offsetfromatomic64_tto plain s64.Quoted 21 lines
drivers/dpll/zl3073x/core.c +0
-12@@ -567,19 +567,7 @@ zl3073x_dev_ref_states_update(struct zl3073x_dev *zldev) } } -static void -zl3073x_dev_chan_states_update (struct zl3073x_dev *zldev) -{ -int i, rc; -for (i =0 ; i < zldev->info->num_channels; i++) { - rc =zl3073x_chan_state_update (zldev, i); -if (rc) -dev_warn (zldev->dev, -"Failed to get DPLL%u state: %pe\n" , i, -ERR_PTR (rc)); - } -}[ ... ]
Quoted 4 lines
drivers/dpll/zl3073x/dpll.c +0
-0[ ... ]
Quoted 18 lines
drivers/dpll/zl3073x/dpll.c +6
-0@@ -1817,27 +1906,37 @@ zl3073x_dpll_pin_measured_freq_check(struct zl3073x_dpll_pin *pin)void zl3073x_dpll_changes_check (struct zl3073x_dpll *zldpll) { +DECLARE_BITMAP (changed_pins,ZL3073X_NUM_INPUT_PINS );struct zl3073x_dev *zldev = zldpll->dev;enum dpll_lock_status lock_status;struct device *dev = zldev->dev;struct zl3073x_dpll_pin *pin; +bool dev_changed = false;int rc; +bitmap_zero (changed_pins,ZL3073X_NUM_INPUT_PINS ); + +mutex_lock (&zldpll->lock); + zldpll->check_count++;
Quoted 15 lines
drivers/dpll/zl3073x/dpll.c zl3073x_dpll_pin_measured_freq_check(struct zl3073x_dpll_pin *pin) · line 1928
Quoted 9 lines
drivers/dpll/zl3073x/dpll.c +6
-3-/* Get current lock status for the DPLL */ - rc =zl3073x_dpll_lock_status_get (zldpll->dpll_dev, zldpll, - &lock_status,NULL ,NULL ); + rc =zl3073x_chan_state_update (zldev, zldpll->id); +if (rc) { +dev_err (dev,"Failed to get DPLL%u state: %pe\n" , + zldpll->id,ERR_PTR (rc)); + goto unlock; + }[Low]
The previous code path,zl3073x_dev_chan_states_update()incore.c, useddev_warn()and continued the periodic update for the device, allowing the subsequent lock-status, phase-offset and per-pin checks to run for every DPLL even when an individualchan_state_update()failed.
Well, any error zl3073x_chan_state_update() are very very unusual and if they happen (communication error, timeout) then it means that the device hangs or there is an bus (I2C controller) error.
Quoted 11 lines
After this change, a single failure of
zl3073x_chan_state_update()insidezl3073x_dpll_changes_check()is logged atdev_errand triggers goto unlock, skipping all remaining work for that DPLL in that cycle:rc = zl3073x_chan_state_update(zldev, zldpll->id); if (rc) { dev_err(dev, "Failed to get DPLL%u state: %pe\n", zldpll->id, ERR_PTR(rc)); goto unlock; }
Quoted 5 lines
The commit message describes the move only as a serialization change so that it "runs under
zldpll->lock". Should the log-level promotion from warn to err and the new short-circuit of the rest of the cycle on transient register-read failures be mentioned in the commit message, or alternatively preserved as warn-and-continue?
I think the error is more appropriate in this case.
Quoted 59 lines
Quoted 8 lines
drivers/dpll/zl3073x/dpll.c +3
-1+ + rc =__zl3073x_dpll_lock_status_get (zldpll, &lock_status);if (rc) {dev_err (dev,"Failed to get DPLL%u lock status: %pe\n" , zldpll->id,ERR_PTR (rc)); -return ; + goto unlock; }[ ... ]
Quoted 1 line
}The commit message states:
All DPLL pin and device callbacks that access mutable state take the lock as the first operation.
[Low]
Does this hold forzl3073x_dpll_freq_monitor_get()andzl3073x_dpll_freq_monitor_set()? Both are device callbacks that read or writezldpll->dev->freq_monitor, but neither takeszldpll->lock:static int zl3073x_dpll_freq_monitor_get(const struct dpll_device *dpll, ...) { struct zl3073x_dpll *zldpll = dpll_priv; if (zldpll->dev->freq_monitor) *state = DPLL_FEATURE_STATE_ENABLE; else *state = DPLL_FEATURE_STATE_DISABLE; return 0; } static int zl3073x_dpll_freq_monitor_set(const struct dpll_device *dpll, ...) { struct zl3073x_dpll *item, *zldpll = dpll_priv; zldpll->dev->freq_monitor = (state == DPLL_FEATURE_STATE_ENABLE); ... }The same field is read in
zl3073x_dpll_pin_measured_freq_check()underlockdep_assert_held(&zldpll->lock):static bool zl3073x_dpll_pin_measured_freq_check(struct zl3073x_dpll_pin *pin) { ... lockdep_assert_held(&zldpll->lock); if (!zldpll->dev->freq_monitor) return false; ... }
Quoted 5 lines
freq_monitoris a per-device bool shared by all channels, so the per-DPLL lock would not provide cross-DPLL serialization for it anyway. Should the commit message carve out an exception for this per-device field, or should some appropriate lock be taken in thefreq_monitorget/set callbacks to match the stated invariant?
The assert is not for serializing accesses to zldpll->dev->*_monitor and could be moved below this 'if'... Do you want to move it?
Regarding cross-DPLL serialization, IMHO this is an overkill just for toggles like zldpll->dev->freq_monitor.
Thoughts?
Thanks,
Ivan
Jakub Kicinski
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Ivan VeceraQuoted 8 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.
Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 6 lines · Jakub Kicinski
Quoted 5 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
Quoted 7 lines
Quoted 3 lines
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
I called him... he explained me 'why?' in detail.
I also appreciate others' opinion.
I.
Vadim Fedorenko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 11 lines · Ivan Vecera
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.
Quoted 6 lines
Quoted 3 lines
Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
I called him... he explained me 'why?' in detail.
I also appreciate others' opinion.
Well, NCO mode means manual operation of frequency tuning. Does it mean that different tunings may be applied to different out pins of DPLL device? My assumption that it's not possible, and in this case NCO is property/mode of DPLL device rather than single pin.
@Jiri could you please share your detailed explanation on "why"?
Kubalewski, Arkadiusz
maintainerRE: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Ivan VeceraQuoted 36 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PMAdd
DPLL_PIN_TYPE_INT_NCOpin type for virtual pins representing the NCO mode of a DPLL. When connected as a DPLL input, the DPLL enters NCO mode where the output frequency is adjusted by the host via the PTP clock interface.Update the fractional-frequency-offset and fractional-frequency- offset- ppt attribute documentation to note that for
INT_NCOpins these attributes represent the DPLL's current output frequency offset from its nominal frequency.Reviewed-by Jiri Pirko <[email protected]>Signed-off-by Ivan Vecera <[email protected]>---
v2:
- Clarify int-nco pin type documentation to describe frequency control via the PTP clock interface instead of generic "controlled by the host".
- Tighten FFO attribute documentation forINT_NCOpins to describe the DPLL's output frequency offset from nominal frequency.
- Mention both fractional-frequency-offset (PPM) and fractional-frequency-offset-ppt attributes in the commit message.
---Documentation/netlink/specs/dpll.yaml | 13 +++++++++++++ drivers/dpll/dpll_nl.c | 2 +- include/uapi/linux/dpll.h | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-)Documentation/netlink/specs/dpll.yaml +0
-0
Documentation/netlink/specs/dpll.yaml definitions: · line 171
Quoted 10 lines
Documentation/netlink/specs/dpll.yaml +7
-0@@ -162,6 +162,13 @@ definitions: - name: gnss doc: GNSS recovered clock + - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.
Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Such NCO mode/pin is designed only for this single specific use case where a timecard contains a DPLL and PHC?
Any diagram?
Is there any other use case for such pin? (NCO is rather a general DPLL control mechanism?) Shouldn't it be called explicitly like ptp-nco?
Thank you!
Arkadiusz
Quoted 63 lines
Documentation/netlink/specs/dpll.yaml +6
-0render-max: true - type: enum@@ -453,6 +460,9 @@ attribute-sets: offset on the media associated with the pin. Inside the pin-parent-device nest it represents the frequency offset between the pin and its parent DPLL device. + For pins of type PIN_TYPE_INT_NCO this represents + the DPLL's current output frequency offset from its + nominal frequency. Value is in PPM (parts per million). This is a lower-precision version of fractional-frequency-offset-ppt.@@ -499,6 +509,9 @@ attribute-sets: offset on the media associated with the pin. Inside the pin-parent-device nest it represents the frequency offset between the pin and its parent DPLL device. + For pins of type PIN_TYPE_INT_NCO this represents + the DPLL's current output frequency offset from its + nominal frequency. Value is in PPT (parts per trillion, 10^-12). This is a higher-precision version of fractional-frequency-offset.drivers/dpll/dpll_nl.c index renamed from drivers/dpll/dpll_nl.c +0
-0
b1d9182c7802f..2dab99202764f100644drivers/dpll/dpll_nl.c +0
-0@@ -61,7 +61,7 @@ static const struct nla_policydpll_pin_id_get_nl_policy[DPLL_A_PIN_TYPE + 1] =
[DPLL_A_PIN_BOARD_LABEL] = { .type = NLA_NUL_STRING, }, [DPLL_A_PIN_PANEL_LABEL] = { .type = NLA_NUL_STRING, }, [DPLL_A_PIN_PACKAGE_LABEL] = { .type = NLA_NUL_STRING, },drivers/dpll/dpll_nl.c +1
-1- [DPLL_A_PIN_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 5), + [DPLL_A_PIN_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 6),};
/*
DPLL_CMD_PIN_GET- do */include/uapi/linux/dpll.h index renamed from include/uapi/linux/dpll.h +0
-0
cb363cccf2e2a..9245827de3cfd100644include/uapi/linux/dpll.h +1
-0@@ -127,6 +127,9 @@ enum dpll_type {* @DPLL_PIN_TYPE_SYNCE_ETH_PORT: ethernet port PHY's recovered clock * @DPLL_PIN_TYPE_INT_OSCILLATOR: device internal oscillator * @DPLL_PIN_TYPE_GNSS: GNSS recovered clock +* @DPLL_PIN_TYPE_INT_NCO: Device internal numerically controlled oscillator.
+ * When connected as a DPLL input, the DPLL enters NCO mode where the
output
+ * frequency is adjusted by the host via the PTP clock interface.
*/enum dpll_pin_type { DPLL_PIN_TYPE_MUX = 1,include/uapi/linux/dpll.h +1
-1@@ -134,6 +137,7 @@ enum dpll_pin_type {DPLL_PIN_TYPE_SYNCE_ETH_PORT ,DPLL_PIN_TYPE_INT_OSCILLATOR ,DPLL_PIN_TYPE_GNSS , +DPLL_PIN_TYPE_INT_NCO ,/* private: */ __DPLL_PIN_TYPE_MAX, --2.53.0
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Vadim FedorenkoQuoted 16 lines · Vadim Fedorenko
Quoted 15 lines · Ivan Vecera
Quoted 13 lines · Jakub Kicinski
Quoted 8 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
Quoted 7 lines
Quoted 2 lines
I called him... he explained me 'why?' in detail.
I also appreciate others' opinion.Well, NCO mode means manual operation of frequency tuning. Does it mean that different tunings may be applied to different out pins of DPLL device? My assumption that it's not possible, and in this case NCO is property/mode of DPLL device rather than single pin.
The NCO pin is only one per device... When it is connected, then the device the pin is connected to is switched to NCO mode. In this mode the device is not locked to any input reference and the driver allows tuning of the DPLL frequency manually via PTP interface.
Such tuning is applied only to output pins associated with this device but not on others.
Examples:
DPLL0 is driving output 0-3 and DPLL1 is driving output 4-7. Then if you switch the DPLL0 to NCO mode (makes NCO pin connected to it) then frequency tuning (via PTP) has only influence on output 0-3 (the same tuning is applied). Outputs 4-7 are not touched as they are driven by DPLL1 (that can be locked to some input reference).
If you switch both DPLLs to NCO, then frequency tuning for DPLL0 affects output 0-3 and tuning for DPLL1 output 4-7.
Thanks,
Ivan
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Kubalewski, ArkadiuszQuoted 14 lines · Arkadiusz
Documentation/netlink/specs/dpll.yaml definitions: · line 171
Quoted 13 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM
...
-
name: gnss
doc: GNSS recovered clockDocumentation/netlink/specs/dpll.yaml +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.
Quoted 6 lines
Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
If the DPLL device is in automatic mode then a user has to switch the device to manual mode and then manually set the NCO pin as connected.
Quoted 2 lines
Such NCO mode/pin is designed only for this single specific use case where a timecard contains a DPLL and PHC?
This is designed for a HW where DPLL channels (devices) support ToD counters (can act as PHC besides DPLL functionality) and support the mode where DPLL is not locked to any physical input and allows tuning of its frequency.
Quoted 5 lines
Any diagram?
Is there any other use case for such pin? (NCO is rather a general DPLL control mechanism?) Shouldn't it be called explicitly like ptp-nco?
I discussed this with Jiri and result was:
- DPLL_MODE is input selection strategy
- NCO is a case of manual selection strategy
And *_INT_PTP_NCO or *_PTP_NCO?
Yes, this could be reasonable... I can't think of anything else to use other than PTP... for now (can be changed in future).
Thanks,
Ivan
Kubalewski, Arkadiusz
maintainerRE: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 20 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 16 lines · Arkadiusz
Documentation/netlink/specs/dpll.yaml definitions: · line 171
Quoted 13 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM
...
-
name: gnss
doc: GNSS recovered clockDocumentation/netlink/specs/dpll.yaml +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
Quoted 8 lines
Quoted 4 lines
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on DPLL_MODE for enabling feature is not something we can allow if it is not related to HW limitation, is it?
Could you please elaborate why it is not possible for AUTOMATIC mode?
Quoted 2 lines
If the DPLL device is in automatic mode then a user has to switch the device to manual mode and then manually set the NCO pin as connected.
From this perspective seems to me like a device mode not a new pin. If I have pin I can automatically switch to it.
Quoted 10 lines
Quoted 3 lines
Such NCO mode/pin is designed only for this single specific use case where a timecard contains a DPLL and PHC?
This is designed for a HW where DPLL channels (devices) support ToD counters (can act as PHC besides DPLL functionality) and support the mode where DPLL is not locked to any physical input and allows tuning of its frequency.
Quoted 1 line
Any diagram?
?
Quoted 8 lines
Quoted 4 lines
Is there any other use case for such pin? (NCO is rather a general DPLL control mechanism?) Shouldn't it be called explicitly like ptp-nco?
I discussed this with Jiri and result was:
-DPLL_MODEis input selection strategy
- NCO is a case of manual selection strategy
Quoted 7 lines
And
*_INT_PTP_NCOor*_PTP_NCO?Yes, this could be reasonable... I can't think of anything else to use other than PTP... for now (can be changed in future).
Thanks,
Ivan
Yeah but let's close the previous thingy,
Thank you!
Arkadiusz
Jiri Pirko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 25 lines · Mon, Jun 08, 2026 at 07:03:46PM +0200, [email protected] wrote:
Quoted 25 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 20 lines · Arkadiusz
Documentation/netlink/specs/dpll.yaml definitions: · line 171
Quoted 13 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM
...
-
name: gnss
doc: GNSS recovered clockDocumentation/netlink/specs/dpll.yaml +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 7 lines
Quoted 3 lines
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it?
Could you please elaborate why it is not possible for AUTOMATIC mode?
In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour. Is there a real usecase for it?
[..]
Vadim Fedorenko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Ivan VeceraQuoted 40 lines · Ivan Vecera
Quoted 16 lines · Vadim Fedorenko
Quoted 15 lines · Ivan Vecera
Quoted 13 lines · Jakub Kicinski
Quoted 8 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
Quoted 7 lines
Quoted 2 lines
I called him... he explained me 'why?' in detail.
I also appreciate others' opinion.Well, NCO mode means manual operation of frequency tuning. Does it mean that different tunings may be applied to different out pins of DPLL device? My assumption that it's not possible, and in this case NCO is property/mode of DPLL device rather than single pin.
The NCO pin is only one per device... When it is connected, then the device the pin is connected to is switched to NCO mode. In this mode the device is not locked to any input reference and the driver allows tuning of the DPLL frequency manually via PTP interface.
Such tuning is applied only to output pins associated with this device but not on others.
Examples:
DPLL0 is driving output 0-3 and DPLL1 is driving output 4-7. Then if you switch the DPLL0 to NCO mode (makes NCO pin connected to it) then frequency tuning (via PTP) has only influence on output 0-3 (the same tuning is applied). Outputs 4-7 are not touched as they are driven by DPLL1 (that can be locked to some input reference).
Quoted 2 lines
If you switch both DPLLs to NCO, then frequency tuning for DPLL0 affects output 0-3 and tuning for DPLL1 output 4-7.
Technically speaking you have described per-device behavior. And NCO pin can technically be virtual, just a configuration option via normal device communication channel. Doesn't feel like pin's attribute. Back in a days of DPLL RFC patches we have discussed the option with Arkadiusz, AFAIR we were leaning towards per-DPLL state for this case.
Jiri Pirko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Vadim FedorenkoQuoted 19 lines · Mon, Jun 08, 2026 at 01:33:56PM +0200, [email protected] wrote:
Quoted 11 lines · Ivan Vecera
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.Quoted 6 lines
Quoted 3 lines
Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
I called him... he explained me 'why?' in detail.
I also appreciate others' opinion.
Quoted 6 lines
Well, NCO mode means manual operation of frequency tuning. Does it mean that different tunings may be applied to different out pins of DPLL device? My assumption that it's not possible, and in this case NCO is property/mode of DPLL device rather than single pin.
@Jiri could you please share your detailed explanation on "why"?
Since the "why a pin and not a new dpll_mode?" question keeps coming up, let me try to describe why I believe that modelling NCO as an input pin (DPLL_PIN_TYPE_INT_NCO) is the right thing to do.
In the DPLL UAPI, 'mode' only describes the *input selection policy*:
MANUAL means userspace picks which input the loop locks to, AUTOMATIC means the DPLL auto-selects the highest-priority input. I know there was some fuzz about this semantics in the early stages of upstreaming DPLL subsystem, but eventually this became very clear both in code and in kdoc:
<qoute>
* enum dpll_mode - working modes a dpll can support, differentiates if and how
* dpll selects one of its inputs to syntonize with it, valid values for
* DPLL_A_MODE attribute
</quote>
NCO *is not* a third selection policy - it is just another *source* the loop is disciplined from. Except the source is steered by the host (via the PHC .adjfine() path) instead of being an external reference. Think of it as a virtual pin of some sort.
The object we already use for "a source the DPLL can lock to" is a pin, so an internal NCO belongs right next to DPLL_PIN_TYPE_INT_OSCILLATOR, which is already existing example of a similar virtual pin.
By having NCO as an input pin we reuse the existing model instead of inventing a parallel one. "Run as NCO" becomes "connect the NCO input" using the same connect/disconnect, pin state and pin-dump infrastructure as any other input. No new control surface, and it stays orthogonal to
mode: we don't have to define what AUTOMATIC+NCO or pin priorities mean, and we don't grow enum dpll_mode and the supported-modes bitmask that every mode-aware consumer would then have to relearn.
For the pin info uAPI exposure we reuse the attributes pins already have
- the output frequency offset from nominal is reported via the pin's fractional-frequency-offset / -ppt. A new device mode would need brand new device-level attributes for the same information.
Having said that, I think it's a perfect fit. The only "real" pull towards a new mode is that vendor datasheets call this NCO/DCO a "mode". But that is HW register terminology and we learned many times in the past that may be more or less misleading/incorrect wrt the uAPI.
Therefore my strong preference is DPLL_PIN_TYPE_INT_NCO, no new mode. Honestly, I don't really understand why it would make even little sense to have this as new mode. Perhaps I'm missing something, if you can describe it, that would be awesome.
Thanks!
Jiri
Kubalewski, Arkadiusz
maintainerRE: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Jiri PirkoQuoted 38 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200, [email protected]
Quoted 25 lines · wrote:
Quoted 25 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 20 lines · Arkadiusz
Documentation/netlink/specs/dpll.yaml definitions: · line 171
Quoted 13 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM
...
-
name: gnss
doc: GNSS recovered clockDocumentation/netlink/specs/dpll.yaml +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 7 lines
Quoted 3 lines
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it?
Could you please elaborate why it is not possible for AUTOMATIC mode?
Quoted 6 lines
In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour. Is there a real usecase for it?
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 43 lines · Arkadiusz
Quoted 43 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200, [email protected]
Quoted 25 lines · wrote:
Quoted 25 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 20 lines · Arkadiusz
Documentation/netlink/specs/dpll.yaml definitions: · line 171
Quoted 13 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM
...
-
name: gnss
doc: GNSS recovered clockDocumentation/netlink/specs/dpll.yaml +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 7 lines
Quoted 3 lines
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it?
Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour. Is there a real usecase for it?
Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Correct, AUTO mode is hardware feature and it should not be emulated by a driver. If the hardware does not support it then the switching between input references should be done by userspace (by monitoring ffo, phase_offset, operstate).
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose prio_get() and prio_set() callbacks - so it is clear that this pin cannot be part of the automatic selection.
Ivan
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Vadim FedorenkoQuoted 41 lines · Vadim Fedorenko
Quoted 40 lines · Ivan Vecera
Quoted 16 lines · Vadim Fedorenko
Quoted 15 lines · Ivan Vecera
Quoted 13 lines · Jakub Kicinski
Quoted 8 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
Quoted 7 lines
Quoted 2 lines
I called him... he explained me 'why?' in detail.
I also appreciate others' opinion.Well, NCO mode means manual operation of frequency tuning. Does it mean that different tunings may be applied to different out pins of DPLL device? My assumption that it's not possible, and in this case NCO is property/mode of DPLL device rather than single pin.
The NCO pin is only one per device... When it is connected, then the device the pin is connected to is switched to NCO mode. In this mode the device is not locked to any input reference and the driver allows tuning of the DPLL frequency manually via PTP interface.
Such tuning is applied only to output pins associated with this device but not on others.
Examples:
DPLL0 is driving output 0-3 and DPLL1 is driving output 4-7. Then if you switch the DPLL0 to NCO mode (makes NCO pin connected to it) then frequency tuning (via PTP) has only influence on output 0-3 (the same tuning is applied). Outputs 4-7 are not touched as they are driven by DPLL1 (that can be locked to some input reference).
Quoted 8 lines
Quoted 2 lines
If you switch both DPLLs to NCO, then frequency tuning for DPLL0 affects output 0-3 and tuning for DPLL1 output 4-7.
Technically speaking you have described per-device behavior. And NCO pin can technically be virtual, just a configuration option via normal device communication channel. Doesn't feel like pin's attribute. Back in a days of DPLL RFC patches we have discussed the option with Arkadiusz, AFAIR we were leaning towards per-DPLL state for this case.
Frequency fine tuning is not the subject of this patchset. It is currently part of the PTP API via the .adjfine() callback. I have not added this feature yet, because it would be a duplication of part of the PTP API, but if there is a consensus, we can add it as a per-device attribute.
Something like dpll device attributes:
* fractional-frequency-adjust
- corresponds to .adjfine()
- tunes dpll device frequency (usable mostly in NCO mode because when the device is locked to physical reference then its frequency is driven by this ref)
* phase-adjust
- corresponds to .adjphase()
- adjusts phase of all outputs driven by this dpll device performed at once
Thanks,
Ivan
Kubalewski, Arkadiusz
maintainerRE: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Ivan VeceraQuoted 56 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 44 lines · Arkadiusz
Quoted 44 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200, [email protected]
Quoted 24 lines · wrote:
Quoted 24 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 19 lines · Arkadiusz
Review
Quoted 12 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock(quoted diff) +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 8 lines
Quoted 4 lines
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 5 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a driver. If the hardware does not support it then the switching between input references should be done by userspace (by monitoring ffo,
phase_offset, operstate).
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement all features consistently.
Quoted 10 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the proposed API we would disallow the possibility of such implementation for existing HW variants.
DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in the other email it would also require the extra implementation for some configuration - device level phase/ffo handling.
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
Basically, if driver registers such NCO pin it would be always selected manually, and in such case all the other pins are going to disconnected state while DPLL mode is also a "OVERRIDE" or something like it.
Perhaps the pin type could include OVERRIDE in it's name to make it less confusing and needs some extra documentation.
Thoughts?
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 62 lines · Arkadiusz
Quoted 56 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 44 lines · Arkadiusz
Quoted 44 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200, [email protected]
Quoted 24 lines · wrote:
Quoted 24 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 19 lines · Arkadiusz
Review
Quoted 12 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock(quoted diff) +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 8 lines
Quoted 4 lines
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 5 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a driver. If the hardware does not support it then the switching between input references should be done by userspace (by monitoring ffo,
phase_offset, operstate).
Quoted 6 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement all features consistently.
If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else leave_nco) then it could be possible to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.
Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 19 lines
Quoted 10 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the proposed API we would disallow the possibility of such implementation for existing HW variants.
DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in the other email it would also require the extra implementation for some configuration - device level phase/ffo handling.
Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level so the driver decides if the requested state is correct or not. So it could be easy to implement this.
For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnected
Quoted 3 lines
Basically, if driver registers such NCO pin it would be always selected manually, and in such case all the other pins are going to disconnected state while DPLL mode is also a "OVERRIDE" or something like it.
I would leave this decision on the driver level... Imagine the potential HW that would allow to switch NCO mode if there is no valid input reference.
Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTn
Such HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 4 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less confusing and needs some extra documentation.
Thoughts?
I think _INT_ is ok. In the case of TYPE_INT_OSCILLATOR it is also obvious that it is not a standard input reference.
Jiri, Vadim, Arek, thoughts?
Thanks,
Ivan
Jiri Pirko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 133 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 62 lines · Arkadiusz
Quoted 56 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 44 lines · Arkadiusz
Quoted 44 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200, [email protected]
Quoted 24 lines · wrote:
Quoted 24 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 19 lines · Arkadiusz
Review
Quoted 12 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock(quoted diff) +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 8 lines
Quoted 4 lines
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 5 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a driver. If the hardware does not support it then the switching between input references should be done by userspace (by monitoring ffo,
phase_offset, operstate).Quoted 6 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else
leave_nco) then it could be possible to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 19 lines
Quoted 10 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the proposed API we would disallow the possibility of such implementation for existing HW variants.
DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in the other email it would also require the extra implementation for some configuration - device level phase/ffo handling.
Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level so the driver decides if the requested state is correct or not. So it could be easy to implement this.
For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 3 lines
Basically, if driver registers such NCO pin it would be always selected manually, and in such case all the other pins are going to disconnected state while DPLL mode is also a "OVERRIDE" or something like it.
I would leave this decision on the driver level... Imagine the potential HW that would allow to switch NCO mode if there is no valid input reference.
Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 8 lines
Quoted 4 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less confusing and needs some extra documentation.
Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.Jiri, Vadim, Arek, thoughts?
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin selection in AUTO mode using connected/disconnected override, let it have it.
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 143 lines · Jiri Pirko
Quoted 133 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 62 lines · Arkadiusz
Quoted 56 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 44 lines · Arkadiusz
Quoted 44 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200, [email protected]
Quoted 24 lines · wrote:
Quoted 24 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 19 lines · Arkadiusz
Review
Quoted 12 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock(quoted diff) +7
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCO mode + where the output frequency is adjusted by the host via + the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 8 lines
Quoted 4 lines
The NCO pin can be connected only in manual mode. In other words a DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by its own.
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 5 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a driver. If the hardware does not support it then the switching between input references should be done by userspace (by monitoring ffo,
phase_offset, operstate).Quoted 6 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else
leave_nco) then it could be possible to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 19 lines
Quoted 10 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the proposed API we would disallow the possibility of such implementation for existing HW variants.
DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in the other email it would also require the extra implementation for some configuration - device level phase/ffo handling.
Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level so the driver decides if the requested state is correct or not. So it could be easy to implement this.
For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 3 lines
Basically, if driver registers such NCO pin it would be always selected manually, and in such case all the other pins are going to disconnected state while DPLL mode is also a "OVERRIDE" or something like it.
I would leave this decision on the driver level... Imagine the potential HW that would allow to switch NCO mode if there is no valid input reference.
Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 8 lines
Quoted 4 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less confusing and needs some extra documentation.
Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.Jiri, Vadim, Arek, thoughts?
Quoted 9 lines
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin selection in AUTO mode using connected/disconnected override, let it have it.
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Arek? Vadim?
Thanks,
Ivan
Kubalewski, Arkadiusz
maintainerRE: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 155 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 15, 2026 2:00 PMQuoted 151 lines · Jiri Pirko
Quoted 150 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 70 lines · Arkadiusz
Quoted 62 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 50 lines · Arkadiusz
Quoted 50 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200,
[email protected]Quoted 33 lines · wrote:
Quoted 26 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 15 lines · Arkadiusz
Quoted 10 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock(quoted diff) +5
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCOQuoted 4 lines
mode
+ where the output frequency is adjusted by the host
via
+ the PTP clock interface.Quoted 6 lines
Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 6 lines
The NCO pin can be connected only in manual mode. In other words a
DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by
its own.Quoted 4 lines
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 7 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a
driver. If the hardware does not support it then the switching between
input references should be done by userspace (by monitoring ffo,phase_offset, operstate).Quoted 8 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create
such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement
all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else
leave_nco) then it could be possible
to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 25 lines
Quoted 4 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
Quoted 8 lines
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the
automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the
proposed API we would disallow the possibility of such implementation for
existing HW variants.DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in
the other email it would also require the extra implementation for some
configuration - device level phase/ffo handling.Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level
so the driver decides if the requested state is correct or not. So it could be easy to implement this.For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 5 lines
Basically, if driver registers such NCO pin it would be always selected
manually, and in such case all the other pins are going to disconnected
state while DPLL mode is also a "OVERRIDE" or something like it.I would leave this decision on the driver level... Imagine the potential
HW that would allow to switch NCO mode if there is no valid input reference.Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
Now you said yourself "NCO mode" ... I agree that it would be a mode in that case. Where instead of running on regular/built in XO dpll would run on NCO and user could select it, and this would be addition to regular behavior.
I also agree that the pin approach might be better/easier to use, assuming frequency offset for all the outputs given dpll drives, it makes more sense to have it configurable on input side.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 5 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less
confusing and needs some extra documentation.Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Jiri, Vadim, Arek, thoughts?
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin selection in AUTO mode using connected/disconnected override, let it have it.
I don't know 'current' HW that is capable of using AUTO mode as a part of HW-based priority source selection and use such NCO input.. But as already explained above, this is special mode of regular XO, which allows DPLL's output frequency offset configuration.
Quoted 8 lines
Quoted 4 lines
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Arek? Vadim?
Thanks,
Ivan
Agree, 'override' capability of a pin would be the way to go for this and other similar further cases.
I believe a single approach on this would be best, I mean if AUTO mode needs a capability, to switch from regular behavior to 'OVERRIDE', and 'OVERRIDE' is only pin capability that allows such behavior for AUTO mode, then similar approach should be used on MANUAL mode, to make userspace know that such pin is always available to set "CONNECTED" and make the userspace implementation consistent on enabling it no matter if AUTO or MANUAL mode dpll.
Thank you!
Arkadiusz
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 156 lines · Arkadiusz
Quoted 155 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 15, 2026 2:00 PMQuoted 151 lines · Jiri Pirko
Quoted 150 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 70 lines · Arkadiusz
Quoted 62 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 50 lines · Arkadiusz
Quoted 50 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200,
[email protected]Quoted 33 lines · wrote:
Quoted 26 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 15 lines · Arkadiusz
Quoted 10 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock(quoted diff) +5
-0+ - + name: int-nco + doc: | + Device internal numerically controlled oscillator. + When connected as a DPLL input, the DPLL enters NCOQuoted 4 lines
mode
+ where the output frequency is adjusted by the host
via
+ the PTP clock interface.Quoted 6 lines
Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 6 lines
The NCO pin can be connected only in manual mode. In other words a
DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by
its own.Quoted 4 lines
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 7 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a
driver. If the hardware does not support it then the switching between
input references should be done by userspace (by monitoring ffo,phase_offset, operstate).Quoted 8 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create
such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement
all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else
leave_nco) then it could be possible
to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 25 lines
Quoted 4 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
Quoted 8 lines
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the
automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the
proposed API we would disallow the possibility of such implementation for
existing HW variants.DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in
the other email it would also require the extra implementation for some
configuration - device level phase/ffo handling.Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level
so the driver decides if the requested state is correct or not. So it could be easy to implement this.For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 5 lines
Basically, if driver registers such NCO pin it would be always selected
manually, and in such case all the other pins are going to disconnected
state while DPLL mode is also a "OVERRIDE" or something like it.I would leave this decision on the driver level... Imagine the potential
HW that would allow to switch NCO mode if there is no valid input reference.Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
Quoted 8 lines
Now you said yourself "NCO mode" ... I agree that it would be a mode in that case. Where instead of running on regular/built in XO dpll would run on NCO and user could select it, and this would be addition to regular behavior.
I also agree that the pin approach might be better/easier to use, assuming frequency offset for all the outputs given dpll drives, it makes more sense to have it configurable on input side.
+1
Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 5 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less
confusing and needs some extra documentation.Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Jiri, Vadim, Arek, thoughts?
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin selection in AUTO mode using connected/disconnected override, let it have it.
Quoted 4 lines
I don't know 'current' HW that is capable of using AUTO mode as a part of HW-based priority source selection and use such NCO input.. But as already explained above, this is special mode of regular XO, which allows DPLL's output frequency offset configuration.
Lets keep this available for potential future HW. I can imagine a situation where a user will prefer an automatic switch to NCO mode if there is no qualified input reference - automatic switch means that HW will support this (not emulated by the driver).
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Arek? Vadim?
Thanks,
IvanAgree, 'override' capability of a pin would be the way to go for this and other similar further cases.
Quoted 7 lines
I believe a single approach on this would be best, I mean if AUTO mode needs a capability, to switch from regular behavior to 'OVERRIDE', and 'OVERRIDE' is only pin capability that allows such behavior for AUTO mode, then similar approach should be used on MANUAL mode, to make userspace know that such pin is always available to set "CONNECTED" and make the userspace implementation consistent on enabling it no matter if AUTO or MANUAL mode dpll.
Proposal:
1) new pin capability
- name: state-connected-override
- doc: pin state can be changed to connected in any DPLL mode
2) new NCO pin type to switch the DPLL to NCO mode when connected
3) automatic-only DPLL
- should expose NCO pin with state-connected-override capability
4) manual-only DPLL
- does not need to expose NCO pin with state-connected-override cap
5) dual-mode DPLL (supporting mode switching)
- if it exposes NCO pin with the override cap then it has to support switching to NCO mode directly from AUTO mode
- if does not expose NCO pin with the override cap then a user MUST switch the DPLL mode from AUTO to MANUAL to be able to make NCO pin connected to the DPLL
Vadim, Jiri, Arek - thoughts?
Thanks,
Ivan
Kubalewski, Arkadiusz
maintainerRE: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 251 lines
From: Ivan Vecera <[email protected]>
Sent: Friday, June 19, 2026 7:08 PMQuoted 178 lines · Arkadiusz
Quoted 171 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 15, 2026 2:00 PMQuoted 167 lines · Jiri Pirko
Quoted 166 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 78 lines · Arkadiusz
Quoted 69 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 57 lines · Arkadiusz
Quoted 48 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200,
[email protected]Quoted 36 lines · wrote:
Quoted 27 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 16 lines · Arkadiusz
Quoted 15 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock
+ -
+ name: int-nco
+ doc: |
+ Device internal numerically controlled oscillator.
+ When connected as a DPLL input, the DPLL enters
NCO
mode
+ where the output frequency is adjusted by the host
via
+ the PTP clock interface.Quoted 6 lines
Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 8 lines
The NCO pin can be connected only in manual mode. In other words
a
DPLL in automatic mode cannot select NCO pin (switch to NCO mode)
by
its own.Quoted 5 lines
Being picky on
DPLL_MODEfor enabling feature is not something we
can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?Quoted 8 lines
In automatic mode, the pin selection logic is defined upon prio. I
can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?[..]
Quoted 7 lines
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs.
This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't
exists on it's priority list, HW cannot pick or use it.Quoted 8 lines
Correct, AUTO mode is hardware feature and it should not be emulated
by a
driver. If the hardware does not support it then the switching between
input references should be done by userspace (by monitoring ffo,phase_offset, operstate).Quoted 8 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create
such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement
all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin
priority -> highest==enter_nco elseleave_nco) then it could be possible
to handle the switching by allowing the state 'connected' in AUTO mode
for the NCO pin type. Then the implementation will be the same for both
selection modes.Only difference would be that a user does not need to switch the device
from the AUTO to MANUAL mode.Quoted 29 lines
Quoted 12 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of
the
automatic selection.Quoted 1 line
Ivan
There is a difference between particular HW and API capabilities, with
the
proposed API we would disallow the possibility of such implementation
for
existing HW variants.DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri
in
the other email it would also require the extra implementation for some
configuration - device level phase/ffo handling.Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level
so the driver decides if the requested state is correct or not. So it could be easy to implement this.For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 5 lines
Basically, if driver registers such NCO pin it would be always selected
manually, and in such case all the other pins are going to disconnected
state while DPLL mode is also a "OVERRIDE" or something like it.I would leave this decision on the driver level... Imagine the potential
HW that would allow to switch NCO mode if there is no valid input reference.Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
Now you said yourself "NCO mode" ... I agree that it would be a mode in that case. Where instead of running on regular/built in XO dpll would run
on NCO and user could select it, and this would be addition to regular behavior.Quoted 5 lines
I also agree that the pin approach might be better/easier to use, assuming
frequency offset for all the outputs given dpll drives, it makes more sense
to have it configurable on input side.+1
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
In this situation the relevant driver would allow to configure priority
and state 'selectable' for this NCO pin.Quoted 5 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less
confusing and needs some extra documentation.Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Jiri, Vadim, Arek, thoughts?
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin
selection in AUTO mode using connected/disconnected override, let it have it.Quoted 6 lines
I don't know 'current' HW that is capable of using AUTO mode as a part of
HW-based priority source selection and use such NCO input.. But as already explained above, this is special mode of regular XO, which
allows DPLL's output frequency offset configuration.Lets keep this available for potential future HW. I can imagine a situation where a user will prefer an automatic switch to NCO mode if there is no qualified input reference - automatic switch means that HW will support this (not emulated by the driver).
Quoted 13 lines
Quoted 8 lines
Quoted 4 lines
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Arek? Vadim?
Thanks,
IvanAgree, 'override' capability of a pin would be the way to go for this and
other similar further cases.Quoted 8 lines
I believe a single approach on this would be best, I mean if AUTO mode needs a capability, to switch from regular behavior to 'OVERRIDE', and 'OVERRIDE' is only pin capability that allows such behavior for AUTO mode, then similar approach should be used on MANUAL mode, to make userspace know that such pin is always available to set "CONNECTED" and make the userspace implementation consistent on enabling it no matter
if AUTO or MANUAL mode dpll.Proposal:
1) new pin capability
- name: state-connected-override
- doc: pin state can be changed to connected in any DPLL mode
Quoted 8 lines
2) new NCO pin type to switch the DPLL to NCO mode when connected
3) automatic-only DPLL
- should expose NCO pin with state-connected-override capability4) manual-only DPLL
- does not need to expose NCO pin with state-connected-override cap
It makes sense only if such AUTO mode DPLL can have both OVERRIDE and non-OVERRIDE possibilities. So further HW design could implement it without OVERRIDE and current AUTO mode could OVERRIDE and use it.
Having it this way, requires different user space implementation, but don't think we will be able to ease it anyhow.
Thank you!
Arkadiusz
Quoted 11 lines
5) dual-mode DPLL (supporting mode switching)
- if it exposes NCO pin with the override cap then it has to support switching to NCO mode directly from AUTO mode
- if does not expose NCO pin with the override cap then a user MUST switch the DPLL mode from AUTO to MANUAL to be able to make NCO pin connected to the DPLLVadim, Jiri, Arek - thoughts?
Thanks,
Ivan
Jiri Pirko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Ivan VeceraQuoted 218 lines · Fri, Jun 19, 2026 at 07:07:52PM +0200, [email protected] wrote:
Quoted 156 lines · Arkadiusz
Quoted 155 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 15, 2026 2:00 PMQuoted 151 lines · Jiri Pirko
Quoted 150 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 70 lines · Arkadiusz
Quoted 62 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 50 lines · Arkadiusz
Quoted 50 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200,
[email protected]Quoted 33 lines · wrote:
Quoted 26 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 15 lines · Arkadiusz
Quoted 14 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock
+ -
+ name: int-nco
+ doc: |
+ Device internal numerically controlled oscillator.
+ When connected as a DPLL input, the DPLL enters NCO
mode
+ where the output frequency is adjusted by the host
via
+ the PTP clock interface.Quoted 6 lines
Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 6 lines
The NCO pin can be connected only in manual mode. In other words a
DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by
its own.Quoted 4 lines
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 7 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a
driver. If the hardware does not support it then the switching between
input references should be done by userspace (by monitoring ffo,phase_offset, operstate).Quoted 8 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create
such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement
all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else
leave_nco) then it could be possible
to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 25 lines
Quoted 4 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
Quoted 8 lines
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the
automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the
proposed API we would disallow the possibility of such implementation for
existing HW variants.DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in
the other email it would also require the extra implementation for some
configuration - device level phase/ffo handling.Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level
so the driver decides if the requested state is correct or not. So it could be easy to implement this.For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 5 lines
Basically, if driver registers such NCO pin it would be always selected
manually, and in such case all the other pins are going to disconnected
state while DPLL mode is also a "OVERRIDE" or something like it.I would leave this decision on the driver level... Imagine the potential
HW that would allow to switch NCO mode if there is no valid input reference.Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
Quoted 8 lines
Now you said yourself "NCO mode" ... I agree that it would be a mode in that case. Where instead of running on regular/built in XO dpll would run on NCO and user could select it, and this would be addition to regular behavior.
I also agree that the pin approach might be better/easier to use, assuming frequency offset for all the outputs given dpll drives, it makes more sense to have it configurable on input side.
+1
Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 5 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less
confusing and needs some extra documentation.Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Jiri, Vadim, Arek, thoughts?
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin selection in AUTO mode using connected/disconnected override, let it have it.
Quoted 4 lines
I don't know 'current' HW that is capable of using AUTO mode as a part of HW-based priority source selection and use such NCO input.. But as already explained above, this is special mode of regular XO, which allows DPLL's output frequency offset configuration.
Lets keep this available for potential future HW. I can imagine a situation where a user will prefer an automatic switch to NCO mode if there is no qualified input reference - automatic switch means that HW will support this (not emulated by the driver).
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Arek? Vadim?
Thanks,
IvanAgree, 'override' capability of a pin would be the way to go for this and other similar further cases.
Quoted 7 lines
I believe a single approach on this would be best, I mean if AUTO mode needs a capability, to switch from regular behavior to 'OVERRIDE', and 'OVERRIDE' is only pin capability that allows such behavior for AUTO mode, then similar approach should be used on MANUAL mode, to make userspace know that such pin is always available to set "CONNECTED" and make the userspace implementation consistent on enabling it no matter if AUTO or MANUAL mode dpll.
Quoted 4 lines
Proposal:
1) new pin capability
- name: state-connected-override
- doc: pin state can be changed to connected in any DPLL mode
Needs a bit more description I think in real patch.
Quoted 2 lines
2) new NCO pin type to switch the DPLL to NCO mode when connected
Say "NCO hw mode" to avoid confusion (I already spotted such a bit earlier in this thread)
Quoted 7 lines
3) automatic-only DPLL
- should expose NCO pin with state-connected-override capability4) manual-only DPLL
- does not need to expose NCO pin with state-connected-override cap
Quoted 8 lines
5) dual-mode DPLL (supporting mode switching)
- if it exposes NCO pin with the override cap then it has to support switching to NCO mode directly from AUTO mode
- if does not expose NCO pin with the override cap then a user MUST switch the DPLL mode from AUTO to MANUAL to be able to make NCO pin connected to the DPLLVadim, Jiri, Arek - thoughts?
Agreed.
Quoted 4 lines
Thanks,
Ivan
Vadim Fedorenko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Ivan VeceraQuoted 231 lines · Ivan Vecera
Quoted 156 lines · Arkadiusz
Quoted 155 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 15, 2026 2:00 PMQuoted 151 lines · Jiri Pirko
Quoted 150 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 70 lines · Arkadiusz
Quoted 62 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 50 lines · Arkadiusz
Quoted 50 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200,
[email protected]Quoted 33 lines · wrote:
Quoted 26 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 15 lines · Arkadiusz
Quoted 14 lines
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock
+ -
+ name: int-nco
+ doc: |
+ Device internal numerically controlled oscillator.
+ When connected as a DPLL input, the DPLL enters NCO
mode
+ where the output frequency is adjusted by the host
via
+ the PTP clock interface.Quoted 6 lines
Hi Ivan!
How would you control this in case of automatic mode dpll? Automatic mode DPLL shall be controlled on HW level, such pin brakes that rule and requires some driver magic to show it is higher priority then the rest of the pins?
Quoted 6 lines
The NCO pin can be connected only in manual mode. In other words a
DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by
its own.Quoted 4 lines
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 7 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a
driver. If the hardware does not support it then the switching between
input references should be done by userspace (by monitoring ffo,phase_offset, operstate).Quoted 8 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create
such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement
all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else
leave_nco) then it could be possible
to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 25 lines
Quoted 4 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
Quoted 8 lines
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the
automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the
proposed API we would disallow the possibility of such implementation for
existing HW variants.DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in
the other email it would also require the extra implementation for some
configuration - device level phase/ffo handling.Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level
so the driver decides if the requested state is correct or not. So it could be easy to implement this.For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 5 lines
Basically, if driver registers such NCO pin it would be always selected
manually, and in such case all the other pins are going to disconnected
state while DPLL mode is also a "OVERRIDE" or something like it.I would leave this decision on the driver level... Imagine the potential
HW that would allow to switch NCO mode if there is no valid input reference.Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
Quoted 8 lines
Now you said yourself "NCO mode" ... I agree that it would be a mode in that case. Where instead of running on regular/built in XO dpll would run on NCO and user could select it, and this would be addition to regular behavior.
I also agree that the pin approach might be better/easier to use, assuming frequency offset for all the outputs given dpll drives, it makes more sense to have it configurable on input side.
+1
Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 5 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less
confusing and needs some extra documentation.Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Jiri, Vadim, Arek, thoughts?
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin selection in AUTO mode using connected/disconnected override, let it have it.
Quoted 4 lines
I don't know 'current' HW that is capable of using AUTO mode as a part of HW-based priority source selection and use such NCO input.. But as already explained above, this is special mode of regular XO, which allows DPLL's output frequency offset configuration.
Lets keep this available for potential future HW. I can imagine a situation where a user will prefer an automatic switch to NCO mode if there is no qualified input reference - automatic switch means that HW will support this (not emulated by the driver).
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Arek? Vadim?
Thanks,
IvanAgree, 'override' capability of a pin would be the way to go for this and other similar further cases.
Quoted 7 lines
I believe a single approach on this would be best, I mean if AUTO mode needs a capability, to switch from regular behavior to 'OVERRIDE', and 'OVERRIDE' is only pin capability that allows such behavior for AUTO mode, then similar approach should be used on MANUAL mode, to make userspace know that such pin is always available to set "CONNECTED" and make the userspace implementation consistent on enabling it no matter if AUTO or MANUAL mode dpll.
Proposal:
1) new pin capability
- name: state-connected-override
- doc: pin state can be changed to connected in any DPLL mode2) new NCO pin type to switch the DPLL to NCO mode when connected
3) automatic-only DPLL
- should expose NCO pin with state-connected-override capability4) manual-only DPLL
- does not need to expose NCO pin with state-connected-override cap
Quoted 6 lines
5) dual-mode DPLL (supporting mode switching)
- if it exposes NCO pin with the override cap then it has to support switching to NCO mode directly from AUTO mode
- if does not expose NCO pin with the override cap then a user MUST switch the DPLL mode from AUTO to MANUAL to be able to make NCO pin connected to the DPLL
I still don't see good reasoning for the pin. Even this sentence says "DPLL mode" which keeps me thinking whether we have to move it to a special DPLL mode. All these items look like overcomplication of a simple function of the device itself. DPLL can be either in the closed loop when one of the pins provides a signal to align to, or in the open loop meaning that software can control adjustments to phase/frequency. But it's definitely a property of the device, and it's not a pin in any kind...
Quoted 6 lines
Vadim, Jiri, Arek - thoughts?
Thanks,
Ivan
Ivan Vecera
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 240 lines · Vadim Fedorenko
Quoted 232 lines · Ivan Vecera
Quoted 157 lines · Arkadiusz
Quoted 156 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 15, 2026 2:00 PMQuoted 152 lines · Jiri Pirko
Quoted 151 lines · Wed, Jun 10, 2026 at 05:45:46PM +0200, [email protected] wrote:
Quoted 71 lines · Arkadiusz
Quoted 63 lines
From: Ivan Vecera <[email protected]>
Sent: Tuesday, June 9, 2026 4:59 PMQuoted 51 lines · Arkadiusz
Quoted 51 lines
From: Jiri Pirko <[email protected]>
Sent: Tuesday, June 9, 2026 10:51 AMMon, Jun 08, 2026 at 07:03:46PM +0200,
[email protected]Quoted 34 lines · wrote:
Quoted 27 lines
From: Ivan Vecera <[email protected]>
Sent: Monday, June 8, 2026 5:48 PMQuoted 22 lines · Arkadiusz
From: Ivan Vecera <[email protected]>
Sent: Sunday, May 31, 2026 9:44 PM ...
-
name: gnss
doc: GNSS recovered clock
+ -
+ name: int-nco
+ doc: |
+ Device internal numerically controlled oscillator.
+ When connected as a DPLL input, the DPLL enters
NCO
mode
+ where the output frequency is adjusted by the host
via
+ the PTP clock interface.Hi Ivan!
How would you control this in case of automatic mode dpll?
Automatic mode DPLL shall be controlled on HW level, such pin
brakes that rule and requires some driver magic to show it is
higher priority then the rest of the pins?Quoted 6 lines
The NCO pin can be connected only in manual mode. In other words a
DPLL in automatic mode cannot select NCO pin (switch to NCO mode) by
its own.Quoted 4 lines
Being picky on
DPLL_MODEfor enabling feature is not something we can allow if it is not related to HW limitation, is it? Could you please elaborate why it is not possible for AUTOMATIC mode?In automatic mode, the pin selection logic is defined upon prio. I can imagine that if NCO pin has the highest prio of the available ones, it gets picked. I would be aligned 100% with automatic mode behaviour.
Is there a real usecase for it?Quoted 7 lines
Quoted 1 line
[..]
This is not true. AUTOMATIC mode is HW solution, SW driver ONLY configures priorities on the inputs, not manages the active inputs. This brakes that behavior, the SW driver would have to manually override the AUTMATIC mode to be fed from such NCO pin as it doesn't exists on it's priority list, HW cannot pick or use it.
Quoted 7 lines
Correct, AUTO mode is hardware feature and it should not be emulated by a
driver. If the hardware does not support it then the switching between
input references should be done by userspace (by monitoring ffo,phase_offset, operstate).Quoted 8 lines
Yes, exactly, so for AUTOMATIC mode HW it will not be possible to create
such pin, which means that NCO pin would serve only a MANUAL mode implementation.
Basically this is something we shall not allow to happen. DPLL API should be designed to cover the case where AUTO mode is able to implement
all features consistently.If you don't like the proposal from Jiri (NCO switch driven by NCO pin priority -> highest==enter_nco else
leave_nco) then it could be possible
to handle the switching by allowing the state 'connected' in AUTO mode for the NCO pin type. Then the implementation will be the same for both selection modes.Only difference would be that a user does not need to switch the device from the AUTO to MANUAL mode.
Quoted 25 lines
Quoted 4 lines
Quoted 3 lines
The real use case is that any DPLL can switch the mode to this one instead of implementing MANUAL mode just to use the feature with a 'virtual' pin.
Quoted 8 lines
I don't expect this... but it is up to a driver. I don't plan such functionality in zl3073x as the NCO pin does not expose
prio_get()andprio_set()callbacks - so it is clear that this pin cannot be part of the
automatic selection.Ivan
There is a difference between particular HW and API capabilities, with the
proposed API we would disallow the possibility of such implementation for
existing HW variants.DPLL NCO MODE would allow that but as pointed here by Ivan and by Jiri in
the other email it would also require the extra implementation for some
configuration - device level phase/ffo handling.Quoted 6 lines
To summarize it all, I don't have such simple solution for it.
First thing that comes to my mind is to combine both approaches. Make it possible for AUTMATIC mode to also set "CONNECTED" state on certain kind of "OVERRIDE" pins, where it could be determined by the type of PIN and embed that logic into the DPLL subsystem.
The possible states for particual pins are now handled at a driver level
so the driver decides if the requested state is correct or not. So it could be easy to implement this.For auto mode allowed states:
- input references: selectable / disconnected
- nco pin: connected / disconnectedQuoted 5 lines
Basically, if driver registers such NCO pin it would be always selected
manually, and in such case all the other pins are going to disconnected
state while DPLL mode is also a "OVERRIDE" or something like it.I would leave this decision on the driver level... Imagine the potential
HW that would allow to switch NCO mode if there is no valid input reference.Example:
REF0 (prio 0) -> +------+ -> OUT0
REF1 (prio 1) -> | DPLL | -> ...
NCO (prio 2) -> +------+ -> OUTnSuch HW would prefer REF0 or REF1 and lock to one of them if they are qualified. But if they are NOT, then it switches to NCO mode.
Quoted 8 lines
Now you said yourself "NCO mode" ... I agree that it would be a mode in that case. Where instead of running on regular/built in XO dpll would run on NCO and user could select it, and this would be addition to regular behavior.
I also agree that the pin approach might be better/easier to use, assuming frequency offset for all the outputs given dpll drives, it makes more sense to have it configurable on input side.
+1
Quoted 20 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
In this situation the relevant driver would allow to configure priority and state 'selectable' for this NCO pin.
Quoted 5 lines
Perhaps the pin type could include OVERRIDE in it's name to make it less
confusing and needs some extra documentation.Thoughts?
I think _INT_ is ok. In the case of
TYPE_INT_OSCILLATORit is also obvious that it is not a standard input reference.Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Jiri, Vadim, Arek, thoughts?
I agree with you, the driver should have the flexibility to implement this according to his/hw's needs/capabilities. If it implements prio selection in AUTO mode, let it have it. If it implements manual NCO pin selection in AUTO mode using connected/disconnected override, let it have it.
Quoted 4 lines
I don't know 'current' HW that is capable of using AUTO mode as a part of HW-based priority source selection and use such NCO input.. But as already explained above, this is special mode of regular XO, which allows DPLL's output frequency offset configuration.
Lets keep this available for potential future HW. I can imagine a situation where a user will prefer an automatic switch to NCO mode if there is no qualified input reference - automatic switch means that HW will support this (not emulated by the driver).
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
Moreover, I actually like the "override" capability for pins in AUTO mode in general. It may be handy for other usecases as well.
Arek? Vadim?
Thanks,
IvanAgree, 'override' capability of a pin would be the way to go for this and other similar further cases.
Quoted 7 lines
I believe a single approach on this would be best, I mean if AUTO mode needs a capability, to switch from regular behavior to 'OVERRIDE', and 'OVERRIDE' is only pin capability that allows such behavior for AUTO mode, then similar approach should be used on MANUAL mode, to make userspace know that such pin is always available to set "CONNECTED" and make the userspace implementation consistent on enabling it no matter if AUTO or MANUAL mode dpll.
Proposal:
1) new pin capability
- name: state-connected-override
- doc: pin state can be changed to connected in any DPLL mode2) new NCO pin type to switch the DPLL to NCO mode when connected
3) automatic-only DPLL
- should expose NCO pin with state-connected-override capability4) manual-only DPLL
- does not need to expose NCO pin with state-connected-override capQuoted 6 lines
5) dual-mode DPLL (supporting mode switching)
- if it exposes NCO pin with the override cap then it has to support switching to NCO mode directly from AUTO mode
- if does not expose NCO pin with the override cap then a user MUST switch the DPLL mode from AUTO to MANUAL to be able to make NCO pin connected to the DPLL
Quoted 8 lines
I still don't see good reasoning for the pin. Even this sentence says "DPLL mode" which keeps me thinking whether we have to move it to a special DPLL mode. All these items look like overcomplication of a simple function of the device itself. DPLL can be either in the closed loop when one of the pins provides a signal to align to, or in the open loop meaning that software can control adjustments to phase/frequency. But it's definitely a property of the device, and it's not a pin in any kind...
Yes, at first glance, introducing a new DPLL mode would be easier and simpler. But it depends on how you look at it.
What is NCO mode and how does it differ from other modes?
In other modes, the DPLL loop is controlled by the input signal that the DPLL is locked to. Changes in frequency (FFO) and phase (phase offset) affect the output signal(s) that are produced from this DPLL.
In NCO mode, the frequency and, consequently, phase changes are determined by software (e.g. ptp4l userspace via the PTP API)... these changes from userspace can be understood as an input signal that affects the DPLL outputs.
In addition, we could use the existing DPLL pin attributes to control the DPLL device in NCO mode.
I mean specifically:
* fractional-frequency-offset-ppt as a variant of .adjfine(), but with a higher resolution (adjfine has a resolution of 15.25 ppt)
* phase-adjust as a higher-resolution variant of .adjphase() (adjphase uses nanoseconds, whereas phase-adjust uses picoseconds)
So:
'dpll pin set id <nco-pin> fractional-frequency-offset-ppt X'
corresponds to PTP's adjfine(X-as-scaled-ppm)
'dpll pin set id <nco-pin> phase-adjust Y' corresponds to PTP's
adjphase(Y/1000)
So in short, the NCO pin represents a software "signal" from userspace.
If we were to go the special DPLL mode route and want to implement this functionality in the DPLL subsystem in the future, we would have to add extra attributes (ffo, phase) to dpll_device.
WDYT?
Thanks,
Ivan
Jiri Pirko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Vadim FedorenkoQuoted 1 line · Wed, Jun 24, 2026 at 05:57:35PM +0200, [email protected] wrote:
On 19/06/2026 18:07, Ivan Vecera wrote:
[...]
Quoted 21 lines
Quoted 14 lines
Proposal:
1) new pin capability
- name: state-connected-override
- doc: pin state can be changed to connected in any DPLL mode2) new NCO pin type to switch the DPLL to NCO mode when connected
3) automatic-only DPLL
- should expose NCO pin with state-connected-override capability4) manual-only DPLL
- does not need to expose NCO pin with state-connected-override capQuoted 6 lines
5) dual-mode DPLL (supporting mode switching)
- if it exposes NCO pin with the override cap then it has to support switching to NCO mode directly from AUTO mode
- if does not expose NCO pin with the override cap then a user MUST switch the DPLL mode from AUTO to MANUAL to be able to make NCO pin connected to the DPLL
Quoted 8 lines
I still don't see good reasoning for the pin. Even this sentence says "DPLL mode" which keeps me thinking whether we have to move it to a special DPLL mode. All these items look like overcomplication of a simple function of the device itself. DPLL can be either in the closed loop when one of the pins provides a signal to align to, or in the open loop meaning that software can control adjustments to phase/frequency. But it's definitely a property of the device, and it's not a pin in any kind...
Vadim, did you see this:
https://lore.kernel.org/all/aiftnkuT9IP31qUm@FV6GYCPJ69/ ? I very thoroughly described what you are questioning. There is 0 reply to that email so perhaps you missed it? IDK.
Vadim Fedorenko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
Quoted 35 lines · Jiri Pirko
Quoted 1 line · Wed, Jun 24, 2026 at 05:57:35PM +0200, [email protected] wrote:
On 19/06/2026 18:07, Ivan Vecera wrote:
[...]
Quoted 21 lines
Quoted 14 lines
Proposal:
1) new pin capability
- name: state-connected-override
- doc: pin state can be changed to connected in any DPLL mode2) new NCO pin type to switch the DPLL to NCO mode when connected
3) automatic-only DPLL
- should expose NCO pin with state-connected-override capability4) manual-only DPLL
- does not need to expose NCO pin with state-connected-override capQuoted 6 lines
5) dual-mode DPLL (supporting mode switching)
- if it exposes NCO pin with the override cap then it has to support switching to NCO mode directly from AUTO mode
- if does not expose NCO pin with the override cap then a user MUST switch the DPLL mode from AUTO to MANUAL to be able to make NCO pin connected to the DPLLQuoted 8 lines
I still don't see good reasoning for the pin. Even this sentence says "DPLL mode" which keeps me thinking whether we have to move it to a special DPLL mode. All these items look like overcomplication of a simple function of the device itself. DPLL can be either in the closed loop when one of the pins provides a signal to align to, or in the open loop meaning that software can control adjustments to phase/frequency. But it's definitely a property of the device, and it's not a pin in any kind...
Quoted 4 lines
Vadim, did you see this:
https://lore.kernel.org/all/aiftnkuT9IP31qUm@FV6GYCPJ69/ ? I very thoroughly described what you are questioning. There is 0 reply to that email so perhaps you missed it? IDK.
Hi Jiri,
Yeah, I was traveling a lot lately, and looks like I missed it. I'll reply in that thread.
Thanks!
Vadim Fedorenko
maintainerRe: [PATCH net-next v5 1/4] dpll: add DPLL_PIN_TYPE_INT_NCO pin type
In reply to Jiri PirkoQuoted 71 lines · Jiri Pirko
Quoted 19 lines · Mon, Jun 08, 2026 at 01:33:56PM +0200, [email protected] wrote:
Quoted 11 lines · Ivan Vecera
Quoted 10 lines · Jakub Kicinski
Quoted 8 lines · On Thu, 4 Jun 2026 17:01:36 +0200 Ivan Vecera wrote:
Quoted 4 lines
Purely going on intuition here but feels like NCO should be a mode (enum
dpll_mode) rather than one of the input pins?More acks here would be great, Vadim, Arkadiusz, Grzegorz... ?
I had a long discussion with Jiri about this and we agreed finally that
dpll_moderepresents a reference (input pin) selection strategy mode and not a DPLL device running mode.Quoted 6 lines
Quoted 3 lines
Long discussion? I see 2 emails ;) Let's hear from others. (thanks for the link BTW, _if_ there's a v6 please put it in the cover letter)
I called him... he explained me 'why?' in detail.
I also appreciate others' opinion.Quoted 6 lines
Well, NCO mode means manual operation of frequency tuning. Does it mean that different tunings may be applied to different out pins of DPLL device? My assumption that it's not possible, and in this case NCO is property/mode of DPLL device rather than single pin.
@Jiri could you please share your detailed explanation on "why"?
Since the "why a pin and not a new
dpll_mode?" question keeps coming up, let me try to describe why I believe that modelling NCO as an input pin (DPLL_PIN_TYPE_INT_NCO) is the right thing to do.In the DPLL UAPI, 'mode' only describes the *input selection policy*:
MANUAL means userspace picks which input the loop locks to, AUTOMATIC means the DPLL auto-selects the highest-priority input. I know there was some fuzz about this semantics in the early stages of upstreaming DPLL subsystem, but eventually this became very clear both in code and in kdoc:<qoute>
* enumdpll_mode- working modes a dpll can support, differentiates if and how
* dpll selects one of its inputs to syntonize with it, valid values for
*DPLL_A_MODEattribute
</quote>NCO *is not* a third selection policy - it is just another *source* the loop is disciplined from. Except the source is steered by the host (via the PHC .adjfine() path) instead of being an external reference. Think of it as a virtual pin of some sort.
The object we already use for "a source the DPLL can lock to" is a pin, so an internal NCO belongs right next to
DPLL_PIN_TYPE_INT_OSCILLATOR, which is already existing example of a similar virtual pin.By having NCO as an input pin we reuse the existing model instead of inventing a parallel one. "Run as NCO" becomes "connect the NCO input" using the same connect/disconnect, pin state and pin-dump infrastructure as any other input. No new control surface, and it stays orthogonal to
mode: we don't have to define what AUTOMATIC+NCO or pin priorities mean, and we don't grow enumdpll_modeand the supported-modes bitmask that every mode-aware consumer would then have to relearn.For the pin info uAPI exposure we reuse the attributes pins already have
- the output frequency offset from nominal is reported via the pin's fractional-frequency-offset / -ppt. A new device mode would need brand new device-level attributes for the same information.Having said that, I think it's a perfect fit. The only "real" pull towards a new mode is that vendor datasheets call this NCO/DCO a "mode". But that is HW register terminology and we learned many times in the past that may be more or less misleading/incorrect wrt the uAPI.
Quoted 4 lines
Therefore my strong preference is
DPLL_PIN_TYPE_INT_NCO, no new mode. Honestly, I don't really understand why it would make even little sense to have this as new mode. Perhaps I'm missing something, if you can describe it, that would be awesome.
Ok, I see your point. Even though the pin UAPI fits the model, I still have some concerns:
1. I cannot really imagine AUTOMATIC mode selecting NCO pin by priority in case other pins are gone somehow. It doesn't make sense without steering SW running on the host. And the other way around - switching to a higher priority pin while SW is keep "steering" DPLL. But looks like we have discussed it in the other thread. Adding DPLL mode restrictions based on pin selection/connection breaks the model, I think...
2. SW steering cannot be pure SW. Every disciplining algorithm relies on
measurements, the product of phase comparators. That technically means
the device has to have other inputs configure as monitor, which can be configured in AUTO mode with priorities. How will we model it then?
Thanks,
Vadim