From patchwork Thu Jan 9 10:17:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13932289 X-Patchwork-Delegate: kuba@kernel.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 4A042215F54; Thu, 9 Jan 2025 10:18:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736417935; cv=none; b=cAdKwm1wYWg7gLBJydP4QA+BFUwLGPyQyMn3mPGS+k7f3vSYZ54SfGE8SG8/37uIJ+8WPF6oO2Gtisc/3+4yTc3TLHvUr637Cn3IKiHNiCYcE7u6qi+EseedU/bjmx4ZSX4QuVeXSO8W2WzkW83m2CmUn2V60bEE6qfemkupaQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736417935; c=relaxed/simple; bh=Xqy6HlEBN2g67Mcm/lksLx1qaRNDOUivtjZA9ykw4aw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RwIDlw/xSRaNJTPh3wYBMQ2JMiqre0Ds1AOjIUiCmbVHrHdWjcMfKk9lwQEdCwKJp0EvLUvEJ0D3LGTKIzkNujJe98NvtqrvSO0ZwN2FWnRrnYFGZUjRRV2N9MNnFHnpkgjRwErDWKfZg4mcwHiQVgZOI+JE0u2DHa6gI0ldZLo= 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=Kp95hMiC; arc=none smtp.client-ip=217.70.183.196 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="Kp95hMiC" Received: by mail.gandi.net (Postfix) with ESMTPSA id 5D1BBE0008; Thu, 9 Jan 2025 10:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1736417926; 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=Olk4OigF7aLi/6DE+kXr5xzavP7KwQhC5yOFazqQf+w=; b=Kp95hMiC30mF+PsW95QBIq/XAqKKG5JHxjsvOClPd1Kb2k1u7d3UikxcApAA5+dybvhx0T QYBjsYqz5t+6KwBhSxRkcv/cK03vRrnxG+VXj6/3mqcFfdlUTz7XbAbaUkxN2S76sKlaQ7 voSJ8m+hJRcGsMumRgjuFNW5ocpKZ+z1VMaTNaYw8aiqmBsRQfeEOkONOGxyQx0N8L8XhM 9zZsue9FNWyS4TjrIXvk7ZJyfUIcIcsN2Ys/GgLrFOtCvh+PArCzMaVKxrv9gu0g18i8S3 FJYFKMRF/2wAx6lR7Ator6VDtbT1qFOMJ5+0XfLTrQzi8p3ScHYgKyYVHpUUMQ== From: Kory Maincent Date: Thu, 09 Jan 2025 11:17:56 +0100 Subject: [PATCH net-next v2 02/15] net: pse-pd: Avoid setting max_uA in regulator constraints Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250109-b4-feature_poe_arrange-v2-2-55ded947b510@bootlin.com> References: <20250109-b4-feature_poe_arrange-v2-0-55ded947b510@bootlin.com> In-Reply-To: <20250109-b4-feature_poe_arrange-v2-0-55ded947b510@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 X-Patchwork-Delegate: kuba@kernel.org From: Kory Maincent (Dent Project) 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 Signed-off-by: Kory Maincent --- 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";