Skip to content

Commit 675d0e3

Browse files
kmaincentPaolo Abeni
authored andcommitted
net: pse-pd: Avoid setting max_uA in regulator constraints
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 <[email protected]> Signed-off-by: Kory Maincent <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 514dcf7 commit 675d0e3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/pse-pd/pse_core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ static int pse_pi_set_current_limit(struct regulator_dev *rdev, int min_uA,
357357
if (!ops->pi_set_current_limit)
358358
return -EOPNOTSUPP;
359359

360+
if (max_uA > MAX_PI_CURRENT)
361+
return -ERANGE;
362+
360363
id = rdev_get_id(rdev);
361364
mutex_lock(&pcdev->lock);
362365
ret = ops->pi_set_current_limit(pcdev, id, max_uA);
@@ -403,11 +406,9 @@ devm_pse_pi_regulator_register(struct pse_controller_dev *pcdev,
403406

404407
rinit_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
405408

406-
if (pcdev->ops->pi_set_current_limit) {
409+
if (pcdev->ops->pi_set_current_limit)
407410
rinit_data->constraints.valid_ops_mask |=
408411
REGULATOR_CHANGE_CURRENT;
409-
rinit_data->constraints.max_uA = MAX_PI_CURRENT;
410-
}
411412

412413
rinit_data->supply_regulator = "vpwr";
413414

0 commit comments

Comments
 (0)