[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ab1ad93b-4d39-8863-9704-da779fc4c426@axentia.se>
Date: Thu, 23 Jun 2022 13:21:47 +0200
From: Peter Rosin <peda@...ntia.se>
To: linux-kernel@...r.kernel.org
Cc: MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Michael Auchter <michael.auchter@...com>
Subject: [PATCH] extcon: usbc-tusb320: make sure the state is initialized on
probe
When the port is connected at boot, there is not necessarily
an interrupt flagged in the interrupt status register, causing
the IRQ handler to bail out early without reading the state when
it is invoked directly from probe.
Add a flag that overrides the interrupt status register and reads
the state regardless during probe.
Fixes: 06bc4ca115cd ("extcon: Add driver for TI TUSB320")
Signed-off-by: Peter Rosin <peda@...ntia.se>
---
drivers/extcon/extcon-usbc-tusb320.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
index 6ba3d89b106d..bd3645ae0d52 100644
--- a/drivers/extcon/extcon-usbc-tusb320.c
+++ b/drivers/extcon/extcon-usbc-tusb320.c
@@ -55,6 +55,7 @@ struct tusb320_priv {
struct extcon_dev *edev;
struct tusb320_ops *ops;
enum tusb320_attached_state state;
+ bool initialized;
};
static const char * const tusb_attached_states[] = {
@@ -195,7 +196,7 @@ static irqreturn_t tusb320_irq_handler(int irq, void *dev_id)
return IRQ_NONE;
}
- if (!(reg & TUSB320_REG9_INTERRUPT_STATUS))
+ if (priv->initialized && !(reg & TUSB320_REG9_INTERRUPT_STATUS))
return IRQ_NONE;
state = (reg >> TUSB320_REG9_ATTACHED_STATE_SHIFT) &
@@ -297,6 +298,8 @@ static int tusb320_extcon_probe(struct i2c_client *client,
*/
tusb320_irq_handler(client->irq, priv);
+ priv->initialized = true;
+
ret = devm_request_threaded_irq(priv->dev, client->irq, NULL,
tusb320_irq_handler,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
--
2.20.1
Powered by blists - more mailing lists