[PATCH RFC net-next 15/19] dpll: register pins only with a parent pin of their owner

From: Ivan Vecera

Date: Thu Nov 26 2026 - 15:34:35 EST


dpll_pin_on_pin_register() accepts a parent pin of another owner and
then registers the pin with the DPLLs of that owner. Its only user was
ice on E825, which now describes its recovered clock muxes with its own
DPLL devices linked with the zl3073x pins.

Require the same owner for the parent pin, as dpll_pin_register() does
for the DPLL, and document how to describe a mux in front of an input of
another device.

Signed-off-by: Ivan Vecera <ivecera@xxxxxxxxxx>
---
Documentation/driver-api/dpll.rst | 7 +++++--
drivers/dpll/dpll_core.c | 9 +++++++++
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Documentation/driver-api/dpll.rst b/Documentation/driver-api/dpll.rst
index 90c88fcf21b385..bc34fc83882fac 100644
--- a/Documentation/driver-api/dpll.rst
+++ b/Documentation/driver-api/dpll.rst
@@ -355,7 +355,8 @@ Pin ownership and links

The owner of a dpll device or a pin is identified by the module and the
clock_id passed to dpll_device_get() or dpll_pin_get(). dpll_pin_register()
-accepts only a dpll device of the same owner as the pin.
+accepts only a dpll device and dpll_pin_on_pin_register() only a parent pin
+of the same owner as the pin.

A pin represents a pad of the device whose driver registers it. When the
board connects a pad of one device to a pad of another one, for example an
@@ -364,7 +365,9 @@ the driver of one of them describes the connection with
dpll_pin_link_add() on its own pin. The link names the pin at the other
end by its firmware node, which the driver of that pin sets with
dpll_pin_fwnode_set(). Each driver registers only its own pins and the
-drivers may probe in any order.
+drivers may probe in any order. A mux of one device that feeds an input of
+another device is a dpll device of its own driver, with the selectable
+signals as input pins and an output pin linked with that input.

While both pins are registered, ``DPLL_CMD_PIN_GET`` reports the link for
each of them with the id of the pin at the other end:
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 7440b174c3de2b..9b48d289ec7330 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -1081,6 +1081,8 @@ EXPORT_SYMBOL_GPL(dpll_pin_unregister);
*
* Register a pin with a parent pin, create references between them and
* between newly registered pin and dplls connected with a parent pin.
+ * The @parent and the @pin must have the same owner, they must be created
+ * with the same module and clock_id.
*
* Context: Acquires a lock (dpll_lock)
* Return:
@@ -1097,6 +1099,13 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
if (WARN_ON(parent->prop.type != DPLL_PIN_TYPE_MUX))
return -EINVAL;

+ /* A pin of another owner is connected by a link, see
+ * dpll_pin_link_add().
+ */
+ if (WARN_ON_ONCE(parent->module != pin->module ||
+ parent->clock_id != pin->clock_id))
+ return -EINVAL;
+
if (WARN_ON(!ops) ||
WARN_ON(!ops->state_on_pin_get) ||
WARN_ON(!ops->direction_get))
--
2.56.1