Skip to content

Commit 75221e9

Browse files
kmaincentkuba-moo
authored andcommitted
net: pse-pd: tps23881: Fix power on/off issue
An issue was present in the initial driver implementation. The driver read the power status of all channels before toggling the bit of the desired one. Using the power status register as a base value introduced a problem, because only the bit corresponding to the concerned channel ID should be set in the write-only power enable register. This led to cases where disabling power for one channel also powered off other channels. This patch removes the power status read and ensures the value is limited to the bit matching the channel index of the PI. Fixes: 20e6d19 ("net: pse-pd: Add TI TPS23881 PSE controller driver") Signed-off-by: Kory Maincent <[email protected]> Acked-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4a4d38a commit 75221e9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

drivers/net/pse-pd/tps23881.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,11 @@ static int tps23881_pi_enable(struct pse_controller_dev *pcdev, int id)
6464
if (id >= TPS23881_MAX_CHANS)
6565
return -ERANGE;
6666

67-
ret = i2c_smbus_read_word_data(client, TPS23881_REG_PW_STATUS);
68-
if (ret < 0)
69-
return ret;
70-
7167
chan = priv->port[id].chan[0];
7268
if (chan < 4)
73-
val = (u16)(ret | BIT(chan));
69+
val = BIT(chan);
7470
else
75-
val = (u16)(ret | BIT(chan + 4));
71+
val = BIT(chan + 4);
7672

7773
if (priv->port[id].is_4p) {
7874
chan = priv->port[id].chan[1];
@@ -100,15 +96,11 @@ static int tps23881_pi_disable(struct pse_controller_dev *pcdev, int id)
10096
if (id >= TPS23881_MAX_CHANS)
10197
return -ERANGE;
10298

103-
ret = i2c_smbus_read_word_data(client, TPS23881_REG_PW_STATUS);
104-
if (ret < 0)
105-
return ret;
106-
10799
chan = priv->port[id].chan[0];
108100
if (chan < 4)
109-
val = (u16)(ret | BIT(chan + 4));
101+
val = BIT(chan + 4);
110102
else
111-
val = (u16)(ret | BIT(chan + 8));
103+
val = BIT(chan + 8);
112104

113105
if (priv->port[id].is_4p) {
114106
chan = priv->port[id].chan[1];

0 commit comments

Comments
 (0)