[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200508055656.96389-34-jiada_wang@mentor.com>
Date: Thu, 7 May 2020 22:56:33 -0700
From: Jiada Wang <jiada_wang@...tor.com>
To: <nick@...anahar.org>, <dmitry.torokhov@...il.com>,
<jikos@...nel.org>, <benjamin.tissoires@...hat.com>,
<bsz@...ihalf.com>
CC: <linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<erosca@...adit-jv.com>, <Andrew_Gabbasov@...tor.com>,
<jiada_wang@...tor.com>
Subject: [PATCH v11 33/56] Input: atmel_mxt_ts - delay enabling IRQ when not using regulators
The path of enabling the IRQ in the probe function is not safe in level
triggered operation, if it was already powered up and there is a message
waiting on the device (eg finger down) because the object table has not yet
been read. This forces the ISR into a hard loop.
Delay enabling the interrupt until it is first needed, by set flag
IRQ_NOAUTOEN.
Signed-off-by: Jiada Wang <jiada_wang@...tor.com>
CC: Dmitry Osipenko <digetx@...il.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 7c9a738e633a..ab4eceac8fe7 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -3822,6 +3822,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
return error;
}
+ irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
error = devm_request_threaded_irq(&client->dev, client->irq,
NULL, mxt_interrupt, IRQF_ONESHOT,
client->name, data);
@@ -3831,17 +3832,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
}
if (data->suspend_mode == MXT_SUSPEND_REGULATOR) {
+ enable_irq(data->irq);
+
error = mxt_probe_regulators(data);
if (error)
return error;
+
+ disable_irq(data->irq);
} else if (data->reset_gpio) {
msleep(MXT_RESET_GPIO_TIME);
gpiod_set_value(data->reset_gpio, 1);
msleep(MXT_RESET_INVALID_CHG);
}
- disable_irq(data->irq);
-
error = mxt_initialize(data);
if (error)
return error;
--
2.17.1
Powered by blists - more mailing lists