@@ -16,6 +16,7 @@
#include <linux/spi/spi.h>
#include <linux/dmi.h>
#include <linux/acpi.h>
+#include <linux/irq.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -324,11 +325,14 @@ static int rt286_mic_detect(struct snd_soc_component *component,
if (rt286->jack->status & SND_JACK_HEADPHONE)
snd_soc_dapm_force_enable_pin(dapm, "LDO1");
regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2);
+ enable_irq(rt286->i2c->irq);
+
/* Send an initial empty report */
snd_soc_jack_report(rt286->jack, rt286->jack->status,
SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
} else {
/* disable IRQ */
+ disable_irq(rt286->i2c->irq);
regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x0);
snd_soc_dapm_disable_pin(dapm, "LDO1");
}
@@ -951,6 +955,9 @@ static int rt286_probe(struct snd_soc_component *component)
INIT_DELAYED_WORK(&rt286->jack_detect_work, rt286_jack_detect_work);
if (rt286->i2c->irq) {
+ /* irq will be enabled in rt286_mic_detect */
+ irq_set_status_flags(rt286->i2c->irq, IRQ_NOAUTOEN);
+
ret = request_threaded_irq(rt286->i2c->irq, NULL, rt286_irq,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286);
if (ret) {