All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect
@ 2009-07-02  0:17 Candelaria Villareal, Jorge
  2009-07-02  2:01 ` framework to implement a real time ploter for sound capturing! Guilherme
  2009-07-02  9:34 ` [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect Peter Ujfalusi
  0 siblings, 2 replies; 5+ messages in thread
From: Candelaria Villareal, Jorge @ 2009-07-02  0:17 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org
  Cc: broonie@opensource.wolfsonmicro.com, Peter Ujfalusi

According to TRM, an external FET controlled by a 1.8V output signal
can be used to reduce the pop-noise heard when the audio amplifier is
switched on. It is suggested that GPIO6 of TWL4030 be used, but any
other gpio can be used instead. This is indicated in machine driver
with the following twl4030_setup_data members:

-hs_extmute. Set to 1 if board has support for EXTMUTE.

-set_hs_extmute. Set to a callback funcion to control an external gpio
line. Set to NULL if MUTE[GPIO6] pin is used.

Codec driver takes care of enabling and disabling this output during
the headset pop attenuation sequence.

Also add a delay to let VMID settle in ramp up sequence.

Signed-off-by: Jorge Eduardo Candelaria <x0107209@ti.com>
---
 sound/soc/codecs/twl4030.c |   27 +++++++++++++++++++++++++++
 sound/soc/codecs/twl4030.h |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 06a95f2..4e9e0e1 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -620,6 +620,9 @@ static int handsfreerpga_event(struct snd_soc_dapm_widget *w,
 
 static void headset_ramp(struct snd_soc_codec *codec, int ramp)
 {
+	struct snd_soc_device *socdev = codec->socdev;
+	struct twl4030_setup_data *setup = socdev->codec_data;
+
 	unsigned char hs_gain, hs_pop;
 	struct twl4030_priv *twl4030 = codec->private_data;
 	/* Base values for ramp delay calculation: 2^19 - 2^26 */
@@ -629,6 +632,17 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
 	hs_gain = twl4030_read_reg_cache(codec, TWL4030_REG_HS_GAIN_SET);
 	hs_pop = twl4030_read_reg_cache(codec, TWL4030_REG_HS_POPN_SET);
 
+	/* Enable external mute control, this dramatically reduces
+	 * the pop-noise */
+	if (setup && setup->hs_extmute) {
+		if (setup->set_hs_extmute) {
+			setup->set_hs_extmute(1);
+		} else {
+			hs_pop |= TWL4030_EXTMUTE;
+			twl4030_write(codec, TWL4030_REG_HS_POPN_SET, hs_pop);
+		}
+	}
+
 	if (ramp) {
 		/* Headset ramp-up according to the TRM */
 		hs_pop |= TWL4030_VMID_EN;
@@ -636,6 +650,9 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
 		twl4030_write(codec, TWL4030_REG_HS_GAIN_SET, hs_gain);
 		hs_pop |= TWL4030_RAMP_EN;
 		twl4030_write(codec, TWL4030_REG_HS_POPN_SET, hs_pop);
+		/* Wait ramp delay time + 1, so the VMID can settle */
+		mdelay((ramp_base[(hs_pop & TWL4030_RAMP_DELAY) >> 2] /
+			twl4030->sysclk) + 1);
 	} else {
 		/* Headset ramp-down _not_ according to
 		 * the TRM, but in a way that it is working */
@@ -652,6 +669,16 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
 		hs_pop &= ~TWL4030_VMID_EN;
 		twl4030_write(codec, TWL4030_REG_HS_POPN_SET, hs_pop);
 	}
+
+	/* Disable external mute */
+	if (setup && setup->hs_extmute) {
+		if (setup->set_hs_extmute) {
+			setup->set_hs_extmute(0);
+		} else {
+			hs_pop &= ~TWL4030_EXTMUTE;
+			twl4030_write(codec, TWL4030_REG_HS_POPN_SET, hs_pop);
+		}
+	}
 }
 
 static int headsetlpga_event(struct snd_soc_dapm_widget *w,
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h
index fe5f395..2b4bfa2 100644
--- a/sound/soc/codecs/twl4030.h
+++ b/sound/soc/codecs/twl4030.h
@@ -274,6 +274,8 @@ extern struct snd_soc_codec_device soc_codec_dev_twl4030;
 struct twl4030_setup_data {
 	unsigned int ramp_delay_value;
 	unsigned int sysclk;
+	unsigned int hs_extmute:1;
+	void (*set_hs_extmute)(int mute);
 };
 
 #endif	/* End of __TWL4030_AUDIO_H__ */
-- 
1.6.0.4

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

* framework to implement a real time ploter for sound capturing!
  2009-07-02  0:17 [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect Candelaria Villareal, Jorge
@ 2009-07-02  2:01 ` Guilherme
  2009-07-02  2:29   ` Lee Revell
  2009-07-02  9:34 ` [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect Peter Ujfalusi
  1 sibling, 1 reply; 5+ messages in thread
From: Guilherme @ 2009-07-02  2:01 UTC (permalink / raw)
  To: alsa-devel, alsa-devel

Mates...
Can I get a advice here....
I have already my software capturing sound from a microphone, now I want 
to plot the waves. But I want them running in real time. Like we see in 
a oscilloscope. What is the best or a well recommended technology to 
achieve this? I been looking and I found pgplot but it seen too basic.

Tks all!

Tks!

-------------------

Guilherme Longo
Dept. Eng. da Computação
Unaerp

Linux User - #484927

*Before Asking
http://www.istf.com.br/?page=perguntas

!- I'd rather die on my feet than live on my knees -!

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

* Re: framework to implement a real time ploter for sound capturing!
  2009-07-02  2:01 ` framework to implement a real time ploter for sound capturing! Guilherme
@ 2009-07-02  2:29   ` Lee Revell
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Revell @ 2009-07-02  2:29 UTC (permalink / raw)
  To: Guilherme; +Cc: alsa-devel, alsa-devel

On Wed, Jul 1, 2009 at 10:01 PM, Guilherme<grlongo.ireland@gmail.com> wrote:
> Mates...
> Can I get a advice here....
> I have already my software capturing sound from a microphone, now I want
> to plot the waves. But I want them running in real time. Like we see in
> a oscilloscope. What is the best or a well recommended technology to
> achieve this? I been looking and I found pgplot but it seen too basic.
>

http://freqtweak.sourceforge.net/

Lee

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

* Re: [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect
  2009-07-02  0:17 [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect Candelaria Villareal, Jorge
  2009-07-02  2:01 ` framework to implement a real time ploter for sound capturing! Guilherme
@ 2009-07-02  9:34 ` Peter Ujfalusi
  2009-07-02 10:08   ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2009-07-02  9:34 UTC (permalink / raw)
  To: ext Candelaria Villareal, Jorge
  Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com

On Thursday 02 July 2009 03:17:43 ext Candelaria Villareal, Jorge wrote:
> According to TRM, an external FET controlled by a 1.8V output signal
> can be used to reduce the pop-noise heard when the audio amplifier is
> switched on. It is suggested that GPIO6 of TWL4030 be used, but any
> other gpio can be used instead. This is indicated in machine driver
> with the following twl4030_setup_data members:
>
> -hs_extmute. Set to 1 if board has support for EXTMUTE.
>
> -set_hs_extmute. Set to a callback funcion to control an external gpio
> line. Set to NULL if MUTE[GPIO6] pin is used.
>
> Codec driver takes care of enabling and disabling this output during
> the headset pop attenuation sequence.
>
> Also add a delay to let VMID settle in ramp up sequence.

I can not see any problems with this patch, but unfortunately I can not test 
it since none of my hardware supports the extmute on the headset output...

Thank you!

Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>

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

* Re: [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect
  2009-07-02  9:34 ` [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect Peter Ujfalusi
@ 2009-07-02 10:08   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2009-07-02 10:08 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: alsa-devel@alsa-project.org, ext Candelaria Villareal, Jorge

On Thu, Jul 02, 2009 at 12:34:57PM +0300, Peter Ujfalusi wrote:
> On Thursday 02 July 2009 03:17:43 ext Candelaria Villareal, Jorge wrote:

> > According to TRM, an external FET controlled by a 1.8V output signal
> > can be used to reduce the pop-noise heard when the audio amplifier is
> > switched on. It is suggested that GPIO6 of TWL4030 be used, but any

> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>

Applied, thanks.

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

end of thread, other threads:[~2009-07-02 10:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-02  0:17 [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect Candelaria Villareal, Jorge
2009-07-02  2:01 ` framework to implement a real time ploter for sound capturing! Guilherme
2009-07-02  2:29   ` Lee Revell
2009-07-02  9:34 ` [PATCH] ASoC: TWL4030: Add EXTMUTE to reduce pop-noise effect Peter Ujfalusi
2009-07-02 10:08   ` 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.