|
Takashi Iwai |
c3f7d6 |
From ea75deef1a738d25502cfbb2caa564270b271525 Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
c3f7d6 |
From: Richard Fitzgerald <rf@opensource.cirrus.com>
|
|
Takashi Iwai |
c3f7d6 |
Date: Mon, 15 Aug 2022 13:31:38 +0100
|
|
Takashi Iwai |
c3f7d6 |
Subject: [PATCH] ASoC: cs42l42: Only report button state if there was a button interrupt
|
|
Takashi Iwai |
c3f7d6 |
Git-commit: ea75deef1a738d25502cfbb2caa564270b271525
|
|
Takashi Iwai |
c3f7d6 |
Patch-mainline: v6.0-rc5
|
|
Takashi Iwai |
c3f7d6 |
References: git-fixes
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
Only report a button state change if the interrupt status shows that
|
|
Takashi Iwai |
c3f7d6 |
there was a button event.
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
Previously the code would always drop into the button reporting at the
|
|
Takashi Iwai |
c3f7d6 |
end of interrupt handling if the jack was present. If neither of the
|
|
Takashi Iwai |
c3f7d6 |
button report interrupts were pending it would report all buttons
|
|
Takashi Iwai |
c3f7d6 |
released. This could then lead to a button being reported as released
|
|
Takashi Iwai |
c3f7d6 |
while it is still pressed.
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
Fixes: c5b8ee0879bc ("ASoC: cs42l42: Report jack and button detection")
|
|
Takashi Iwai |
c3f7d6 |
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
|
|
Takashi Iwai |
c3f7d6 |
Link: https://lore.kernel.org/r/20220815123138.3810249-1-rf@opensource.cirrus.com
|
|
Takashi Iwai |
c3f7d6 |
Signed-off-by: Mark Brown <broonie@kernel.org>
|
|
Takashi Iwai |
c3f7d6 |
Acked-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
---
|
|
Takashi Iwai |
c3f7d6 |
sound/soc/codecs/cs42l42.c | 13 +++++++------
|
|
Takashi Iwai |
c3f7d6 |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
|
|
Takashi Iwai |
c3f7d6 |
index d545a593a251..daafd4251ce6 100644
|
|
Takashi Iwai |
c3f7d6 |
--- a/sound/soc/codecs/cs42l42.c
|
|
Takashi Iwai |
c3f7d6 |
+++ b/sound/soc/codecs/cs42l42.c
|
|
Takashi Iwai |
c3f7d6 |
@@ -1617,7 +1617,6 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
|
|
Takashi Iwai |
c3f7d6 |
unsigned int current_plug_status;
|
|
Takashi Iwai |
c3f7d6 |
unsigned int current_button_status;
|
|
Takashi Iwai |
c3f7d6 |
unsigned int i;
|
|
Takashi Iwai |
c3f7d6 |
- int report = 0;
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
mutex_lock(&cs42l42->irq_lock);
|
|
Takashi Iwai |
c3f7d6 |
if (cs42l42->suspended) {
|
|
Takashi Iwai |
c3f7d6 |
@@ -1711,13 +1710,15 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
if (current_button_status & CS42L42_M_DETECT_TF_MASK) {
|
|
Takashi Iwai |
c3f7d6 |
dev_dbg(cs42l42->dev, "Button released\n");
|
|
Takashi Iwai |
c3f7d6 |
- report = 0;
|
|
Takashi Iwai |
c3f7d6 |
+ snd_soc_jack_report(cs42l42->jack, 0,
|
|
Takashi Iwai |
c3f7d6 |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
|
|
Takashi Iwai |
c3f7d6 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
|
|
Takashi Iwai |
c3f7d6 |
} else if (current_button_status & CS42L42_M_DETECT_FT_MASK) {
|
|
Takashi Iwai |
c3f7d6 |
- report = cs42l42_handle_button_press(cs42l42);
|
|
Takashi Iwai |
c3f7d6 |
-
|
|
Takashi Iwai |
c3f7d6 |
+ snd_soc_jack_report(cs42l42->jack,
|
|
Takashi Iwai |
c3f7d6 |
+ cs42l42_handle_button_press(cs42l42),
|
|
Takashi Iwai |
c3f7d6 |
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
|
|
Takashi Iwai |
c3f7d6 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
|
|
Takashi Iwai |
c3f7d6 |
}
|
|
Takashi Iwai |
c3f7d6 |
- snd_soc_jack_report(cs42l42->jack, report, SND_JACK_BTN_0 | SND_JACK_BTN_1 |
|
|
Takashi Iwai |
c3f7d6 |
- SND_JACK_BTN_2 | SND_JACK_BTN_3);
|
|
Takashi Iwai |
c3f7d6 |
}
|
|
Takashi Iwai |
c3f7d6 |
}
|
|
Takashi Iwai |
c3f7d6 |
|
|
Takashi Iwai |
c3f7d6 |
--
|
|
Takashi Iwai |
c3f7d6 |
2.35.3
|
|
Takashi Iwai |
c3f7d6 |
|