[PATCH v1] usb: typec: tipd: keep default interrupts enabled during probe()

From: Martin Kepplinger
Date: Mon Jan 10 2022 - 11:36:51 EST


Commit 9990f2f6264c ("usb: typec: tipd: Enable event interrupts by default")
writes a fixed set of interrupts to TPS_REG_INT_MASK1. In case interrupts
had been enabled by the firmware by default, these get disabled now
which can break use cases. Only append to what is already enabled instead.

Fixes: 9990f2f6264c ("usb: typec: tipd: Enable event interrupts by default")
Signed-off-by: Martin Kepplinger <martin.kepplinger@xxxxxxx>
---
drivers/usb/typec/tipd/core.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index 6d27a5b5e3ca..365ee5494c15 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -744,10 +744,14 @@ static int tps6598x_probe(struct i2c_client *client)

irq_handler = cd321x_interrupt;
} else {
+ ret = tps6598x_read64(tps, TPS_REG_INT_MASK1, &mask1);
+ if (ret)
+ return ret;
+
/* Enable power status, data status and plug event interrupts */
- mask1 = TPS_REG_INT_POWER_STATUS_UPDATE |
- TPS_REG_INT_DATA_STATUS_UPDATE |
- TPS_REG_INT_PLUG_EVENT;
+ mask1 |= TPS_REG_INT_POWER_STATUS_UPDATE |
+ TPS_REG_INT_DATA_STATUS_UPDATE |
+ TPS_REG_INT_PLUG_EVENT;
}

/* Make sure the controller has application firmware running */
--
2.30.2