Skip to contentSkip to conversation

usb: typec: tipd: drop double register read in tps6598x_interrupt

PATCH In review Peter Korsgaard 3 participants 5 messages Nov 6, 2025 – Nov 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: typec: tipd: drop double register read in tps6598x_interrupt

Commit 409c1cfb5a80 ("usb: typec: tipd: fix event checking for tps6598x") added (by accident?) a double read of the TPS_REG_INT_EVENT1 register. Drop that.

---
 drivers/usb/typec/tipd/core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/usb/typec/tipd/core.c +0 -2
index 2b1049c9a6f3..2d4fcf62c200 100644
@@ -994,8 +994,6 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
 	    TPS_VERSION_HW_VERSION(version) == TPS_VERSION_HW_65987_8_DK)
 		intev_len = TPS_65987_8_INTEVENT_LEN;
 
-	ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
-
 	ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
 	if (ret) {
 		dev_err(tps->dev, "%s: failed to read event1\n", __func__);
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 3 lines · Peter Korsgaard

Commit 409c1cfb5a80 ("usb: typec: tipd: fix event checking for tps6598x") added (by accident?) a double read of the TPS_REG_INT_EVENT1 register. Drop that.

Are you sure? Sometimes 2 reads are required. How was this tested?

thanks,

greg k-h

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Greg" == Greg KH <[email protected]> writes:

Quoted 3 lines · Peter Korsgaard

Commit 409c1cfb5a80 ("usb: typec: tipd: fix event checking for tps6598x") added (by accident?) a double read of the TPS_REG_INT_EVENT1 register. Drop that.

Are you sure? Sometimes 2 reads are required. How was this tested?

Hard to be 100% sure, but the code did not have a double read before the above commit and sticking a printk in the driver like this:

drivers/usb/typec/tipd/core.c +2 -1
index 01db27cbf1d1..6687d192dbd4 100644
@@ -536,8 +536,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
                intev_len = TPS_65987_8_INTEVENT_LEN;
 
        ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
-
+       printk(KERN_ERR "1st: %llx %llx\n", event1[0], event1[1]);
        ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
+       printk(KERN_ERR "2nd: %llx %llx\n", event1[0], event1[1]);
        if (ret) {
                dev_err(tps->dev, "%s: failed to read event1\n", __func__);
                goto err_unlock;

and (un)plugging the USB cable I see:

[ 3267.257341] 1st: 3000008 0
[ 3267.262097] 2nd: 3000008 0
[ 3267.345179] 1st: 1000000 0
[ 3267.350512] 2nd: 1000000 0
[ 3267.388947] 1st: 1000000 0
[ 3267.393707] 2nd: 1000000 0
[ 3267.912112] 1st: 1000000 0
[ 3267.916872] 2nd: 1000000 0
[ 3268.049505] 1st: 1000000 0
[ 3268.054773] 2nd: 1000000 0
[ 3269.105173] 1st: 1000000 0
[ 3269.109970] 2nd: 1000000 0
[ 3280.049111] 1st: 3000008 0
[ 3280.053865] 2nd: 3000008 0

So I am fairly sure it is not needed.

Signature · 1 line
Bye, Peter Korsgaard
maintainer
#3 lore raw
Quoted 46 lines · Peter Korsgaard
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Greg" == Greg KH <[email protected]> writes:

Quoted 3 lines · Peter Korsgaard

Commit 409c1cfb5a80 ("usb: typec: tipd: fix event checking for tps6598x") added (by accident?) a double read of the TPS_REG_INT_EVENT1 register. Drop that.

Are you sure? Sometimes 2 reads are required. How was this tested?

Hard to be 100% sure, but the code did not have a double read before the above commit and sticking a printk in the driver like this:

drivers/usb/typec/tipd/core.c +2 -1
index 01db27cbf1d1..6687d192dbd4 100644
@@ -536,8 +536,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
                intev_len = TPS_65987_8_INTEVENT_LEN;
 
        ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
-
+       printk(KERN_ERR "1st: %llx %llx\n", event1[0], event1[1]);
        ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
+       printk(KERN_ERR "2nd: %llx %llx\n", event1[0], event1[1]);
        if (ret) {
                dev_err(tps->dev, "%s: failed to read event1\n", __func__);
                goto err_unlock;

and (un)plugging the USB cable I see:

[ 3267.257341] 1st: 3000008 0
[ 3267.262097] 2nd: 3000008 0
[ 3267.345179] 1st: 1000000 0
[ 3267.350512] 2nd: 1000000 0
[ 3267.388947] 1st: 1000000 0
[ 3267.393707] 2nd: 1000000 0
[ 3267.912112] 1st: 1000000 0
[ 3267.916872] 2nd: 1000000 0
[ 3268.049505] 1st: 1000000 0
[ 3268.054773] 2nd: 1000000 0
Quoted 7 lines
[ 3269.105173] 1st: 1000000 0
[ 3269.109970] 2nd: 1000000 0
[ 3280.049111] 1st: 3000008 0
[ 3280.053865] 2nd: 3000008 0

So I am fairly sure it is not needed.

Sometimes hardware requires it, even if it is not noticed by the actual read value, so I would like to get an ack from the original author on this before accepting it.

thanks,

greg k-h

maintainer
#4 lore raw

Sat, Nov 08, 2025 at 09:43:14AM +0900, Greg KH kirjoitti:

Quoted 50 lines · Peter Korsgaard
Quoted 49 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Greg" == Greg KH <[email protected]> writes:

Quoted 3 lines · Peter Korsgaard

Commit 409c1cfb5a80 ("usb: typec: tipd: fix event checking for tps6598x") added (by accident?) a double read of the TPS_REG_INT_EVENT1 register. Drop that.

Are you sure? Sometimes 2 reads are required. How was this tested?

Hard to be 100% sure, but the code did not have a double read before the above commit and sticking a printk in the driver like this:

drivers/usb/typec/tipd/core.c +2 -1
index 01db27cbf1d1..6687d192dbd4 100644
@@ -536,8 +536,9 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data)
                intev_len = TPS_65987_8_INTEVENT_LEN;
 
        ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
-
+       printk(KERN_ERR "1st: %llx %llx\n", event1[0], event1[1]);
        ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
+       printk(KERN_ERR "2nd: %llx %llx\n", event1[0], event1[1]);
        if (ret) {
                dev_err(tps->dev, "%s: failed to read event1\n", __func__);
                goto err_unlock;

and (un)plugging the USB cable I see:

[ 3267.257341] 1st: 3000008 0
[ 3267.262097] 2nd: 3000008 0
[ 3267.345179] 1st: 1000000 0
[ 3267.350512] 2nd: 1000000 0
[ 3267.388947] 1st: 1000000 0
[ 3267.393707] 2nd: 1000000 0
[ 3267.912112] 1st: 1000000 0
[ 3267.916872] 2nd: 1000000 0
[ 3268.049505] 1st: 1000000 0
[ 3268.054773] 2nd: 1000000 0
[ 3269.105173] 1st: 1000000 0
[ 3269.109970] 2nd: 1000000 0
Quoted 8 lines
Quoted 4 lines
[ 3280.049111] 1st: 3000008 0
[ 3280.053865] 2nd: 3000008 0

So I am fairly sure it is not needed.

Sometimes hardware requires it, even if it is not noticed by the actual read value, so I would like to get an ack from the original author on this before accepting it.

The hardware should not require it. Javier, can you comment on this? If there really is need to do double read, then there needs to be a comment explaining why IMO.

thanks,

Signature · 1 line
heikki