[alsa-devel] ASoC/DAPM: How to make the DAPM routing complete?
I am using a slightly modified version of the 88pm860x-codec.c driver from 3.x in an android modified 2.6.35 kernel.
I have had to make some changes to allow both capture and playback work on the same (I2S) interface, but so far things are working.
I am however having some problems getting the DAPM framework to set the correct switches needed to get the complete route to actually start.
What would be needed to get this working as it should? I can post or send the driver on request, but basically the same question rises for the current driver in the 3.x kernel.
I want/need to go from HS1/HS2 to DIN for playback, and from MIC1 to DOUT for capture. In order to do that, I have to set the following switches:
amixer -q sset 'DAC HS1 Mux' 'Right' amixer -q sset 'DAC HS2 Mux' 'Left' amixer -q sset 'I2S Mic Mux' 'ADC' amixer -q sset 'ADC Left Mux' 'ADCL'
I would like to make this automatic, but I am unsure how to express this in my dapm routing table.
Note that in order to be able to use playback and capture independently on the I2S interface (within reason, it is not possible to use a different rate for instance), I had to add a SUPPLY control to the dapm widgets that turns on the I2S clock when needed.
Any help, hints or pointers to the right manual to read would be appreciated.
Bas Vermeulen
On Fri, Sep 16, 2011 at 04:07:13PM +0200, Bas Vermeulen wrote:
I want/need to go from HS1/HS2 to DIN for playback, and from MIC1 to DOUT for capture. In order to do that, I have to set the following switches:
amixer -q sset 'DAC HS1 Mux' 'Right' amixer -q sset 'DAC HS2 Mux' 'Left' amixer -q sset 'I2S Mic Mux' 'ADC' amixer -q sset 'ADC Left Mux' 'ADCL'
I would like to make this automatic, but I am unsure how to express this in my dapm routing table.
You shouldn't do this in kernel, decisions like this should be deferred to userspace. Most distributions have init scripts which can apply settings or you can use the use case management code in alsa-lib from your app. Not putting this in kernel gives more runtime flexibility which is especially useful when you get things like reference boards which can run multiple distributions that may not always agree about the best setup.
Note that in order to be able to use playback and capture independently on the I2S interface (within reason, it is not possible to use a different rate for instance), I had to add a SUPPLY control to the dapm widgets that turns on the I2S clock when needed.
Can you send a patch for this please?
On 09/17/2011 03:32 PM, Mark Brown wrote:
On Fri, Sep 16, 2011 at 04:07:13PM +0200, Bas Vermeulen wrote:
Note that in order to be able to use playback and capture independently on the I2S interface (within reason, it is not possible to use a different rate for instance), I had to add a SUPPLY control to the dapm widgets that turns on the I2S clock when needed.
Can you send a patch for this please?
Attached is a patch to turn the I2S clock on for both of I2S capture and playback instead of just playback.
Regards,
Bas Vermeulen
On Mon, Sep 19, 2011 at 01:35:57PM +0200, Bas Vermeulen wrote:
Attached is a patch to turn the I2S clock on for both of I2S capture and playback instead of just playback.
Please follow the process in SubmittingPatches - CC maintainers (I've added Liam), don't send as attachments and use subject lines which match up with the standard for the subsystem.
From a02c4f024daeae6f0708467bc1adbe20bc7458bb Mon Sep 17 00:00:00 2001 From: Bas Vermeulen bas.vermeulen@novero.com Date: Mon, 19 Sep 2011 12:57:09 +0200 Subject: [PATCH 1/2] [ASoC] 88pm860x-codec - Allow independent use of both I2S playback and capture
Introduce a I2S CLK supply so playback and capture can operate independently.
Signed-off-by: Bas Vermeulen bas.vermeulen@novero.com
sound/soc/codecs/88pm860x-codec.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 1924157..0198dbb 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -772,11 +772,12 @@ static const struct snd_soc_dapm_widget pm860x_dapm_widgets[] = {
SND_SOC_DAPM_AIF_IN("I2S DIN", "I2S Playback", 0,
PM860X_DAC_EN_2, 0, 0),
SND_SOC_DAPM_AIF_IN("I2S DIN1", "I2S Playback", 0,SND_SOC_NOPM, 0, 0),
PM860X_DAC_EN_2, 0, 0),
SND_SOC_DAPM_AIF_OUT("I2S DOUT", "I2S Capture", 0, PM860X_I2S_IFACE_3, 5, 1),SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_SUPPLY("I2S CLK", PM860X_DAC_EN_2, 0, 0, NULL, 0), SND_SOC_DAPM_MUX("I2S Mic Mux", SND_SOC_NOPM, 0, 0, &i2s_mic_mux), SND_SOC_DAPM_MUX("ADC Left Mux", SND_SOC_NOPM, 0, 0, &adcl_mux), SND_SOC_DAPM_MUX("ADC Right Mux", SND_SOC_NOPM, 0, 0, &adcr_mux),
@@ -868,6 +869,11 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Left ADC", NULL, "Left ADC MOD"}, {"Right ADC", NULL, "Right ADC MOD"},
- /* I2S Clock */
- {"I2S DIN", NULL, "I2S CLK"},
- {"I2S DIN1", NULL, "I2S CLK"},
- {"I2S DOUT", NULL, "I2S CLK"},
- /* PCM/AIF1 Inputs */ {"PCM SDO", NULL, "ADC Left Mux"}, {"PCM SDO", NULL, "ADCR EC Mux"},
-- 1.7.0.4
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Mon, Sep 19, 2011 at 01:35:57PM +0200, Bas Vermeulen wrote:
Attached is a patch to turn the I2S clock on for both of I2S capture and playback instead of just playback.
Since Liam is now travelling I've applied this and your other patch, thanks.
On 09/17/2011 03:32 PM, Mark Brown wrote:
Note that in order to be able to use playback and capture independently on the I2S interface (within reason, it is not possible to use a different rate for instance), I had to add a SUPPLY control to the dapm widgets that turns on the I2S clock when needed.
Can you send a patch for this please?
This patch implements the audio power-up delay errata for the 88PM8607, meaning the codec will actually be reset.
Regards,
Bas Vermeulen
On Mon, Sep 19, 2011 at 01:38:11PM +0200, Bas Vermeulen wrote:
This patch implements the audio power-up delay errata for the 88PM8607, meaning the codec will actually be reset.
Adding Liam to this one too.
From 55d78799fc7e492f582bc7feb4cb3251e8ef895d Mon Sep 17 00:00:00 2001 From: Bas Vermeulen bas.vermeulen@novero.com Date: Mon, 19 Sep 2011 13:09:10 +0200 Subject: [PATCH 2/2] [ASoC] 88pm860x-codec - reset the codec correctly
Reset the codec according to the Audio power-up delay errata for the 88PM8607.
Signed-off-by: Bas Vermeulen bas.vermeulen@novero.com
sound/soc/codecs/88pm860x-codec.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 0198dbb..df7b4a0 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -1179,6 +1179,9 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_STANDBY: if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { /* Enable Audio PLL & Audio section */
data = AUDIO_PLL | AUDIO_SECTION_ON;
pm860x_reg_write(codec->control_data, REG_MISC2, data);
udelay(300); data = AUDIO_PLL | AUDIO_SECTION_RESET | AUDIO_SECTION_ON; pm860x_reg_write(codec->control_data, REG_MISC2, data);
-- 1.7.0.4
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (2)
-
Bas Vermeulen
-
Mark Brown