All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: rt298: enable IRQ for jack detection
@ 2016-02-16  9:12 Bard Liao
  2016-02-16  9:12 ` [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq Bard Liao
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Bard Liao @ 2016-02-16  9:12 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, john.lin, ramesh.babu, Bard Liao,
	senthilnathanx.veppur, flove

There are some registers needed for enabling rt298 IRQ missed on
current driver.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt298.c | 6 ++++++
 sound/soc/codecs/rt298.h | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index 30c6de6..e67ef5f 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -1225,6 +1225,12 @@ static int rt298_i2c_probe(struct i2c_client *i2c,
 	regmap_update_bits(rt298->regmap,
 				RT298_WIND_FILTER_CTRL, 0x0082, 0x0082);
 	regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
+
+	regmap_write(rt298->regmap, RT298_UNSOLICITED_INLINE_CMD, 0x81);
+	regmap_write(rt298->regmap, RT298_UNSOLICITED_HP_OUT, 0x82);
+	regmap_write(rt298->regmap, RT298_UNSOLICITED_MIC1, 0x84);
+	regmap_update_bits(rt298->regmap, RT298_IRQ_FLAG_CTRL, 0x2, 0x2);
+
 	rt298->is_hp_in = -1;
 
 	if (rt298->i2c->irq) {
diff --git a/sound/soc/codecs/rt298.h b/sound/soc/codecs/rt298.h
index 31da162..d66f884 100644
--- a/sound/soc/codecs/rt298.h
+++ b/sound/soc/codecs/rt298.h
@@ -34,6 +34,7 @@
 #define RT298_HP_OUT					0x21
 #define RT298_MIXER_IN1					0x22
 #define RT298_MIXER_IN2					0x23
+#define RT298_INLINE_CMD				0x55
 
 #define RT298_SET_PIN_SFT				6
 #define RT298_SET_PIN_ENABLE				0x40
@@ -124,6 +125,12 @@
 	VERB_CMD(AC_VERB_SET_COEF_INDEX, RT298_VENDOR_REGISTERS, 0)
 #define RT298_PROC_COEF\
 	VERB_CMD(AC_VERB_SET_PROC_COEF, RT298_VENDOR_REGISTERS, 0)
+#define RT298_UNSOLICITED_INLINE_CMD\
+	VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT298_INLINE_CMD, 0)
+#define RT298_UNSOLICITED_HP_OUT\
+	VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT298_HP_OUT, 0)
+#define RT298_UNSOLICITED_MIC1\
+	VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT298_MIC1, 0)
 
 /* Index registers */
 #define RT298_A_BIAS_CTRL1	0x01
@@ -148,6 +155,7 @@
 #define RT298_DEPOP_CTRL2	0x67
 #define RT298_DEPOP_CTRL3	0x68
 #define RT298_DEPOP_CTRL4	0x69
+#define RT298_IRQ_FLAG_CTRL	0x7c
 
 /* SPDIF (0x06) */
 #define RT298_SPDIF_SEL_SFT	0
-- 
1.8.1.1.439.g50a6b54

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

* [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq
  2016-02-16  9:12 [PATCH 1/3] ASoC: rt298: enable IRQ for jack detection Bard Liao
@ 2016-02-16  9:12 ` Bard Liao
  2016-02-17 13:20   ` Mark Brown
  2016-02-16  9:12 ` [PATCH 3/3] ASoC: rt298: Don't enable IRQ in i2c_probe Bard Liao
  2016-02-24  8:43 ` Applied "ASoC: rt298: enable IRQ for jack detection" " Mark Brown
  2 siblings, 1 reply; 8+ messages in thread
From: Bard Liao @ 2016-02-16  9:12 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, john.lin, ramesh.babu, Bard Liao,
	senthilnathanx.veppur, flove

The IRQ pin will go from high to low when the irq bit is clear.
To let the IRQ pin go low as early as possible, move the clear
irq bit function to the beginning of irq handler.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt298.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index e67ef5f..58bc134 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -961,11 +961,11 @@ static irqreturn_t rt298_irq(int irq, void *data)
 	bool mic = false;
 	int ret, status = 0;
 
-	ret = rt298_jack_detect(rt298, &hp, &mic);
-
 	/* Clear IRQ */
 	regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x1, 0x1);
 
+	ret = rt298_jack_detect(rt298, &hp, &mic);
+
 	if (ret == 0) {
 		if (hp == true)
 			status |= SND_JACK_HEADPHONE;
-- 
1.8.1.1.439.g50a6b54

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

* [PATCH 3/3] ASoC: rt298: Don't enable IRQ in i2c_probe
  2016-02-16  9:12 [PATCH 1/3] ASoC: rt298: enable IRQ for jack detection Bard Liao
  2016-02-16  9:12 ` [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq Bard Liao
@ 2016-02-16  9:12 ` Bard Liao
  2016-02-24  8:42   ` Applied "ASoC: rt298: Don't enable IRQ in i2c_probe" to the asoc tree Mark Brown
  2016-02-24  8:43 ` Applied "ASoC: rt298: enable IRQ for jack detection" " Mark Brown
  2 siblings, 1 reply; 8+ messages in thread
From: Bard Liao @ 2016-02-16  9:12 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, john.lin, ramesh.babu, Bard Liao,
	senthilnathanx.veppur, flove

The IRQ function should not be enabled before irq handler is registered.
In fact, it is done in rt298_probe. So remove it from rt298_i2c_probe.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt298.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index 58bc134..10e9e35 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -1224,7 +1224,6 @@ static int rt298_i2c_probe(struct i2c_client *i2c,
 	regmap_write(rt298->regmap, RT298_MISC_CTRL1, 0x0000);
 	regmap_update_bits(rt298->regmap,
 				RT298_WIND_FILTER_CTRL, 0x0082, 0x0082);
-	regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
 
 	regmap_write(rt298->regmap, RT298_UNSOLICITED_INLINE_CMD, 0x81);
 	regmap_write(rt298->regmap, RT298_UNSOLICITED_HP_OUT, 0x82);
-- 
1.8.1.1.439.g50a6b54

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

* Re: [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq
  2016-02-16  9:12 ` [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq Bard Liao
@ 2016-02-17 13:20   ` Mark Brown
  2016-02-24  2:59     ` Bard Liao
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2016-02-17 13:20 UTC (permalink / raw)
  To: Bard Liao
  Cc: oder_chiou, alsa-devel, lars, lgirdwood, ramesh.babu, john.lin,
	senthilnathanx.veppur, flove


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

On Tue, Feb 16, 2016 at 05:12:35PM +0800, Bard Liao wrote:

> The IRQ pin will go from high to low when the irq bit is clear.
> To let the IRQ pin go low as early as possible, move the clear
> irq bit function to the beginning of irq handler.

Why is this a benefit?  We're going to mask the interrupt as long as the
interrupt handler is running anyway.

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

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



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

* Re: [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq
  2016-02-17 13:20   ` Mark Brown
@ 2016-02-24  2:59     ` Bard Liao
  2016-02-24  3:42       ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Bard Liao @ 2016-02-24  2:59 UTC (permalink / raw)
  To: Mark Brown
  Cc: Oder Chiou, alsa-devel, lars, lgirdwood, ramesh.babu, John Lin,
	senthilnathanx.veppur, Flove

> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Wednesday, February 17, 2016 9:20 PM
> To: Bard Liao
> Cc: lgirdwood@gmail.com; alsa-devel@alsa-project.org;
> lars@metafoo.de; Flove; Oder Chiou; John Lin; ramesh.babu@intel.com;
> senthilnathanx.veppur@intel.com
> Subject: Re: [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of
> rt298_irq
> 
> On Tue, Feb 16, 2016 at 05:12:35PM +0800, Bard Liao wrote:
> 
> > The IRQ pin will go from high to low when the irq bit is clear.
> > To let the IRQ pin go low as early as possible, move the clear irq bit
> > function to the beginning of irq handler.
> 
> Why is this a benefit?  We're going to mask the interrupt as long as the
> interrupt handler is running anyway.

Thanks for your reminding. There is actually no benefit on the patch.
Can you ignore this patch and apply other two patches?
Or I should send the patches again?

> 
> ------Please consider the environment before printing this e-mail.

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

* Re: [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq
  2016-02-24  2:59     ` Bard Liao
@ 2016-02-24  3:42       ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2016-02-24  3:42 UTC (permalink / raw)
  To: Bard Liao
  Cc: Oder Chiou, alsa-devel, lars, lgirdwood, ramesh.babu, John Lin,
	senthilnathanx.veppur, Flove


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

On Wed, Feb 24, 2016 at 02:59:23AM +0000, Bard Liao wrote:

> > Why is this a benefit?  We're going to mask the interrupt as long as the
> > interrupt handler is running anyway.

> Thanks for your reminding. There is actually no benefit on the patch.
> Can you ignore this patch and apply other two patches?
> Or I should send the patches again?

I don't seem to have this series any more, please resend anything that
wasn't applied.

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

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



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

* Applied "ASoC: rt298: Don't enable IRQ in i2c_probe" to the asoc tree
  2016-02-16  9:12 ` [PATCH 3/3] ASoC: rt298: Don't enable IRQ in i2c_probe Bard Liao
@ 2016-02-24  8:42   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2016-02-24  8:42 UTC (permalink / raw)
  To: Bard Liao, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rt298: Don't enable IRQ in i2c_probe

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 0ce58cd6ce5e706c70c7b038ef5ddde0cc7d7385 Mon Sep 17 00:00:00 2001
From: Bard Liao <bardliao@realtek.com>
Date: Wed, 24 Feb 2016 15:51:27 +0800
Subject: [PATCH] ASoC: rt298: Don't enable IRQ in i2c_probe

The IRQ function should not be enabled before irq handler is registered.
In fact, it is done in rt298_probe. So remove it from rt298_i2c_probe.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/rt298.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index e67ef5f8d4f3..f0e6c06e89ac 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -1224,7 +1224,6 @@ static int rt298_i2c_probe(struct i2c_client *i2c,
 	regmap_write(rt298->regmap, RT298_MISC_CTRL1, 0x0000);
 	regmap_update_bits(rt298->regmap,
 				RT298_WIND_FILTER_CTRL, 0x0082, 0x0082);
-	regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
 
 	regmap_write(rt298->regmap, RT298_UNSOLICITED_INLINE_CMD, 0x81);
 	regmap_write(rt298->regmap, RT298_UNSOLICITED_HP_OUT, 0x82);
-- 
2.7.0

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

* Applied "ASoC: rt298: enable IRQ for jack detection" to the asoc tree
  2016-02-16  9:12 [PATCH 1/3] ASoC: rt298: enable IRQ for jack detection Bard Liao
  2016-02-16  9:12 ` [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq Bard Liao
  2016-02-16  9:12 ` [PATCH 3/3] ASoC: rt298: Don't enable IRQ in i2c_probe Bard Liao
@ 2016-02-24  8:43 ` Mark Brown
  2 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2016-02-24  8:43 UTC (permalink / raw)
  To: Bard Liao, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: rt298: enable IRQ for jack detection

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4b2fe3822ae16436ed0aba379c500558f7846ce1 Mon Sep 17 00:00:00 2001
From: Bard Liao <bardliao@realtek.com>
Date: Wed, 24 Feb 2016 15:51:26 +0800
Subject: [PATCH] ASoC: rt298: enable IRQ for jack detection

There are some registers needed for enabling rt298 IRQ missed on
current driver.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/rt298.c | 6 ++++++
 sound/soc/codecs/rt298.h | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index 30c6de62ae6c..e67ef5f8d4f3 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -1225,6 +1225,12 @@ static int rt298_i2c_probe(struct i2c_client *i2c,
 	regmap_update_bits(rt298->regmap,
 				RT298_WIND_FILTER_CTRL, 0x0082, 0x0082);
 	regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
+
+	regmap_write(rt298->regmap, RT298_UNSOLICITED_INLINE_CMD, 0x81);
+	regmap_write(rt298->regmap, RT298_UNSOLICITED_HP_OUT, 0x82);
+	regmap_write(rt298->regmap, RT298_UNSOLICITED_MIC1, 0x84);
+	regmap_update_bits(rt298->regmap, RT298_IRQ_FLAG_CTRL, 0x2, 0x2);
+
 	rt298->is_hp_in = -1;
 
 	if (rt298->i2c->irq) {
diff --git a/sound/soc/codecs/rt298.h b/sound/soc/codecs/rt298.h
index 31da16265f2b..d66f8847b676 100644
--- a/sound/soc/codecs/rt298.h
+++ b/sound/soc/codecs/rt298.h
@@ -34,6 +34,7 @@
 #define RT298_HP_OUT					0x21
 #define RT298_MIXER_IN1					0x22
 #define RT298_MIXER_IN2					0x23
+#define RT298_INLINE_CMD				0x55
 
 #define RT298_SET_PIN_SFT				6
 #define RT298_SET_PIN_ENABLE				0x40
@@ -124,6 +125,12 @@
 	VERB_CMD(AC_VERB_SET_COEF_INDEX, RT298_VENDOR_REGISTERS, 0)
 #define RT298_PROC_COEF\
 	VERB_CMD(AC_VERB_SET_PROC_COEF, RT298_VENDOR_REGISTERS, 0)
+#define RT298_UNSOLICITED_INLINE_CMD\
+	VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT298_INLINE_CMD, 0)
+#define RT298_UNSOLICITED_HP_OUT\
+	VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT298_HP_OUT, 0)
+#define RT298_UNSOLICITED_MIC1\
+	VERB_CMD(AC_VERB_SET_UNSOLICITED_ENABLE, RT298_MIC1, 0)
 
 /* Index registers */
 #define RT298_A_BIAS_CTRL1	0x01
@@ -148,6 +155,7 @@
 #define RT298_DEPOP_CTRL2	0x67
 #define RT298_DEPOP_CTRL3	0x68
 #define RT298_DEPOP_CTRL4	0x69
+#define RT298_IRQ_FLAG_CTRL	0x7c
 
 /* SPDIF (0x06) */
 #define RT298_SPDIF_SEL_SFT	0
-- 
2.7.0

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

end of thread, other threads:[~2016-02-24  8:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16  9:12 [PATCH 1/3] ASoC: rt298: enable IRQ for jack detection Bard Liao
2016-02-16  9:12 ` [PATCH 2/3] ASoC: rt298: clear IRQ at the beginning of rt298_irq Bard Liao
2016-02-17 13:20   ` Mark Brown
2016-02-24  2:59     ` Bard Liao
2016-02-24  3:42       ` Mark Brown
2016-02-16  9:12 ` [PATCH 3/3] ASoC: rt298: Don't enable IRQ in i2c_probe Bard Liao
2016-02-24  8:42   ` Applied "ASoC: rt298: Don't enable IRQ in i2c_probe" to the asoc tree Mark Brown
2016-02-24  8:43 ` Applied "ASoC: rt298: enable IRQ for jack detection" " 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.