Skip to contentSkip to conversation

Reg: Audio recording with twl4030 codec

DISCUSSION shariff 2 participants 4 messages Jan 22, 2010 – Jan 25, 2010 2 messages not in the archive

lore
Share & tools
lore

shariff

author
#0 lore raw

Hi all,

I am working with OMAP3 based custom board that has twl4030 codec & using linux-2.6.29 kernel from opensource.

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"

--> Here record is successful but with lot of noise.

1) Can we record Mono(1 channel) through I2S from TWL4030 codec?

2) To record stereo(2 channels), do we need two Mic's ? (i.e do I
need Sub Mic also).

Regards,
Shariff

#1 lore raw

Hello,

Quoted 4 lines · 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...

Quoted 16 lines
        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
Quoted 6 lines

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.

Quoted 4 lines

--> 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.

Quoted 3 lines

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.

Quoted 3 lines

Regards,
Shariff

Signature · 1 line
Péter

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hello,

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

Quoted 5 lines · 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

Quoted 3 lines

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.

Quoted 5 lines

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.

Quoted 2 lines

----> 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.

Signature · 1 line
Péter
Quoted 96 lines

Regards,
Shariff

On Fri, Jan 22, 2010 at 6:29 PM, shariff
<[email protected]<mailto:[email protected]>> wrote: Hi Peter,

Thank you very much for your suggestions.

Regards,
Shariff

On Fri, Jan 22, 2010 at 6:11 PM, Peter Ujfalusi
<[email protected]<mailto:[email protected]>> wrote: Hello,

Quoted 4 lines · 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...

Quoted 15 lines
        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
Quoted 6 lines

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.

Quoted 4 lines

--> 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.

Quoted 2 lines

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.

Quoted 2 lines

Regards,
Shariff

--
Péter

author
#5 lore raw

Hi Peter,

Thanks for you suggestions.

Regards,
Shariff

Quoted 156 lines · Peter Ujfalusi

Hello,

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

Quoted 5 lines · 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

Quoted 3 lines

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.

Quoted 4 lines

I have one more question. ( Regarding Audio path)

---> If I want to avoid that one channel silent, do I need to connect

"SUB

Quoted 1 line

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.

Quoted 2 lines

----> 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

Quoted 6 lines

Regards,
Shariff

On Fri, Jan 22, 2010 at 6:29 PM, shariff
<[email protected]<mailto:[email protected]>> wrote: Hi

Peter,

Quoted 9 lines

Thank you very much for your suggestions.

Regards,
Shariff

On Fri, Jan 22, 2010 at 6:11 PM, Peter Ujfalusi
<[email protected]<mailto:[email protected]>> wrote:

Hello,

Quoted 5 lines · On Friday 22 January 2010 11:57:23 ext shariff wrote:
Quoted 3 lines

Hi all,

I am working with OMAP3 based custom board that has twl4030

codec

Quoted 21 lines
Quoted 1 line

& using linux-2.6.29 kernel from opensource.

This is kind of old...

Quoted 17 lines
        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.

Quoted 7 lines
Quoted 4 lines

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

Quoted 9 lines

how the HW has been opened at the end.

Quoted 4 lines

--> 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

Quoted 5 lines

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.

Quoted 1 line

2) To record stereo(2 channels), do we need two Mic's ? (i.e

do

Quoted 6 lines
Quoted 1 line

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,

Quoted 8 lines

if you have not done that yet:

static const struct snd_soc_dapm_widget your_widgets[] = {
...

       SND_SOC_DAPM_MIC("Your Mic", NULL),

...
};

Quoted 8 lines

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

Quoted 12 lines

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.

Quoted 2 lines

Regards,
Shariff

--
Péter