From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Input: st-keyscan - disable interrupt while clock is gated
Date: Sat, 29 Aug 2026 04:12:18 -0700 [thread overview]
Message-ID: <apK-PZ5c97mCxBSC@google.com> (raw)
The driver gates off its peripheral clock when the input device is not
open and during system suspend without wakeup. However, the interrupt is
requested without IRQF_NO_AUTOEN and remains unmasked when the device is
stopped. If a pending or spurious interrupt fires while the clock is
disabled, keyscan_isr() will attempt to read the matrix state register
with the clock gated off, triggering a bus fault (synchronous external
abort) and panicking the system.
Request the interrupt with IRQF_NO_AUTOEN, enable it in keyscan_start(),
and disable it in keyscan_stop() prior to gating the clock. Drop the
pointless clock enable/stop sequence in keyscan_probe(), leaving the
clock gated and hardware untouched until the device is opened.
Fixes: 062589b13991 ("Input: add st-keyscan driver")
Reported-by: sashiko-bot@kernel.org
Assisted-by: LLM
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/st-keyscan.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
index ebeda020ffe1..6101bf53379a 100644
--- a/drivers/input/keyboard/st-keyscan.c
+++ b/drivers/input/keyboard/st-keyscan.c
@@ -75,6 +75,8 @@ static int keyscan_start(struct st_keyscan *keypad)
writel(KEYSCAN_CONFIG_ENABLE, keypad->base + KEYSCAN_CONFIG_OFF);
+ enable_irq(keypad->irq);
+
return 0;
}
@@ -82,6 +84,8 @@ static void keyscan_stop(struct st_keyscan *keypad)
{
writel(0, keypad->base + KEYSCAN_CONFIG_OFF);
+ disable_irq(keypad->irq);
+
clk_disable(keypad->clk);
}
@@ -177,20 +181,12 @@ static int keyscan_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, PTR_ERR(keypad_data->clk),
"cannot get clock\n");
- error = clk_enable(keypad_data->clk);
- if (error) {
- dev_err(&pdev->dev, "failed to enable clock\n");
- return error;
- }
-
- keyscan_stop(keypad_data);
-
keypad_data->irq = platform_get_irq(pdev, 0);
if (keypad_data->irq < 0)
return keypad_data->irq;
- error = devm_request_irq(&pdev->dev, keypad_data->irq, keyscan_isr, 0,
- pdev->name, keypad_data);
+ error = devm_request_irq(&pdev->dev, keypad_data->irq, keyscan_isr,
+ IRQF_NO_AUTOEN, pdev->name, keypad_data);
if (error)
return error;
--
2.55.0.897.gb25b4bd76c-goog
--
Dmitry
next reply other threads:[~2026-08-29 11:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 11:12 Dmitry Torokhov [this message]
2026-08-29 11:27 ` [PATCH] Input: st-keyscan - disable interrupt while clock is gated sashiko-bot
2026-08-29 13:05 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=apK-PZ5c97mCxBSC@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.