From nobody Thu Feb 12 21:47:01 2026 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21E8B1D7994; Sat, 4 Jan 2025 22:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736029736; cv=none; b=WqpzW6WuylxVXKPn5LrbKQBCRXBcGSQV109rCibunz+xvccI+QBKo9r46UiJcjaKJawEEiYlk8Kl6+3v+F5Pifr4AGILdkdO2DWplWkvZP+yzgdtKo1TEQD8KQvAACwFNVjqTMGomOUw9KIUwSbkHL20tChb9nr7rAOLqxByoig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736029736; c=relaxed/simple; bh=/tAXWE9ZL4WtZspUDdAze2QFcr2Yf2fb5nGAhV9PnmQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Xzg7aG9USlTc64KeI+A6qzrC8ftkxq81+Ey3ldzh/Qyow0CmQ2XpOoytfL0gG01OwuQWmCrO6Jmg874vrZY7TgMrh7KqvPolmONZUhSCWTgoDi5bSDiNjPuVDl1tnTFdWChF8lCFElS9vKD9yGabj4S+6F9ZNDrh4swArIFkrhc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=JUAxrAEO; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="JUAxrAEO" Received: by mail.gandi.net (Postfix) with ESMTPSA id B5A2740002; Sat, 4 Jan 2025 22:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1736029732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3sbdIG7o+MIgUW4/5Lh2oWiUH88289E01R5dOjp9fk0=; b=JUAxrAEOIGvp+h65Pf6gdrB6ljByE9+DfnZCwSUNRUFuy4XxNhP7OMdNcXDalOv1p4a/x7 uullnHvNUgSmGIrmfCXgbfHci5jgvzXSmCfSw5VZX+zS6jBgr5C1XZrp3hWvNEUcaYEJ3B S4xv5fOLMyvnGi7A6TcsBw0AOoJ4jzFQ/+/XaFGj+4vSN+C8CmFqjlVl/kaIib0swUfPHD CXF7YhfRJXG3/v9yJnyrh0GTStlaibORNlKmyPP4XtvTiFgk0Tp9iAv1eoJStLVG8JwjHX fCdvYhHhWXQgrS7N7MHhaV1yfc2wYh1TeiEElGCSnA7NhHCBtjjsvjhGVh75EA== From: Kory Maincent Date: Sat, 04 Jan 2025 23:27:31 +0100 Subject: [PATCH net-next 06/14] net: pse-pd: tps23881: Add missing configuration register after disable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250104-b4-feature_poe_arrange-v1-6-92f804bd74ed@bootlin.com> References: <20250104-b4-feature_poe_arrange-v1-0-92f804bd74ed@bootlin.com> In-Reply-To: <20250104-b4-feature_poe_arrange-v1-0-92f804bd74ed@bootlin.com> To: Oleksij Rempel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Donald Hunter , Jonathan Corbet , Liam Girdwood , Mark Brown Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, Kyle Swenson , Dent Project , kernel@pengutronix.de, Maxime Chevallier , Kory Maincent X-Mailer: b4 0.15-dev-8cb71 X-GND-Sasl: kory.maincent@bootlin.com From: Kory Maincent (Dent Project) When setting the PWOFF register, the controller resets multiple configuration registers. This patch ensures these registers are reconfigured as needed following a disable operation. Acked-by: Oleksij Rempel Signed-off-by: Kory Maincent --- drivers/net/pse-pd/tps23881.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c index 4a75206b2de6..b87c391ae0f5 100644 --- a/drivers/net/pse-pd/tps23881.c +++ b/drivers/net/pse-pd/tps23881.c @@ -130,6 +130,7 @@ static int tps23881_pi_disable(struct pse_controller_de= v *pcdev, int id) struct i2c_client *client =3D priv->client; u8 chan; u16 val; + int ret; =20 if (id >=3D TPS23881_MAX_CHANS) return -ERANGE; @@ -143,7 +144,34 @@ static int tps23881_pi_disable(struct pse_controller_d= ev *pcdev, int id) BIT(chan % 4)); } =20 - return i2c_smbus_write_word_data(client, TPS23881_REG_PW_EN, val); + ret =3D i2c_smbus_write_word_data(client, TPS23881_REG_PW_EN, val); + if (ret) + return ret; + + /* PWOFF command resets lots of register which need to be + * configured again. According to the datasheet "It may take upwards + * of 5ms after PWOFFn command for all register values to be updated" + */ + mdelay(5); + + /* Enable detection and classification */ + ret =3D i2c_smbus_read_word_data(client, TPS23881_REG_DET_CLA_EN); + if (ret < 0) + return ret; + + chan =3D priv->port[id].chan[0]; + val =3D tps23881_set_val(ret, chan, 0, BIT(chan % 4), BIT(chan % 4)); + val =3D tps23881_set_val(val, chan, 4, BIT(chan % 4), BIT(chan % 4)); + + if (priv->port[id].is_4p) { + chan =3D priv->port[id].chan[1]; + val =3D tps23881_set_val(ret, chan, 0, BIT(chan % 4), + BIT(chan % 4)); + val =3D tps23881_set_val(val, chan, 4, BIT(chan % 4), + BIT(chan % 4)); + } + + return i2c_smbus_write_word_data(client, TPS23881_REG_DET_CLA_EN, val); } =20 static int tps23881_pi_is_enabled(struct pse_controller_dev *pcdev, int id) --=20 2.34.1