From: Kory Maincent <kory.maincent@bootlin.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Donald Hunter <donald.hunter@gmail.com>,
Jonathan Corbet <corbet@lwn.net>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-doc@vger.kernel.org, Kyle Swenson <kyle.swenson@est.tech>,
Dent Project <dentproject@linuxfoundation.org>,
kernel@pengutronix.de,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Kory Maincent <kory.maincent@bootlin.com>
Subject: [PATCH net-next v3 02/12] net: pse-pd: Avoid setting max_uA in regulator constraints
Date: Fri, 10 Jan 2025 10:40:21 +0100 [thread overview]
Message-ID: <20250110-b4-feature_poe_arrange-v3-2-142279aedb94@bootlin.com> (raw)
In-Reply-To: <20250110-b4-feature_poe_arrange-v3-0-142279aedb94@bootlin.com>
Setting the max_uA constraint in the regulator API imposes a current
limit during the regulator registration process. This behavior conflicts
with preserving the maximum PI power budget configuration across reboots.
Instead, compare the desired current limit to MAX_PI_CURRENT in the
pse_pi_set_current_limit() function to ensure proper handling of the
power budget.
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/pse_core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c
index 2906ce173f66..9fee4dd53515 100644
--- a/drivers/net/pse-pd/pse_core.c
+++ b/drivers/net/pse-pd/pse_core.c
@@ -357,6 +357,9 @@ static int pse_pi_set_current_limit(struct regulator_dev *rdev, int min_uA,
if (!ops->pi_set_current_limit)
return -EOPNOTSUPP;
+ if (max_uA > MAX_PI_CURRENT)
+ return -ERANGE;
+
id = rdev_get_id(rdev);
mutex_lock(&pcdev->lock);
ret = ops->pi_set_current_limit(pcdev, id, max_uA);
@@ -403,11 +406,9 @@ devm_pse_pi_regulator_register(struct pse_controller_dev *pcdev,
rinit_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
- if (pcdev->ops->pi_set_current_limit) {
+ if (pcdev->ops->pi_set_current_limit)
rinit_data->constraints.valid_ops_mask |=
REGULATOR_CHANGE_CURRENT;
- rinit_data->constraints.max_uA = MAX_PI_CURRENT;
- }
rinit_data->supply_regulator = "vpwr";
--
2.34.1
next prev parent reply other threads:[~2025-01-10 9:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 9:40 [PATCH net-next v3 00/12] Arrange PSE core and update TPS23881 driver Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 01/12] net: pse-pd: Remove unused pse_ethtool_get_pw_limit function declaration Kory Maincent
2025-01-10 9:40 ` Kory Maincent [this message]
2025-01-10 9:40 ` [PATCH net-next v3 03/12] net: pse-pd: Add power limit check Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 04/12] net: pse-pd: tps23881: Simplify function returns by removing redundant checks Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 05/12] net: pse-pd: tps23881: Use helpers to calculate bit offset for a channel Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 06/12] net: pse-pd: tps23881: Add missing configuration register after disable Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 07/12] net: pse-pd: Use power limit at driver side instead of current limit Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 08/12] net: pse-pd: Split ethtool_get_status into multiple callbacks Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 09/12] net: pse-pd: Remove is_enabled callback from drivers Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 10/12] net: pse-pd: tps23881: Add support for power limit and measurement features Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 11/12] net: pse-pd: Fix missing PI of_node description Kory Maincent
2025-01-10 9:40 ` [PATCH net-next v3 12/12] net: pse-pd: Clean ethtool header of PSE structures Kory Maincent
2025-01-14 13:10 ` [PATCH net-next v3 00/12] Arrange PSE core and update TPS23881 driver patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250110-b4-feature_poe_arrange-v3-2-142279aedb94@bootlin.com \
--to=kory.maincent@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dentproject@linuxfoundation.org \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=kyle.swenson@est.tech \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®