Re: [PATCH net-next 3/4] net: pse-pd: realtek-pse-mcu: configure global power budget

From: Kory Maincent

Date: Wed Nov 04 2026 - 06:34:29 EST




On 11/3/26 23:03, Jonas Jelonek wrote:
Use the optional VMAIN regulator power budget to configure the MCU's
aggregate PoE power limit during probe. Quantize the available budget to
the protocol's 100 mW units and reserve exactly that amount through the
regulator core.

The regulator budget represents the usable PoE allowance. Program zero
reserved power so the previous firmware guard band does not further reduce
that allowance.

Require a finite budget of at least one protocol unit when vmain-supply is
provided. Program the budget before selecting dynamic power management and
ungating the ports, so enforcement starts with the regulator-derived limit.

Enable VMAIN before hardware initialization and register one managed cleanup
action to free any reserved budget and release the enable reference on probe
failure and driver removal. Record each successful reservation immediately
so subsequent initialization failures are covered by this action.

Read the current budget index before programming the MCU. Retain the
programmed MCU limit on probe failure and driver removal, as reducing that
limit to zero would interrupt ongoing power delivery.

Boards without vmain-supply retain their existing firmware-managed
budget.

Signed-off-by: Jonas Jelonek <jonas@xxxxxxxxxxxxxxx>
---

...

+static void rtpse_mcu_cleanup_vmain(void *data)
+{
+ struct rtpse_mcu_ctrl *pse = data;
+
+ if (pse->requested_budget_mW)
+ regulator_free_power_budget(pse->vmain, pse->requested_budget_mW);
+ regulator_disable(pse->vmain);
+}

Following patch 4 logic, you might not want to disable the PSE controller power supply, this will lead to a power off of all your PIs.
I think you should still free the power budget, to not allocate it twice if the module is loaded again.

Else is ok to me.

--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com