* [PATCH net-next 1/8] dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
@ 2026-12-02 14:08 ` Kory Maincent
2026-12-03 14:21 ` netdev-bot+sashiko
2026-12-02 14:08 ` [PATCH net-next 2/8] net: pse-pd: Add helpers to convert between mW and uA Kory Maincent (AddSecure)
` (6 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Kory Maincent @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
The TPS23881 takes a 3.3V power supply on VDD and a 54V supply on VPWR.
Document the VDD and VPWR supply properties.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml b/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
index 0b3803f647b7b..6e1438e5eb32a 100644
--- a/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
+++ b/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
@@ -30,6 +30,12 @@ properties:
reset-gpios:
maxItems: 1
+ vdd-supply:
+ description: Regulator that provides 3.3V VDD power supply.
+
+ vpwr-supply:
+ description: Regulator that provides 54V VPWR power supply.
+
channels:
description: |
Defines the 8 physical delivery channels on the controller that can
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH net-next 1/8] dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply
2026-12-02 14:08 ` [PATCH net-next 1/8] dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply Kory Maincent
@ 2026-12-03 14:21 ` netdev-bot+sashiko
2026-12-03 14:55 ` Kory Maincent
0 siblings, 1 reply; 14+ messages in thread
From: netdev-bot+sashiko @ 2026-12-03 14:21 UTC (permalink / raw)
To: kory.maincent
Cc: o.rempel, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
krzk+dt, conor+dt, roman, maxime.chevallier, thomas.petazzoni,
netdev, linux-kernel, Phil.Edworthy, devicetree
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The binding adds a controller-level `vpwr-supply`
(ti,tps23881.yaml lines 36-37).
--
dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply
This adds vdd-supply and vpwr-supply properties to the TPS23881 binding.
They describe the 3.3V VDD supply and the 54V VPWR supply of the chip.
> diff --git a/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml b/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
> index 0b3803f647b7b..6e1438e5eb32a 100644
> --- a/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
> +++ b/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
> @@ -30,6 +30,12 @@ properties:
> reset-gpios:
> maxItems: 1
>
> + vdd-supply:
> + description: Regulator that provides 3.3V VDD power supply.
> +
> + vpwr-supply:
> + description: Regulator that provides 54V VPWR power supply.
[Severity: Medium]
Will this controller-level vpwr-supply get mixed up with the per-PI
vpwr-supply? pse-controller.yaml already defines a property with the same
name under pse-pis/pse-pi@N, and those PI nodes are children of this same
TPS23881 node.
The regulator core's DT lookup falls back between these two levels, so
each property can resolve to the other.
First case: the driver lookup picks up a PI's supply. Later in this
series, "net: pse-pd: tps23881: Add support for Vdd and Vpwr power
supply" adds this to tps23881_i2c_probe():
static const char * const regulators[] = { "vdd", "vpwr" };
...
ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulators),
regulators);
Take a DT with no controller-level vpwr-supply but with PI nodes that
carry vpwr-supply = <&vpwr1>. Existing DTs and this binding's own example
look like that. The lookup goes through of_get_regulator():
regnode = of_parse_phandle(node, prop_name, 0);
if (regnode)
return regnode;
regnode = of_get_child_regulator(dev->of_node, prop_name);
of_get_child_regulator() then searches the children recursively:
for_each_child_of_node(parent, child) {
regnode = of_parse_phandle(child, prop_name, 0);
if (regnode)
goto err_node_put;
regnode = of_get_child_regulator(child, prop_name);
...
The search goes channels -> channel@N -> pse-pis -> pse-pi@0 and returns
the first PI's &vpwr1 instead of a dummy regulator.
In that case the TPS23881 driver would enable that PI's supply and keep
it enabled through devm while the driver is bound. Probe would also
defer until that regulator registers.
Second case: PIs inherit the controller's supply. In
devm_pse_pi_regulator_register(), the PI regulator is registered with
the TPS23881 device as its parent:
rinit_data->supply_regulator = "vpwr";
rconfig.dev = pcdev->dev;
...
rconfig.of_node = pcdev->pi[id].np;
regulator_resolve_supply() looks in the PI node first and then falls
back to the parent device:
r = regulator_dt_lookup(&rdev->dev, rdev->supply_name);
if (!r)
r = regulator_dev_lookup(dev, rdev->supply_name);
A PI without its own vpwr-supply (it is optional in pse-controller.yaml)
would then be attached to the new chip-level VPWR rail. That changes the
supply-based PSE power-domain grouping.
Is that intended? If it is, should the binding say how the two
same-named properties interact? The example could also show both
properties together.
Could the consuming driver also avoid the child-node fallback, for
example by checking that vpwr-supply exists on the controller node
before requesting it?
> +
> channels:
> description: |
> Defines the 8 physical delivery channels on the controller that can
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-feat_tps23861-v1-0-7d8320369817%40bootlin.com
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 1/8] dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply
2026-12-03 14:21 ` netdev-bot+sashiko
@ 2026-12-03 14:55 ` Kory Maincent
0 siblings, 0 replies; 14+ messages in thread
From: Kory Maincent @ 2026-12-03 14:55 UTC (permalink / raw)
To: netdev-bot+sashiko
Cc: o.rempel, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
krzk+dt, conor+dt, roman, maxime.chevallier, thomas.petazzoni,
netdev, linux-kernel, Phil.Edworthy, devicetree
On 12/3/26 15:21, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] The binding adds a controller-level `vpwr-supply`
> (ti,tps23881.yaml lines 36-37).
>
> --
>
> dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply
>
> This adds vdd-supply and vpwr-supply properties to the TPS23881 binding.
> They describe the 3.3V VDD supply and the 54V VPWR supply of the chip.
>
>> diff --git a/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml b/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
>> index 0b3803f647b7b..6e1438e5eb32a 100644
>> --- a/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
>> +++ b/Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml
>> @@ -30,6 +30,12 @@ properties:
>> reset-gpios:
>> maxItems: 1
>>
>> + vdd-supply:
>> + description: Regulator that provides 3.3V VDD power supply.
>> +
>> + vpwr-supply:
>> + description: Regulator that provides 54V VPWR power supply.
>
> [Severity: Medium]
> Will this controller-level vpwr-supply get mixed up with the per-PI
> vpwr-supply? pse-controller.yaml already defines a property with the same
> name under pse-pis/pse-pi@N, and those PI nodes are children of this same
> TPS23881 node.
The VPWR for the PIs and the chip are the same, so IMHO I should keep it
like that. I will add some note explaining it in the description.
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 2/8] net: pse-pd: Add helpers to convert between mW and uA
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
2026-12-02 14:08 ` [PATCH net-next 1/8] dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply Kory Maincent
@ 2026-12-02 14:08 ` Kory Maincent (AddSecure)
2026-12-02 14:08 ` [PATCH net-next 3/8] net: pse-pd: si3474: Use new mW/uA conversion helpers Kory Maincent (AddSecure)
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Kory Maincent (AddSecure) @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
The conversion between power in mW and current in uA for a given
voltage in uV is done several times in the PSE core and drivers.
Add pse_to_mW() and pse_to_uA() helpers to avoid duplicating the
conversion code.
Signed-off-by: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/pse_core.c | 28 ++++++----------------------
include/linux/pse-pd/pse.h | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/drivers/net/pse-pd/pse_core.c b/drivers/net/pse-pd/pse_core.c
index 0477cf6787bd3..8643ee53ef344 100644
--- a/drivers/net/pse-pd/pse_core.c
+++ b/drivers/net/pse-pd/pse_core.c
@@ -763,8 +763,7 @@ static int pse_pi_get_current_limit(struct regulator_dev *rdev)
{
struct pse_controller_dev *pcdev = rdev_get_drvdata(rdev);
const struct pse_controller_ops *ops;
- int id, uV, mW, ret;
- s64 tmp_64;
+ int id, mW, ret;
ops = pcdev->ops;
id = rdev_get_id(rdev);
@@ -785,12 +784,8 @@ static int pse_pi_get_current_limit(struct regulator_dev *rdev)
}
if (ret < 0)
goto out;
- uV = ret;
- tmp_64 = mW;
- tmp_64 *= 1000000000ull;
- /* uA = mW * 1000000000 / uV */
- ret = DIV_ROUND_CLOSEST_ULL(tmp_64, uV);
+ ret = pse_to_uA(mW, ret);
out:
mutex_unlock(&pcdev->lock);
@@ -802,8 +797,7 @@ static int pse_pi_set_current_limit(struct regulator_dev *rdev, int min_uA,
{
struct pse_controller_dev *pcdev = rdev_get_drvdata(rdev);
const struct pse_controller_ops *ops;
- int id, mW, ret;
- s64 tmp_64;
+ int id, ret;
ops = pcdev->ops;
if (!ops->pi_set_pw_limit || !ops->pi_get_voltage)
@@ -823,11 +817,7 @@ static int pse_pi_set_current_limit(struct regulator_dev *rdev, int min_uA,
if (ret < 0)
goto out;
- tmp_64 = ret;
- tmp_64 *= max_uA;
- /* mW = uA * uV / 1000000000 */
- mW = DIV_ROUND_CLOSEST_ULL(tmp_64, 1000000000);
- ret = ops->pi_set_pw_limit(pcdev, id, mW);
+ ret = ops->pi_set_pw_limit(pcdev, id, pse_to_mW(max_uA, ret));
out:
mutex_unlock(&pcdev->lock);
@@ -1961,9 +1951,8 @@ int pse_ethtool_set_pw_limit(struct pse_control *psec,
struct netlink_ext_ack *extack,
const unsigned int pw_limit)
{
- int uV, uA, ret, previous_pw_allocated = 0;
+ int uA, ret, previous_pw_allocated = 0;
bool updated;
- s64 tmp_64;
if (pw_limit > MAX_PI_PW)
return -ERANGE;
@@ -1979,12 +1968,7 @@ int pse_ethtool_set_pw_limit(struct pse_control *psec,
"Error reading PSE voltage");
return ret;
}
- uV = ret;
-
- tmp_64 = pw_limit;
- tmp_64 *= 1000000000ull;
- /* uA = mW * 1000000000 / uV */
- uA = DIV_ROUND_CLOSEST_ULL(tmp_64, uV);
+ uA = pse_to_uA(pw_limit, ret);
/* Update power budget only in software power control case and
* if the PI is enabled and has a PD detected.
diff --git a/include/linux/pse-pd/pse.h b/include/linux/pse-pd/pse.h
index 17738ffcd224f..ea3743284f795 100644
--- a/include/linux/pse-pd/pse.h
+++ b/include/linux/pse-pd/pse.h
@@ -342,6 +342,40 @@ enum pse_budget_eval_strategies {
PSE_BUDGET_EVAL_STRAT_DYNAMIC = 1 << 2,
};
+/**
+ * pse_to_mW - Convert current and voltage to power in milliwatts
+ * @uA: current in microamps
+ * @uV: voltage in microvolts
+ *
+ * Return: the power in mW
+ */
+static inline int pse_to_mW(int uA, int uV)
+{
+ s64 tmp_64;
+
+ tmp_64 = uA;
+ tmp_64 *= uV;
+ /* mW = uA * uV / 1000000000 */
+ return DIV_ROUND_CLOSEST_ULL(tmp_64, 1000000000);
+}
+
+/**
+ * pse_to_uA - Convert power and voltage to current in microamps
+ * @mW: power in milliwatts
+ * @uV: voltage in microvolts
+ *
+ * Return: the current in uA
+ */
+static inline int pse_to_uA(int mW, int uV)
+{
+ s64 tmp_64;
+
+ tmp_64 = mW;
+ tmp_64 *= 1000000000ull;
+ /* uA = mW * 1000000000 / uV */
+ return DIV_ROUND_CLOSEST_ULL(tmp_64, uV);
+}
+
#if IS_ENABLED(CONFIG_PSE_CONTROLLER)
int pse_controller_register(struct pse_controller_dev *pcdev);
void pse_controller_unregister(struct pse_controller_dev *pcdev);
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH net-next 3/8] net: pse-pd: si3474: Use new mW/uA conversion helpers
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
2026-12-02 14:08 ` [PATCH net-next 1/8] dt-bindings: pse-pd: ti,tps23881: Add VDD and VPWR regulator supply Kory Maincent
2026-12-02 14:08 ` [PATCH net-next 2/8] net: pse-pd: Add helpers to convert between mW and uA Kory Maincent (AddSecure)
@ 2026-12-02 14:08 ` Kory Maincent (AddSecure)
2026-12-02 14:08 ` [PATCH net-next 4/8] net: pse-pd: tps23881: " Kory Maincent (AddSecure)
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Kory Maincent (AddSecure) @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
Now that we have helpers for the mW/uA conversion, use them in the
si3474 driver to avoid duplicating the code.
Signed-off-by: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/si3474.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/pse-pd/si3474.c b/drivers/net/pse-pd/si3474.c
index c18df3c2ceb6e..6760d3ec1f56c 100644
--- a/drivers/net/pse-pd/si3474.c
+++ b/drivers/net/pse-pd/si3474.c
@@ -440,7 +440,6 @@ static int si3474_pi_get_actual_pw(struct pse_controller_dev *pcdev, int id)
struct si3474_priv *priv = to_si3474_priv(pcdev);
u8 chan0, chan1;
u32 uV, uA;
- u64 tmp_64;
s32 ret;
ret = si3474_pi_get_voltage(&priv->pcdev, id);
@@ -462,10 +461,7 @@ static int si3474_pi_get_actual_pw(struct pse_controller_dev *pcdev, int id)
return ret;
uA += ret;
- tmp_64 = uV;
- tmp_64 *= uA;
- /* mW = uV * uA / 1000000000 */
- return DIV_ROUND_CLOSEST_ULL(tmp_64, 1000000000);
+ return pse_to_mW(uA, uV);
}
static const struct pse_controller_ops si3474_ops = {
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH net-next 4/8] net: pse-pd: tps23881: Use new mW/uA conversion helpers
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
` (2 preceding siblings ...)
2026-12-02 14:08 ` [PATCH net-next 3/8] net: pse-pd: si3474: Use new mW/uA conversion helpers Kory Maincent (AddSecure)
@ 2026-12-02 14:08 ` Kory Maincent (AddSecure)
2026-12-02 14:08 ` [PATCH net-next 5/8] net: pse-pd: tps23881: Clean up register defines and comments Kory Maincent (AddSecure)
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Kory Maincent (AddSecure) @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
Now that we have helpers for the mW/uA conversion, use them in the
tps23881 driver to avoid duplicating the code.
Signed-off-by: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/tps23881.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index 244ce596d845c..d993652a508d1 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -424,7 +424,6 @@ tps23881_pi_get_actual_pw(struct pse_controller_dev *pcdev, int id)
{
struct tps23881_priv *priv = to_tps23881_priv(pcdev);
int ret, uV, uA;
- u64 tmp_64;
u8 chan;
ret = tps23881_pi_get_voltage(&priv->pcdev, id);
@@ -446,10 +445,7 @@ tps23881_pi_get_actual_pw(struct pse_controller_dev *pcdev, int id)
uA += ret;
}
- tmp_64 = uV;
- tmp_64 *= uA;
- /* mW = uV * uA / 1000000000 */
- return DIV_ROUND_CLOSEST_ULL(tmp_64, 1000000000);
+ return pse_to_mW(uA, uV);
}
static int
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH net-next 5/8] net: pse-pd: tps23881: Clean up register defines and comments
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
` (3 preceding siblings ...)
2026-12-02 14:08 ` [PATCH net-next 4/8] net: pse-pd: tps23881: " Kory Maincent (AddSecure)
@ 2026-12-02 14:08 ` Kory Maincent (AddSecure)
2026-12-02 14:08 ` [PATCH net-next 6/8] net: pse-pd: tps23881: Factor out power policy configuration Kory Maincent (AddSecure)
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Kory Maincent (AddSecure) @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
TPS23881_REG_DIS_EN and TPS23881_REG_DISC_EN are two names for the same
register value. Keep only TPS23881_REG_DISC_EN and fix its use.
Remove the unused TPS23881_REG_CHAN1_V and TPS23881_REG_TPON defines.
Fix the tps23881_get_of_channels() comment which talked about managers
instead of channels.
Signed-off-by: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/tps23881.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index d993652a508d1..04ee7f8f3e18a 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -32,9 +32,8 @@
#define TPS23881_REG_DISC 0xc
#define TPS23881_REG_PW_STATUS 0x10
#define TPS23881_REG_OP_MODE 0x12
-#define TPS23881_REG_DISC_EN 0x13
#define TPS23881_OP_MODE_SEMIAUTO 0xaaaa
-#define TPS23881_REG_DIS_EN 0x13
+#define TPS23881_REG_DISC_EN 0x13
#define TPS23881_REG_DET_CLA_EN 0x14
#define TPS23881_REG_GEN_MASK 0x17
#define TPS23881_REG_CLCHE BIT(2)
@@ -50,9 +49,7 @@
#define TPS23881_REG_4PAIR_POL1 0x2a
#define TPS23881_REG_INPUT_V 0x2e
#define TPS23881_REG_CHAN1_A 0x30
-#define TPS23881_REG_CHAN1_V 0x32
#define TPS23881_REG_FOLDBACK 0x40
-#define TPS23881_REG_TPON BIT(0)
#define TPS23881_REG_FWREV 0x41
#define TPS23881_REG_DEVID 0x43
#define TPS23881_REG_CHAN1_CLASS 0x4c
@@ -531,7 +528,7 @@ tps23881_pi_get_pw_limit_ranges(struct pse_controller_dev *pcdev, int id,
return 1;
}
-/* Parse managers subnode into a array of device node */
+/* Parse channels subnode into an array of device node */
static int
tps23881_get_of_channels(struct tps23881_priv *priv,
struct device_node *chan_node[TPS23881_MAX_CHANS])
@@ -868,7 +865,7 @@ tps23881_set_ports_conf(struct tps23881_priv *priv,
return ret;
/* Disable DC disconnect */
- ret = i2c_smbus_write_word_data(client, TPS23881_REG_DIS_EN, 0x0);
+ ret = i2c_smbus_write_word_data(client, TPS23881_REG_DISC_EN, 0x0);
if (ret)
return ret;
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH net-next 6/8] net: pse-pd: tps23881: Factor out power policy configuration
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
` (4 preceding siblings ...)
2026-12-02 14:08 ` [PATCH net-next 5/8] net: pse-pd: tps23881: Clean up register defines and comments Kory Maincent (AddSecure)
@ 2026-12-02 14:08 ` Kory Maincent (AddSecure)
2026-12-03 14:11 ` sashiko-bot
2026-12-02 14:08 ` [PATCH net-next 7/8] net: pse-pd: tps23881: Use fsleep instead of mdelay Kory Maincent (AddSecure)
2026-12-02 14:08 ` [PATCH net-next 8/8] net: pse-pd: tps23881: Add support for Vdd and Vpwr power supply Kory Maincent (AddSecure)
7 siblings, 1 reply; 14+ messages in thread
From: Kory Maincent (AddSecure) @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
The sequence that enables the manual power policy and then programs the
power policy limit is duplicated in tps23881_pi_disable() and
tps23881_irq_event_over_current(). Factor it out into a new
tps23881_pi_conf_pw_pol_limit() helper.
Signed-off-by: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/tps23881.c | 41 +++++++++++++++++++----------------------
1 file changed, 19 insertions(+), 22 deletions(-)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index 04ee7f8f3e18a..a7ff69e2561b4 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -215,6 +215,23 @@ static int tps23881_pi_enable(struct pse_controller_dev *pcdev, int id)
return 0;
}
+static int tps23881_pi_conf_pw_pol_limit(struct tps23881_priv *priv, int id)
+{
+ int ret;
+
+ /* No power policy */
+ if (priv->port[id].pw_pol < 0)
+ return 0;
+
+ ret = tps23881_pi_enable_manual_pol(priv, id);
+ if (ret < 0)
+ return ret;
+
+ /* Set power policy */
+ return tps23881_pi_set_pw_pol_limit(priv, id, priv->port[id].pw_pol,
+ priv->port[id].is_4p);
+}
+
static int tps23881_pi_disable(struct pse_controller_dev *pcdev, int id)
{
struct tps23881_priv *priv = to_tps23881_priv(pcdev);
@@ -277,17 +294,7 @@ static int tps23881_pi_disable(struct pse_controller_dev *pcdev, int id)
if (ret)
return ret;
- /* No power policy */
- if (priv->port[id].pw_pol < 0)
- return 0;
-
- ret = tps23881_pi_enable_manual_pol(priv, id);
- if (ret < 0)
- return ret;
-
- /* Set power policy */
- return tps23881_pi_set_pw_pol_limit(priv, id, priv->port[id].pw_pol,
- priv->port[id].is_4p);
+ return tps23881_pi_conf_pw_pol_limit(priv, id);
}
static int
@@ -1198,17 +1205,7 @@ static int tps23881_irq_event_over_current(struct tps23881_priv *priv,
* to configured it again.
*/
for_each_set_bit(i, notifs_mask, priv->pcdev.nr_lines) {
- if (priv->port[i].pw_pol < 0)
- continue;
-
- ret = tps23881_pi_enable_manual_pol(priv, i);
- if (ret < 0)
- return ret;
-
- /* Set power policy */
- ret = tps23881_pi_set_pw_pol_limit(priv, i,
- priv->port[i].pw_pol,
- priv->port[i].is_4p);
+ ret = tps23881_pi_conf_pw_pol_limit(priv, i);
if (ret < 0)
return ret;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH net-next 6/8] net: pse-pd: tps23881: Factor out power policy configuration
2026-12-02 14:08 ` [PATCH net-next 6/8] net: pse-pd: tps23881: Factor out power policy configuration Kory Maincent (AddSecure)
@ 2026-12-03 14:11 ` sashiko-bot
2026-12-03 14:56 ` Kory Maincent
0 siblings, 1 reply; 14+ messages in thread
From: sashiko-bot @ 2026-12-03 14:11 UTC (permalink / raw)
To: Kory Maincent (AddSecure); +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] net: pse-pd: tps23881: 16-bit foldback value truncated in
tps23881_pi_enable_manual_pol() [1]
--
commit a24d988872c37423e41bab88b1a60b38aaeef9aa
Author: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
net: pse-pd: tps23881: Factor out power policy configuration
This commit factors out the sequence that enables manual power policy and
configures the power policy limit into a new tps23881_pi_conf_pw_pol_limit()
helper.
> diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
> index 04ee7f8f3e18a..a7ff69e2561b4 100644
> --- a/drivers/net/pse-pd/tps23881.c
> +++ b/drivers/net/pse-pd/tps23881.c
> @@ -215,6 +215,23 @@ static int tps23881_pi_enable(struct pse_controller_dev *pcdev, int id)
> return 0;
> }
>
> +static int tps23881_pi_conf_pw_pol_limit(struct tps23881_priv *priv, int id)
> +{
> + int ret;
> +
> + /* No power policy */
> + if (priv->port[id].pw_pol < 0)
> + return 0;
> +
> + ret = tps23881_pi_enable_manual_pol(priv, id);
[Severity: High]
This problem wasn't introduced by this patch, but does
tps23881_pi_enable_manual_pol() truncate the 16-bit TPS23881_REG_FOLDBACK
value [1] on channels 4 through 7?
drivers/net/pse-pd/tps23881.c:tps23881_pi_enable_manual_pol() {
ret = i2c_smbus_read_byte_data(client, TPS23881_REG_FOLDBACK);
if (ret < 0)
return ret;
...
chan = priv->port[id].chan[0];
val = tps23881_set_val(ret, chan, 0, BIT(chan % 4), BIT(chan % 4));
return i2c_smbus_write_byte_data(client, TPS23881_REG_FOLDBACK, val);
}
The driver enables 16-bit register access (TPS23881_REG_NBITACC), so
tps23881_set_val() shifts the bit for channels 4 through 7 into bits 8..15
of val. Using i2c_smbus_read_byte_data() and i2c_smbus_write_byte_data()
instead of the word accessors drops the upper byte, leaving the manual
power policy disabled on ports mapped to channels 4 through 7.
[1] https://sashiko.dev/#/bug/linux-200958a2-c64a-48bf-b1f6-1584a6f2b35d
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-feat_tps23861-v1-0-7d8320369817@bootlin.com?part=6
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH net-next 6/8] net: pse-pd: tps23881: Factor out power policy configuration
2026-12-03 14:11 ` sashiko-bot
@ 2026-12-03 14:56 ` Kory Maincent
0 siblings, 0 replies; 14+ messages in thread
From: Kory Maincent @ 2026-12-03 14:56 UTC (permalink / raw)
To: sashiko-reviews; +Cc: devicetree, robh, conor+dt
On 12/3/26 15:11, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found no new issues
> in this patch, but noticed 1 related pre-existing issue it does not
> introduce:
> - [High] net: pse-pd: tps23881: 16-bit foldback value truncated in
> tps23881_pi_enable_manual_pol() [1]
> --
>
> commit a24d988872c37423e41bab88b1a60b38aaeef9aa
> Author: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
>
> net: pse-pd: tps23881: Factor out power policy configuration
>
> This commit factors out the sequence that enables manual power policy and
> configures the power policy limit into a new tps23881_pi_conf_pw_pol_limit()
> helper.
>
>> diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
>> index 04ee7f8f3e18a..a7ff69e2561b4 100644
>> --- a/drivers/net/pse-pd/tps23881.c
>> +++ b/drivers/net/pse-pd/tps23881.c
>> @@ -215,6 +215,23 @@ static int tps23881_pi_enable(struct pse_controller_dev *pcdev, int id)
>> return 0;
>> }
>>
>> +static int tps23881_pi_conf_pw_pol_limit(struct tps23881_priv *priv, int id)
>> +{
>> + int ret;
>> +
>> + /* No power policy */
>> + if (priv->port[id].pw_pol < 0)
>> + return 0;
>> +
>> + ret = tps23881_pi_enable_manual_pol(priv, id);
>
> [Severity: High]
> This problem wasn't introduced by this patch, but does
> tps23881_pi_enable_manual_pol() truncate the 16-bit TPS23881_REG_FOLDBACK
> value [1] on channels 4 through 7?
This is right.
I have sent a fix accordingly.
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 7/8] net: pse-pd: tps23881: Use fsleep instead of mdelay
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
` (5 preceding siblings ...)
2026-12-02 14:08 ` [PATCH net-next 6/8] net: pse-pd: tps23881: Factor out power policy configuration Kory Maincent (AddSecure)
@ 2026-12-02 14:08 ` Kory Maincent (AddSecure)
2026-12-02 14:08 ` [PATCH net-next 8/8] net: pse-pd: tps23881: Add support for Vdd and Vpwr power supply Kory Maincent (AddSecure)
7 siblings, 0 replies; 14+ messages in thread
From: Kory Maincent (AddSecure) @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
The code does not run in atomic context, so busy-waiting with mdelay()
is unnecessary. Use fsleep() instead, which sleeps for the requested
time instead of wasting CPU cycles.
Signed-off-by: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/tps23881.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index a7ff69e2561b4..5736f052732a2 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -260,7 +260,7 @@ static int tps23881_pi_disable(struct pse_controller_dev *pcdev, int id)
* configured again. According to the datasheet "It may take upwards
* of 5ms after PWOFFn command for all register values to be updated"
*/
- mdelay(5);
+ fsleep(5000);
/* Disable DC disconnect*/
chan = priv->port[id].chan[0];
@@ -982,7 +982,7 @@ static int tps23881_pi_get_pw_req(struct pse_controller_dev *pcdev, int id)
/* For a 4-pair the classification need 5ms to be completed */
if (priv->port[id].is_4p)
- mdelay(5);
+ fsleep(5000);
chan = priv->port[id].chan[0];
reg = TPS23881_REG_DISC + (chan % 4);
@@ -1121,7 +1121,7 @@ static int tps23881_flash_sram_fw(struct i2c_client *client,
if (ret)
return ret;
- mdelay(12);
+ fsleep(12000);
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH net-next 8/8] net: pse-pd: tps23881: Add support for Vdd and Vpwr power supply
2026-12-02 14:08 [PATCH net-next 0/8] net: pse-pd: Preparation series for supporting the TPS23861 controller Kory Maincent
` (6 preceding siblings ...)
2026-12-02 14:08 ` [PATCH net-next 7/8] net: pse-pd: tps23881: Use fsleep instead of mdelay Kory Maincent (AddSecure)
@ 2026-12-02 14:08 ` Kory Maincent (AddSecure)
2026-12-03 14:21 ` netdev-bot+sashiko
7 siblings, 1 reply; 14+ messages in thread
From: Kory Maincent (AddSecure) @ 2026-12-02 14:08 UTC (permalink / raw)
To: Oleksij Rempel, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: roman, maxime.chevallier, Thomas Petazzoni, netdev, linux-kernel,
Phil.Edworthy, devicetree, Kory Maincent (AddSecure)
Add support for the Vdd and the Vpwr power supply, and enable them at
probe time.
Signed-off-by: Kory Maincent (AddSecure) <kory.maincent@bootlin.com>
---
drivers/net/pse-pd/tps23881.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index 5736f052732a2..759b3039ce21c 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -1419,6 +1419,7 @@ static int tps23881_setup_irq(struct tps23881_priv *priv, int irq)
static int tps23881_i2c_probe(struct i2c_client *client)
{
+ static const char * const regulators[] = { "vdd", "vpwr" };
struct device *dev = &client->dev;
const struct tps23881_info *info;
struct tps23881_priv *priv;
@@ -1439,6 +1440,12 @@ static int tps23881_i2c_probe(struct i2c_client *client)
if (!priv)
return -ENOMEM;
+ ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulators),
+ regulators);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to enable regulators\n");
+
reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(reset))
return dev_err_probe(&client->dev, PTR_ERR(reset), "Failed to get reset GPIO\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH net-next 8/8] net: pse-pd: tps23881: Add support for Vdd and Vpwr power supply
2026-12-02 14:08 ` [PATCH net-next 8/8] net: pse-pd: tps23881: Add support for Vdd and Vpwr power supply Kory Maincent (AddSecure)
@ 2026-12-03 14:21 ` netdev-bot+sashiko
0 siblings, 0 replies; 14+ messages in thread
From: netdev-bot+sashiko @ 2026-12-03 14:21 UTC (permalink / raw)
To: kory.maincent
Cc: o.rempel, andrew+netdev, davem, edumazet, kuba, pabeni, robh,
krzk+dt, conor+dt, roman, maxime.chevallier, thomas.petazzoni,
netdev, linux-kernel, Phil.Edworthy, devicetree
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In drivers/net/pse-pd/tps23881.c, tps23881_i2c_probe() now
calls devm_regulator_bulk_get_enable(dev, 2, {"vdd", "vpwr"}) on the…
- [Medium] tps23881_i2c_probe() now powers the TPS2388x itself with
devm_regulator_bulk_get_enable() (line 1443), but the only wait after…
- [Low] In tps23881_i2c_probe() the devm-managed regulator enable (line
1443) is registered before the reset GPIO (devm_gpiod_get_optional at…
--
net: pse-pd: tps23881: Add support for Vdd and Vpwr power supply
This commit adds handling for the Vdd and Vpwr supplies to the TPS23881
PSE controller driver. tps23881_i2c_probe() now gets and enables both
supplies with devm_regulator_bulk_get_enable() before the reset GPIO is
requested.
> diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
> index 5736f052732a2..759b3039ce21c 100644
> --- a/drivers/net/pse-pd/tps23881.c
> +++ b/drivers/net/pse-pd/tps23881.c
> @@ -1419,6 +1419,7 @@ static int tps23881_setup_irq(struct tps23881_priv *priv, int irq)
>
> static int tps23881_i2c_probe(struct i2c_client *client)
> {
> + static const char * const regulators[] = { "vdd", "vpwr" };
> struct device *dev = &client->dev;
> const struct tps23881_info *info;
> struct tps23881_priv *priv;
> @@ -1439,6 +1440,12 @@ static int tps23881_i2c_probe(struct i2c_client *client)
> if (!priv)
> return -ENOMEM;
>
> + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulators),
> + regulators);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "Failed to enable regulators\n");
> +
[Severity: Medium]
On device trees with no controller-level vpwr-supply, which regulator does
the "vpwr" consumer end up with?
If the property is missing on the controller node, of_get_regulator() in
drivers/regulator/of_regulator.c falls back to a recursive search of the
child nodes:
regnode = of_parse_phandle(node, prop_name, 0);
if (regnode)
return regnode;
regnode = of_get_child_regulator(dev->of_node, prop_name);
Before the earlier binding patch in this series, the binding only allowed
vpwr-supply in the pse-pi nodes. The example in ti,tps23881.yaml still has
it only there.
On those DTs, the controller's "vpwr" consumer would silently resolve to
the first PI's supply (vpwr1 in the binding example, found via channels ->
pse-pis -> pse-pi@0). No dummy regulator message would be printed.
That supply then stays enabled for the whole lifetime of the device. Can
the first PI rail still be turned off when the PIs on it are disabled?
The other PI rails (vpwr2) are not held, so the PIs would be treated
differently.
The commit message only says Vdd and Vpwr are enabled at probe time. Is
this binding to a PI supply intended for existing DTs?
[Severity: Medium]
Now that probe can power up the chip itself, is there still a power-on
delay when no reset GPIO is present? The only wait after power-on is
inside the reset block later in tps23881_i2c_probe():
if (reset) {
...
msleep(50);
}
ret = i2c_smbus_read_byte_data(client, TPS23881_REG_DEVID);
reset-gpios is optional in the binding. Without it, if vdd/vpwr were off
before probe, the DEVID read and tps23881_flash_sram_fw() run straight
after the regulators are enabled.
The regulator core only waits for the regulator's own enable/ramp time. It
does not wait for the chip's power-on reset.
The comment in the reset block cites a 20ms minimum after power-on reset
and a 50ms delay before SRAM loading. Without that wait, could the DEVID
read fail or return a bad ID (probe fails with "Wrong device ID")? Could
the SRAM and parity firmware be written while the chip is still in POR,
leaving it on ROM firmware or in safe mode (FWREV 0xFF)?
> reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
[Severity: Low]
What state is the RESET pin in when the supplies are turned off during
teardown?
The regulators are registered with devm before the reset GPIO, so devm
frees them in the reverse order. This happens on unbind and on a probe
failure after this point, for example in tps23881_flash_sram_fw(),
devm_pse_controller_register() or tps23881_setup_irq().
The GPIO descriptor is freed first, and the line stays deasserted. Then
vdd/vpwr are disabled. Nothing asserts reset before power is removed.
If the RESET pin is not fail-safe, could the host drive the unpowered
chip through that pin and back-power it? Before this patch the driver
never removed power, so this state could not happen.
> if (IS_ERR(reset))
> return dev_err_probe(&client->dev, PTR_ERR(reset), "Failed to get reset GPIO\n");
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-feat_tps23861-v1-0-7d8320369817%40bootlin.com
^ permalink raw reply [flat|nested] 14+ messages in thread