Commit 9e5dead1 authored by Petr Oros's avatar Petr Oros Committed by Paolo Abeni
Browse files

ice: add dpll peer notification for paired SMA and U.FL pins



SMA and U.FL pins share physical signal paths in pairs (SMA1/U.FL1 and
SMA2/U.FL2).  When one pin's state changes via a PCA9575 GPIO write,
the paired pin's state also changes, but no notification is sent for
the peer pin.  Userspace consumers monitoring the peer via dpll netlink
subscribe never learn about the update.

Add ice_dpll_sw_pin_notify_peer() which sends a change notification for
the paired SW pin.  Call it from ice_dpll_pin_sma_direction_set(),
ice_dpll_sma_pin_state_set(), and ice_dpll_ufl_pin_state_set() after
pf->dplls.lock is released.  Use __dpll_pin_change_ntf() because
dpll_lock is still held by the dpll netlink layer (dpll_pin_pre_doit).

Fixes: 2dd5d03c ("ice: redesign dpll sma/u.fl pins control")
Signed-off-by: default avatarPetr Oros <poros@redhat.com>
Tested-by: default avatarAlexander Nowlin <alexander.nowlin@intel.com>
Reviewed-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260427-jk-iwl-net-petr-oros-fixes-v1-11-cdcb48303fd8@intel.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 1a41b58f
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -1154,6 +1154,32 @@ ice_dpll_input_state_get(const struct dpll_pin *pin, void *pin_priv,
				      extack, ICE_DPLL_PIN_TYPE_INPUT);
}

/**
 * ice_dpll_sw_pin_notify_peer - notify the paired SW pin after a state change
 * @d: pointer to dplls struct
 * @changed: the SW pin that was explicitly changed (already notified by dpll core)
 *
 * SMA and U.FL pins share physical signal paths in pairs (SMA1/U.FL1 and
 * SMA2/U.FL2).  When one pin's routing changes via the PCA9575 GPIO
 * expander, the paired pin's state may also change.  Send a change
 * notification for the peer pin so userspace consumers monitoring the
 * peer via dpll netlink learn about the update.
 *
 * Context: Called from dpll_pin_ops callbacks after pf->dplls.lock is
 *          released.  Uses __dpll_pin_change_ntf() because dpll_lock is
 *          still held by the dpll netlink layer.
 */
static void ice_dpll_sw_pin_notify_peer(struct ice_dplls *d,
					struct ice_dpll_pin *changed)
{
	struct ice_dpll_pin *peer;

	peer = (changed >= d->sma && changed < d->sma + ICE_DPLL_PIN_SW_NUM) ?
		&d->ufl[changed->idx] : &d->sma[changed->idx];
	if (peer->pin)
		__dpll_pin_change_ntf(peer->pin);
}

/**
 * ice_dpll_sma_direction_set - set direction of SMA pin
 * @p: pointer to a pin
@@ -1344,6 +1370,8 @@ ice_dpll_ufl_pin_state_set(const struct dpll_pin *pin, void *pin_priv,

unlock:
	mutex_unlock(&pf->dplls.lock);
	if (!ret)
		ice_dpll_sw_pin_notify_peer(&pf->dplls, p);

	return ret;
}
@@ -1462,6 +1490,8 @@ ice_dpll_sma_pin_state_set(const struct dpll_pin *pin, void *pin_priv,

unlock:
	mutex_unlock(&pf->dplls.lock);
	if (!ret)
		ice_dpll_sw_pin_notify_peer(&pf->dplls, sma);

	return ret;
}
@@ -1657,6 +1687,8 @@ ice_dpll_pin_sma_direction_set(const struct dpll_pin *pin, void *pin_priv,
	mutex_lock(&pf->dplls.lock);
	ret = ice_dpll_sma_direction_set(p, direction, extack);
	mutex_unlock(&pf->dplls.lock);
	if (!ret)
		ice_dpll_sw_pin_notify_peer(&pf->dplls, p);

	return ret;
}