Skip to content

dpll: zl3073x: refactor state management

Ivan Vecera lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6dpll: zl3073x: use struct_group to partition statesdrivers/dpll/zl3073x/out.c drivers/dpll/zl3073x/out.h drivers/dpll/zl3073x/ref.c +2 more+84 -490 replies
2/6dpll: zl3073x: add zl3073x_ref_state_update helperdrivers/dpll/zl3073x/core.c drivers/dpll/zl3073x/ref.c drivers/dpll/zl3073x/ref.h+26 -50 replies
3/6dpll: zl3073x: introduce zl3073x_chan for DPLL channel statedrivers/dpll/zl3073x/Makefile drivers/dpll/zl3073x/chan.c drivers/dpll/zl3073x/chan.h +4 more+217 -610 replies
4/6dpll: zl3073x: add DPLL channel status fields to zl3073x_chandrivers/dpll/zl3073x/chan.c drivers/dpll/zl3073x/chan.h drivers/dpll/zl3073x/core.c +1 more+111 -310 replies
5/6dpll: zl3073x: add reference priority to zl3073x_chandrivers/dpll/zl3073x/chan.c drivers/dpll/zl3073x/chan.h drivers/dpll/zl3073x/core.h +2 more+201 -2412 replies
6/6dpll: zl3073x: drop selected and simplify connected ref getterdrivers/dpll/zl3073x/dpll.c+18 -760 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/6] dpll: zl3073x: refactor state management

This series refactors the zl3073x DPLL driver to centralize hardware state management behind dedicated per-module state interfaces, replacing scattered direct register accesses in dpll.c with cached state and proper accessor functions.

The driver already uses a fetch/get/set pattern for ref, out, and synth modules. This series extends and refines that pattern:

First, struct_group() is applied to the existing ref, out, and synth structures to partition fields into cfg (mutable configuration), inv (invariants set at init), and stat (read-only status) groups. This enables group-level memcmp for short-circuit checks and bulk copies in state_set, and adds invariant validation guards.

A ref_state_update() helper is extracted to encapsulate the per-reference monitor status register read, keeping direct register access behind the ref module interface.

A new zl3073x_chan module is introduced following the same pattern, caching the DPLL channel mode_refsel register with inline getters and setters. The refsel_mode and forced_ref fields are removed from struct zl3073x_dpll in favor of the cached channel state.

The chan module is then extended with cached mon_status and refsel_status registers, converting lock_status_get and selected_ref_get from direct HW reads to cached state lookups refreshed by the periodic worker.

Reference priority registers are cached in the chan cfg group, removing the ad-hoc ref_prio_get/set functions and the redundant pin->selectable flag, which is now derived from the cached priority. The selected_ref_set function is inlined into input_pin_state_on_dpll_set, unifying all mode paths through a single chan_state_set commit point.

Finally, selected_ref_get is dropped entirely since the refsel_status register provides the selected reference regardless of mode, and connected_ref_get is simplified to a direct refsel_state check.

Ivan Vecera (6):
dpll: zl3073x: use struct_group to partition states
dpll: zl3073x: add zl3073x_ref_state_update helper
dpll: zl3073x: introduce zl3073x_chan for DPLL channel state
dpll: zl3073x: add DPLL channel status fields to zl3073x_chan
dpll: zl3073x: add reference priority to zl3073x_chan
dpll: zl3073x: drop selected and simplify connected ref getter

 drivers/dpll/zl3073x/Makefile |   4 +-
 drivers/dpll/zl3073x/chan.c   | 164 ++++++++++++
 drivers/dpll/zl3073x/chan.h   | 179 +++++++++++++
 drivers/dpll/zl3073x/core.c   |  36 ++-
 drivers/dpll/zl3073x/core.h   |  14 +-
 drivers/dpll/zl3073x/dpll.c   | 490 +++++++++-------------------------
 drivers/dpll/zl3073x/dpll.h   |   4 -
 drivers/dpll/zl3073x/out.c    |  27 +-
 drivers/dpll/zl3073x/out.h    |  21 +-
 drivers/dpll/zl3073x/ref.c    |  58 ++--
 drivers/dpll/zl3073x/ref.h    |  33 ++-
 drivers/dpll/zl3073x/regs.h   |  12 +
 drivers/dpll/zl3073x/synth.h  |  16 +-
 13 files changed, 626 insertions(+), 432 deletions(-)
 create mode 100644 drivers/dpll/zl3073x/chan.c
 create mode 100644 drivers/dpll/zl3073x/chan.h
Signature · 1 line
2.52.0