Skip to content

Commit dda3529

Browse files
kmaincentkuba-moo
authored andcommitted
net: pse-pd: Fix enabled status mismatch
PSE controllers like the TPS23881 can forcefully turn off their configuration state. In such cases, the is_enabled() and get_status() callbacks will report the PSE as disabled, while admin_state_enabled will show it as enabled. This mismatch can lead the user to attempt to enable it, but no action is taken as admin_state_enabled remains set. The solution is to disable the PSE before enabling it, ensuring the actual status matches admin_state_enabled. Fixes: d83e137 ("net: pse-pd: Use regulator framework within PSE framework") Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20241002121706.246143-1-kory.maincent@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 9f49d14 commit dda3529

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/net/pse-pd/pse_core.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,17 @@ static int pse_ethtool_c33_set_config(struct pse_control *psec,
785785
*/
786786
switch (config->c33_admin_control) {
787787
case ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED:
788+
/* We could have mismatch between admin_state_enabled and
789+
* state reported by regulator_is_enabled. This can occur when
790+
* the PI is forcibly turn off by the controller. Call
791+
* regulator_disable on that case to fix the counters state.
792+
*/
793+
if (psec->pcdev->pi[psec->id].admin_state_enabled &&
794+
!regulator_is_enabled(psec->ps)) {
795+
err = regulator_disable(psec->ps);
796+
if (err)
797+
break;
798+
}
788799
if (!psec->pcdev->pi[psec->id].admin_state_enabled)
789800
err = regulator_enable(psec->ps);
790801
break;

0 commit comments

Comments
 (0)