Relax the (module, clock_id) equality requirement when registering a
pin identified by firmware (pin->fwnode). Some platforms associate a
FW-described pin with a DPLL instance that differs from the pin's
(module, clock_id) tuple. For such pins, permit registration without
requiring the strict match. Non-FW pins still require equality.

Reviewed-by: Arkadiusz Kubalewski <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
Signed-off-by: Grzegorz Nitka <[email protected]>
---
 drivers/dpll/dpll_core.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 3f54754cdec4..0d25c23bd850 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -880,11 +880,21 @@ dpll_pin_register(struct dpll_device *dpll, struct 
dpll_pin *pin,
                return -EINVAL;
 
        mutex_lock(&dpll_lock);
-       if (WARN_ON(!(dpll->module == pin->module &&
-                     dpll->clock_id == pin->clock_id)))
+
+       /*
+        * For pins identified via firmware (pin->fwnode), allow registration
+        * even if the pin's (module, clock_id) differs from the target DPLL.
+        * For non-fwnode pins, require a strict (module, clock_id) match.
+        */
+       if (!pin->fwnode &&
+           WARN_ON_ONCE(dpll->module != pin->module ||
+               dpll->clock_id != pin->clock_id)) {
                ret = -EINVAL;
-       else
-               ret = __dpll_pin_register(dpll, pin, ops, priv, NULL);
+               goto out_unlock;
+       }
+
+       ret = __dpll_pin_register(dpll, pin, ops, priv, NULL);
+out_unlock:
        mutex_unlock(&dpll_lock);
 
        return ret;
-- 
2.39.3

Reply via email to