All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe
@ 2014-09-19 11:48 Jarkko Nikula
  2014-09-19 11:48 ` [PATCH 2/5] ASoC: max98090: Remove structure member irq from private data Jarkko Nikula
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jarkko Nikula @ 2014-09-19 11:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Jarkko Nikula, Liam Girdwood

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>
---
 sound/soc/codecs/max98090.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index f1543653a699..fe77df6a76c2 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -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);
@@ -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
@@ -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;
 }
@@ -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));
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] ASoC: max98090: Remove structure member irq from private data
  2014-09-19 11:48 [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Jarkko Nikula
@ 2014-09-19 11:48 ` Jarkko Nikula
  2014-09-19 11:48 ` [PATCH 3/5] ASoC: max98090: Remove structure member extmic_mux " Jarkko Nikula
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jarkko Nikula @ 2014-09-19 11:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Jarkko Nikula, Liam Girdwood

struct max98090_priv member irq is now used only locally in
max98090_i2c_probe() and can be removed.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 sound/soc/codecs/max98090.c | 3 +--
 sound/soc/codecs/max98090.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index fe77df6a76c2..3e27de1f473b 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2463,7 +2463,6 @@ static int max98090_i2c_probe(struct i2c_client *i2c,
 	max98090->devtype = driver_data;
 	i2c_set_clientdata(i2c, max98090);
 	max98090->pdata = i2c->dev.platform_data;
-	max98090->irq = i2c->irq;
 
 	max98090->regmap = devm_regmap_init_i2c(i2c, &max98090_regmap);
 	if (IS_ERR(max98090->regmap)) {
@@ -2472,7 +2471,7 @@ static int max98090_i2c_probe(struct i2c_client *i2c,
 		goto err_enable;
 	}
 
-	ret = devm_request_threaded_irq(&i2c->dev, max98090->irq, NULL,
+	ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
 		max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 		"max98090_interrupt", max98090);
 	if (ret < 0) {
diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 14427a566f41..a16319512182 100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
@@ -1529,7 +1529,6 @@ struct max98090_priv {
 	unsigned int bclk;
 	unsigned int lrclk;
 	struct max98090_cdata dai[1];
-	int irq;
 	int jack_state;
 	struct delayed_work jack_work;
 	struct delayed_work pll_det_enable_work;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] ASoC: max98090: Remove structure member extmic_mux from private data
  2014-09-19 11:48 [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Jarkko Nikula
  2014-09-19 11:48 ` [PATCH 2/5] ASoC: max98090: Remove structure member irq from private data Jarkko Nikula
@ 2014-09-19 11:48 ` Jarkko Nikula
  2014-09-19 11:48 ` [PATCH 4/5] ASoC: max98090: Remove unused version define Jarkko Nikula
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jarkko Nikula @ 2014-09-19 11:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Jarkko Nikula, Liam Girdwood

There is no other use for extmic_mux than setting it to zero so remove it.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 sound/soc/codecs/max98090.c | 1 -
 sound/soc/codecs/max98090.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 3e27de1f473b..f2a3f30a5d9f 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2333,7 +2333,6 @@ static int max98090_probe(struct snd_soc_codec *codec)
 	max98090->lin_state = 0;
 	max98090->pa1en = 0;
 	max98090->pa2en = 0;
-	max98090->extmic_mux = 0;
 
 	ret = snd_soc_read(codec, M98090_REG_REVISION_ID);
 	if (ret < 0) {
diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index a16319512182..84ca3f4f4403 100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
@@ -1541,7 +1541,6 @@ struct max98090_priv {
 	u8 lin_state;
 	unsigned int pa1en;
 	unsigned int pa2en;
-	unsigned int extmic_mux;
 	unsigned int sidetone;
 	bool master;
 };
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] ASoC: max98090: Remove unused version define
  2014-09-19 11:48 [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Jarkko Nikula
  2014-09-19 11:48 ` [PATCH 2/5] ASoC: max98090: Remove structure member irq from private data Jarkko Nikula
  2014-09-19 11:48 ` [PATCH 3/5] ASoC: max98090: Remove structure member extmic_mux " Jarkko Nikula
@ 2014-09-19 11:48 ` Jarkko Nikula
  2014-09-19 11:48 ` [PATCH 5/5] ASoC: max98090: Remove unused byte access macros Jarkko Nikula
  2014-09-24  8:37 ` [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Jarkko Nikula @ 2014-09-19 11:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Jarkko Nikula, Liam Girdwood

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 sound/soc/codecs/max98090.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 84ca3f4f4403..2613fdbb66d8 100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
@@ -11,11 +11,6 @@
 #ifndef _MAX98090_H
 #define _MAX98090_H
 
-#include <linux/version.h>
-
-/* One can override the Linux version here with an explicit version number */
-#define M98090_LINUX_VERSION LINUX_VERSION_CODE
-
 /*
  * MAX98090 Register Definitions
  */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] ASoC: max98090: Remove unused byte access macros
  2014-09-19 11:48 [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Jarkko Nikula
                   ` (2 preceding siblings ...)
  2014-09-19 11:48 ` [PATCH 4/5] ASoC: max98090: Remove unused version define Jarkko Nikula
@ 2014-09-19 11:48 ` Jarkko Nikula
  2014-09-24  8:37 ` [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Jarkko Nikula @ 2014-09-19 11:48 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Jarkko Nikula, Liam Girdwood

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 sound/soc/codecs/max98090.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 2613fdbb66d8..a5f6bada06da 100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
@@ -1497,9 +1497,6 @@
 #define M98090_REVID_WIDTH		8
 #define M98090_REVID_NUM		(1<<M98090_REVID_WIDTH)
 
-#define M98090_BYTE1(w) ((w >> 8) & 0xff)
-#define M98090_BYTE0(w) (w & 0xff)
-
 /* Silicon revision number */
 #define M98090_REVA			0x40
 #define M98091_REVA			0x50
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe
  2014-09-19 11:48 [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Jarkko Nikula
                   ` (3 preceding siblings ...)
  2014-09-19 11:48 ` [PATCH 5/5] ASoC: max98090: Remove unused byte access macros Jarkko Nikula
@ 2014-09-24  8:37 ` Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-09-24  8:37 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Liam Girdwood


[-- Attachment #1.1: Type: text/plain, Size: 346 bytes --]

On Fri, Sep 19, 2014 at 02:48:17PM +0300, Jarkko Nikula wrote:
> 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.

Applied all, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-24  8:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-19 11:48 [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Jarkko Nikula
2014-09-19 11:48 ` [PATCH 2/5] ASoC: max98090: Remove structure member irq from private data Jarkko Nikula
2014-09-19 11:48 ` [PATCH 3/5] ASoC: max98090: Remove structure member extmic_mux " Jarkko Nikula
2014-09-19 11:48 ` [PATCH 4/5] ASoC: max98090: Remove unused version define Jarkko Nikula
2014-09-19 11:48 ` [PATCH 5/5] ASoC: max98090: Remove unused byte access macros Jarkko Nikula
2014-09-24  8:37 ` [PATCH 1/5] ASoC: max98090: Move interrupt request from codec probe to i2c probe Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.