[alsa-devel] Reg: Audio recording with twl4030 codec

Peter Ujfalusi peter.ujfalusi at nokia.com
Mon Jan 25 09:14:40 CET 2010


Hello,

Let's put alsa-devel back to the CC...

On Monday 25 January 2010 09:32:45 ext shariff wrote:
> Hi Peter,
> 
> 1) As we only have one Main MIC when I am recording in stereo mode by
>  specifying "-c 2", one channel is silent and one channel is recorded
>  properly.

As it should. Just as a sidenote, I'm usually using -f dat for the format, which 
gives 48KHz, stereo 16LE

> 
> 2) But still the recorded channel is noisy, how can I reduce the noise of
>  the recorded channel?

Hmm, what kind of noise?
How are you configuring the dai with the snd_soc_dai_set_fmt?
For stereo it should be (if OMAP is slave, TWL is master):
SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM;

For TDM mode (four channel):
SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | SND_SOC_DAIFMT_CBM_CFM;

See omap3beagle.c how it is done.

> 
> I have one more question. ( Regarding Audio path)
> 
> --->  If I want to avoid that one channel silent, do I need to connect "SUB
>  MIC or AUXR"?( as these are connected  right ADC).

If you want audio data there, than yes you need another mic for the right 
channel.

> ----> If I need to record 4 channel audio without any silent channel do I
>  need to connect digital microphones also?

You can duplicate the channel 1 and 3 to channel 2 and 4, meaning that you route 
the ADCL and ADCR to these channels (TX1 and TX2 path are both analog).
You can also hook up a stereo digital mic to the digimic1 interface, but 
remember, that the digimic needs 48KHz sampling rate.

-- 
Péter

> 
> Regards,
> Shariff
> 
> On Fri, Jan 22, 2010 at 6:29 PM, shariff
>  <shariffsinbox at gmail.com<mailto:shariffsinbox at gmail.com>> wrote: Hi Peter,
> 
> Thank you very much for your suggestions.
> 
> Regards,
> Shariff
> 
> 
> On Fri, Jan 22, 2010 at 6:11 PM, Peter Ujfalusi
>  <peter.ujfalusi at nokia.com<mailto:peter.ujfalusi at nokia.com>> wrote: Hello,
> 
> On Friday 22 January 2010 11:57:23 ext shariff wrote:
> > Hi all,
> >
> >         I am working with OMAP3 based custom board that has twl4030 codec
> > & using linux-2.6.29 kernel from opensource.
> 
> This is kind of old...
> 
> >         I have some queries regarding Audio recording.
> >
> >        Audio codec is connected to twl4030 as bellow
> >
> >                                   TWL4030
> >
> >                              |--------------------|
> >                              |
> >                              |                    |------ MAINMIC
> >
> >       McBSP2  ------  |i2s/tdm         |
> >
> >                              | ___________|
> >
> >       --> One Analog MIC is connected to Main Mic and I am using Audio
> > path not the Voice path.
> >
> >            After selecting Main Mic through amixer control.
> >
> >            and recording audio using "arecord -c 1 -r 8000 -f S16_LE -t
> > wav -d 20 record-file.wav"
> 
> The hardware should have been opened in stereo mode, since it is not
>  supporting the mono, you can verify it by appending -v to arecord and see
>  how the HW has been opened at the end.
> 
> >        --> Here record is successful but with lot of noise.
> >
> >           1) Can we record Mono(1 channel) through I2S from TWL4030
> > codec?
> 
> The TWL codec "Audio" path is either stereo or 4 channel.
> You need to record stereo/4 channel, and than extract/use the data from the
> valid channel.
> In case of Main mic it is the left channel, or Channel 1 or/and 2
>  (depending on the routings) in four channel mode.
> 
> >           2) To record stereo(2 channels), do we need two Mic's ? (i.e do
> > I need Sub Mic also).
> 
> No you don't need. The right channel will not contain valid data (most
>  likely it is going to be silent).
> 
> You need to enable the Mic bias 1 for the main mic in your machine driver,
>  if you have not done that yet:
> 
> static const struct snd_soc_dapm_widget your_widgets[] = {
> ...
>        SND_SOC_DAPM_MIC("Your Mic", NULL),
> ...
> };
> 
> static const struct snd_soc_dapm_route your_audio_map[] = {
> ...
>        {"MAINMIC", NULL, "Mic Bias 1"},
>        {"Mic Bias 1", NULL, "Your Mic"},
> ...
> };
> 
> I'm not sure about the state of the twl soc codec driver in 2.6.29, but my
>  guess is that it should work.
> 
> Are there any capture routing option for TX1 path, which selects between
>  Analog and Digimic0? If there is than that has to be set to analog as
>  well.
> 
> > Regards,
> > Shariff
> 
> --
> Péter
> 


More information about the Alsa-devel mailing list