From: ahmadexp Disabling EXTTS currently selects PTP_PF_EXTTS, changing the shared PTP_CLK pin from periodic output to timestamp input. Only select the EXTTS function while enabling capture; disable continues to clear the state and synchronously stop the timer. A coding assistant helped analyze the teardown side effect, develop the correction and source-derived regression test, and prepare this changelog. The test exercises the actual function with configuration writes stubbed. Fixes: 747e5eb31d59 ("net: dsa: sja1105: configure the PTP_CLK pin as EXT_TS or PER_OUT") Signed-off-by: Ahmad Byagowi --- drivers/net/dsa/sja1105/sja1105_ptp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c index 350f958dcb2a..da35805152e0 100644 --- a/drivers/net/dsa/sja1105/sja1105_ptp.c +++ b/drivers/net/dsa/sja1105/sja1105_ptp.c @@ -816,9 +816,11 @@ static int sja1105_extts_enable(struct sja1105_private *priv, (extts->flags & PTP_EXTTS_EDGES) != PTP_EXTTS_EDGES) return -EOPNOTSUPP; - rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS); - if (rc) - return rc; + if (on) { + rc = sja1105_change_ptp_clk_pin_func(priv, PTP_PF_EXTTS); + if (rc) + return rc; + } priv->ptp_data.extts_enabled = on; -- 2.54.0 (Apple Git-157)