]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dpll: extend pin notifier with notification source ID
authorGrzegorz Nitka <grzegorz.nitka@intel.com>
Sun, 7 Jun 2026 18:30:40 +0000 (20:30 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 13 Jun 2026 20:24:34 +0000 (13:24 -0700)
Extend the DPLL pin notification API to include a source identifier
indicating where the notification originates. This allows notifier
consumers to distinguish between notifications coming from
an associated DPLL instance, a parent pin, or the pin itself.

A new field, src_clock_id, is added to struct dpll_pin_notifier_info
and is passed through all pin-related notification paths. Callers of
dpll_pin_notify() are updated to provide a meaningful source identifier
based on their context:
  - pin registration/unregistration uses the DPLL's clock_id,
  - pin-on-pin operations use the parent pin's clock_id,
  - pin changes use the pin's own clock_id.

As introduced in the commit ("dpll: allow registering FW-identified pin
with a different DPLL"), it is possible to share the same physical pin
via firmware description (fwnode) with DPLL objects from different
kernel modules. This means that a given pin can be registered multiple
times.

Driver such as ICE (E825 devices) rely on this mechanism when listening
for the event where a shared-fwnode pin appears, while avoiding reacting
to events triggered by their own registration logic.

This change only extends the notification metadata and does not alter
existing semantics for drivers that do not use the new field.

Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Link: https://patch.msgid.link/20260607183045.1213735-9-grzegorz.nitka@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/dpll/dpll_core.c
drivers/dpll/dpll_core.h
drivers/dpll/dpll_netlink.c
drivers/dpll/dpll_netlink.h
include/linux/dpll.h

index 1aaf62775408048a0ccafb0d13f307b41ee8a505..2e8690cb3c16eefc588dc370218882870c3d5abe 100644 (file)
@@ -72,7 +72,8 @@ void dpll_device_notify(struct dpll_device *dpll, unsigned long action)
        call_dpll_notifiers(action, &info);
 }
 
-void dpll_pin_notify(struct dpll_pin *pin, unsigned long action)
+void dpll_pin_notify(struct dpll_pin *pin, u64 src_clock_id,
+                    unsigned long action)
 {
        struct dpll_pin_notifier_info info = {
                .pin = pin,
@@ -81,6 +82,7 @@ void dpll_pin_notify(struct dpll_pin *pin, unsigned long action)
                .clock_id = pin->clock_id,
                .fwnode = pin->fwnode,
                .prop = &pin->prop,
+               .src_clock_id = src_clock_id,
        };
 
        call_dpll_notifiers(action, &info);
@@ -849,7 +851,7 @@ __dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
        if (ret)
                goto ref_pin_del;
        xa_set_mark(&dpll_pin_xa, pin->id, DPLL_REGISTERED);
-       dpll_pin_create_ntf(pin);
+       dpll_pin_create_ntf(pin, dpll->clock_id);
 
        return ret;
 
@@ -926,7 +928,7 @@ __dpll_pin_unregister(struct dpll_device *dpll, struct dpll_pin *pin,
                      const struct dpll_pin_ops *ops, void *priv, void *cookie)
 {
        ASSERT_DPLL_PIN_REGISTERED(pin);
-       dpll_pin_delete_ntf(pin);
+       dpll_pin_delete_ntf(pin, dpll->clock_id);
        dpll_xa_ref_pin_del(&dpll->pin_refs, pin, ops, priv, cookie);
        dpll_xa_ref_dpll_del(&pin->dpll_refs, dpll, ops, priv, cookie);
        if (xa_empty(&pin->dpll_refs)) {
@@ -999,7 +1001,7 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
                        stop = i;
                        goto dpll_unregister;
                }
-               dpll_pin_create_ntf(pin);
+               dpll_pin_create_ntf(pin, parent->clock_id);
        }
        mutex_unlock(&dpll_lock);
 
@@ -1008,7 +1010,7 @@ int dpll_pin_on_pin_register(struct dpll_pin *parent, struct dpll_pin *pin,
 dpll_unregister:
        xa_for_each(&parent->dpll_refs, i, ref)
                if (i < stop) {
-                       dpll_pin_delete_ntf(pin);
+                       dpll_pin_delete_ntf(pin, parent->clock_id);
                        __dpll_pin_unregister(ref->dpll, pin, ops, priv,
                                              parent);
                }
@@ -1041,7 +1043,7 @@ void dpll_pin_on_pin_unregister(struct dpll_pin *parent, struct dpll_pin *pin,
                reg = dpll_pin_registration_find(ref, ops, priv, parent);
                if (!reg)
                        continue;
-               dpll_pin_delete_ntf(pin);
+               dpll_pin_delete_ntf(pin, parent->clock_id);
                __dpll_pin_unregister(ref->dpll, pin, ops, priv, parent);
        }
        dpll_xa_ref_pin_del(&pin->parent_refs, parent, ops, priv, pin);
index 26d1537ada8292a23280953320ec5a24f3f39eec..e2457711343173c6bef638bae1644972a4190be0 100644 (file)
@@ -100,6 +100,7 @@ extern struct xarray dpll_pin_xa;
 extern struct mutex dpll_lock;
 
 void dpll_device_notify(struct dpll_device *dpll, unsigned long action);
-void dpll_pin_notify(struct dpll_pin *pin, unsigned long action);
+void dpll_pin_notify(struct dpll_pin *pin, u64 src_clock_id,
+                    unsigned long action);
 
 #endif
index 6a23298244ccc5e86a5570c98efe9251a01937ec..8232d4543c7d2bcda59fcaaeac2b055af3b09b2f 100644 (file)
@@ -915,15 +915,15 @@ err_free_msg:
        return ret;
 }
 
-int dpll_pin_create_ntf(struct dpll_pin *pin)
+int dpll_pin_create_ntf(struct dpll_pin *pin, u64 src_clock_id)
 {
-       dpll_pin_notify(pin, DPLL_PIN_CREATED);
+       dpll_pin_notify(pin, src_clock_id, DPLL_PIN_CREATED);
        return dpll_pin_event_send(DPLL_CMD_PIN_CREATE_NTF, pin);
 }
 
-int dpll_pin_delete_ntf(struct dpll_pin *pin)
+int dpll_pin_delete_ntf(struct dpll_pin *pin, u64 src_clock_id)
 {
-       dpll_pin_notify(pin, DPLL_PIN_DELETED);
+       dpll_pin_notify(pin, src_clock_id, DPLL_PIN_DELETED);
        return dpll_pin_event_send(DPLL_CMD_PIN_DELETE_NTF, pin);
 }
 
@@ -938,7 +938,7 @@ int dpll_pin_delete_ntf(struct dpll_pin *pin)
 int __dpll_pin_change_ntf(struct dpll_pin *pin)
 {
        lockdep_assert_held(&dpll_lock);
-       dpll_pin_notify(pin, DPLL_PIN_CHANGED);
+       dpll_pin_notify(pin, pin->clock_id, DPLL_PIN_CHANGED);
        return dpll_pin_event_send(DPLL_CMD_PIN_CHANGE_NTF, pin);
 }
 EXPORT_SYMBOL_GPL(__dpll_pin_change_ntf);
index a9cfd55f57fc4281bacaac53d5ca959906121209..4f63aa58789a17ed0291234014ec5efa556c167f 100644 (file)
@@ -8,6 +8,6 @@ int dpll_device_create_ntf(struct dpll_device *dpll);
 
 int dpll_device_delete_ntf(struct dpll_device *dpll);
 
-int dpll_pin_create_ntf(struct dpll_pin *pin);
+int dpll_pin_create_ntf(struct dpll_pin *pin, u64 src_clock_id);
 
-int dpll_pin_delete_ntf(struct dpll_pin *pin);
+int dpll_pin_delete_ntf(struct dpll_pin *pin, u64 src_clock_id);
index 03a538167691c4bf6761988869f4cd90e2c1d982..7a6f8796cda2adabd6f04fbd72da17a512bdfb15 100644 (file)
@@ -233,6 +233,7 @@ struct dpll_pin_notifier_info {
        u64 clock_id;
        const struct fwnode_handle *fwnode;
        const struct dpll_pin_properties *prop;
+       u64 src_clock_id;
 };
 
 #if IS_ENABLED(CONFIG_DPLL)