summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs42l42.c
diff options
context:
space:
mode:
authorLucas Tanure <tanureal@opensource.cirrus.com>2021-05-25 12:08:22 +0300
committerMark Brown <broonie@sirena.org.uk>2021-05-25 18:45:05 +0300
commit0e91438ff7045d89b3e82bcef90fadd002eb1c74 (patch)
treedbfc88a489e19397e98a9e1ee7668a651ad1a088 /sound/soc/codecs/cs42l42.c
parent4b38da6ffd6227c930be5c246f6f0f8ef3a80f16 (diff)
downloadlinux-0e91438ff7045d89b3e82bcef90fadd002eb1c74.tar.xz
ASoC: cs42l42: Check jack status before reporting button events
Jack must be connected before reporting button events and if the jack is disconnected button release must be reported Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Message-Id: <20210525090822.64577-4-tanureal@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@sirena.org.uk>
Diffstat (limited to 'sound/soc/codecs/cs42l42.c')
-rw-r--r--sound/soc/codecs/cs42l42.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index 8260de81b56c..eff013f295be 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -1478,6 +1478,10 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
default:
break;
}
+ snd_soc_jack_report(cs42l42->jack, 0,
+ SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+ SND_JACK_BTN_2 | SND_JACK_BTN_3);
+
dev_dbg(component->dev, "Unplug event\n");
}
break;
@@ -1489,7 +1493,7 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)
}
/* Check button detect status */
- if ((~masks[7]) & irq_params_table[7].mask) {
+ if (cs42l42->plug_state == CS42L42_TS_PLUG && ((~masks[7]) & irq_params_table[7].mask)) {
if (!(current_button_status &
CS42L42_M_HSBIAS_HIZ_MASK)) {