@@ -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>
@@ -337,6 +338,7 @@ static int rt298_mic_detect(struct snd_soc_component *component,
/* If jack in NULL, disable HS jack */
if (!jack) {
+ disable_irq(rt298->i2c->irq);
regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0);
dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_disable_pin(dapm, "LDO1");
@@ -346,6 +348,7 @@ static int rt298_mic_detect(struct snd_soc_component *component,
rt298->jack = jack;
regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
+ enable_irq(rt298->i2c->irq);
rt298_jack_detect(rt298, &hp, &mic);
if (hp)
@@ -1015,6 +1018,9 @@ static int rt298_probe(struct snd_soc_component *component)
INIT_DELAYED_WORK(&rt298->jack_detect_work, rt298_jack_detect_work);
if (rt298->i2c->irq) {
+ /* irq will be enabled in rt298_mic_detect */
+ irq_set_status_flags(rt298->i2c->irq, IRQ_NOAUTOEN);
+
ret = request_threaded_irq(rt298->i2c->irq, NULL, rt298_irq,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt298", rt298);
if (ret) {