diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2026-10-23 13:51:18 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-10-23 13:51:18 -0700 |
| commit | f62e18ccc68e188e2ff9df1588d91c2d5596bb99 (patch) | |
| tree | 45873dcfdcc6ee171ab575568fba53bc1f30a2f7 | |
| parent | 286154ae6998a32cca698abd713e1d4728e81924 (diff) | |
| parent | 110eb808324fd9713b04d874c97283d965e43d2a (diff) | |
Merge branch 'net-pse-pd-si3474-two-driver-fixes'
Piotr Kubik says:
====================
net: pse-pd: si3474: two driver fixes
Two fixes for the Si3474 PSE driver, found while preparing 2-pair and
semi-auto support for it.
Patch 1 stops si3474_pi_enable() from clearing detection and
classification of the other PI in the same quad. Without it, a PD on
that PI gets no power after a later plug-in.
Patch 2 rejects a channel number of 8 and a 4-pair PI whose channels
are not one channel pair of a quad.
Both were tested on an SDG-9000 board (MediaTek MT7988A, two Si3474)
with a Linux 6.18 kernel that carries the same patches, and build-tested
on the net tree.
====================
Link: https://patch.msgid.link/20261019162453.1244120-1-piotr@kubik.pl
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | drivers/net/pse-pd/si3474.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/pse-pd/si3474.c b/drivers/net/pse-pd/si3474.c index efb0af041599..35152d462e82 100644 --- a/drivers/net/pse-pd/si3474.c +++ b/drivers/net/pse-pd/si3474.c @@ -250,9 +250,9 @@ static int si3474_get_of_channels(struct si3474_priv *priv) "Failed to read channel reg property\n"); return ret; } - if (chan_id > SI3474_MAX_CHANS) { + if (chan_id >= SI3474_MAX_CHANS) { dev_err(&priv->client[0]->dev, - "Incorrect channel number: %d\n", chan_id); + "Incorrect channel number: %u\n", chan_id); return -EINVAL; } @@ -267,6 +267,16 @@ static int si3474_get_of_channels(struct si3474_priv *priv) pi->np); return -EINVAL; } + + /* The 2P/4P mode bit pairs channels 0+1 and 2+3 of a quad */ + if (pairset_found && + (priv->pi[pi_no].chan[0] ^ 1) != priv->pi[pi_no].chan[1]) { + dev_err(&priv->client[0]->dev, + "PI %pOF: channels %u and %u are not a channel pair\n", + pi->np, priv->pi[pi_no].chan[0], + priv->pi[pi_no].chan[1]); + return -EINVAL; + } } return 0; @@ -312,8 +322,13 @@ static int si3474_pi_enable(struct pse_controller_dev *pcdev, int id) /* DETECT_CLASS_ENABLE must be set when using AUTO mode, * otherwise PI does not power up - datasheet section 2.10.2 */ - val = CHAN_BIT(chan0) | CHAN_UPPER_BIT(chan0) | - CHAN_BIT(chan1) | CHAN_UPPER_BIT(chan1); + ret = i2c_smbus_read_byte_data(client, DETECT_CLASS_ENABLE_REG); + if (ret < 0) + return ret; + + val = (u8)ret; + val |= CHAN_BIT(chan0) | CHAN_UPPER_BIT(chan0) | + CHAN_BIT(chan1) | CHAN_UPPER_BIT(chan1); ret = i2c_smbus_write_byte_data(client, DETECT_CLASS_ENABLE_REG, val); if (ret) |
