Skip to content

Commit

Permalink
ASoC: max98090: Move interrupt request from codec probe to i2c probe
Browse files Browse the repository at this point in the history
Keep MAX98090 interrupt requested after i2c device probing as long as the
driver is loaded. This fixes the issue where subsequent codec probe
max98090_probe() call fails in interrupt request since interrupt wasn't
freed over codec remove-reprobe cycle.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Jarkko Nikula authored and Mark Brown committed Sep 24, 2014
1 parent b8a3ee8 commit 7a7f0ba
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions sound/soc/codecs/max98090.c
Original file line number Diff line number Diff line change
Expand Up @@ -2159,12 +2159,16 @@ static void max98090_jack_work(struct work_struct *work)

static irqreturn_t max98090_interrupt(int irq, void *data)
{
struct snd_soc_codec *codec = data;
struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
struct max98090_priv *max98090 = data;
struct snd_soc_codec *codec = max98090->codec;
int ret;
unsigned int mask;
unsigned int active;

/* Treat interrupt before codec is initialized as spurious */
if (codec == NULL)
return IRQ_NONE;

dev_dbg(codec->dev, "***** max98090_interrupt *****\n");

ret = regmap_read(max98090->regmap, M98090_REG_INTERRUPT_S, &mask);
Expand Down Expand Up @@ -2367,17 +2371,6 @@ static int max98090_probe(struct snd_soc_codec *codec)
snd_soc_write(codec, M98090_REG_JACK_DETECT,
M98090_JDETEN_MASK | M98090_JDEB_25MS);

/* Register for interrupts */
dev_dbg(codec->dev, "irq = %d\n", max98090->irq);

ret = devm_request_threaded_irq(codec->dev, max98090->irq, NULL,
max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"max98090_interrupt", codec);
if (ret < 0) {
dev_err(codec->dev, "request_irq failed: %d\n",
ret);
}

/*
* Clear any old interrupts.
* An old interrupt ocurring prior to installing the ISR
Expand Down Expand Up @@ -2417,6 +2410,7 @@ static int max98090_remove(struct snd_soc_codec *codec)
cancel_delayed_work_sync(&max98090->pll_det_enable_work);
cancel_work_sync(&max98090->pll_det_disable_work);
cancel_work_sync(&max98090->pll_work);
max98090->codec = NULL;

return 0;
}
Expand Down Expand Up @@ -2478,6 +2472,15 @@ static int max98090_i2c_probe(struct i2c_client *i2c,
goto err_enable;
}

ret = devm_request_threaded_irq(&i2c->dev, max98090->irq, NULL,
max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"max98090_interrupt", max98090);
if (ret < 0) {
dev_err(&i2c->dev, "request_irq failed: %d\n",
ret);
return ret;
}

ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_max98090, max98090_dai,
ARRAY_SIZE(max98090_dai));
Expand Down

0 comments on commit 7a7f0ba

Please sign in to comment.