Skip to contentSkip to conversation

mfld machine and codec fixes

PATCH In review Koul, Vinod 4 participants 10 messages Feb 15, 2011 – Feb 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover mfld machine and codec fixes

From: Vinod Koul <[email protected]>

Hi,

This 5 patch series introduces some minor fixes in the TI sn95031 codec driver and the mfld_machine driver and sst_platfrom driver.
This also changes mfld_machine to use the soc_register_card() API.

Vinod Koul (5):
ASoC: sn95031: make playback rails depend on actual pins they control
ASoC: sn95031: fix the DMIC path routing
ASoC: sn95031: fix the amic tlv scale
ASoC: sst_platform: fix the pulseaudio error
ASoC: mfld_machine: make use of soc_register_card API

 sound/soc/codecs/sn95031.c       |   58 +++++++++++++++++++-------------------
 sound/soc/mid-x86/mfld_machine.c |   20 ++++---------
 sound/soc/mid-x86/sst_platform.c |    9 ++++++
 3 files changed, 44 insertions(+), 43 deletions(-)
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/5 ASoC: sn95031: make playback rails depend on actual pins they control

From: Vinod Koul <[email protected]>

This patch makes the codec playback rails (headset and speaker) depend on actual pins they control. This enables better power management of the codec

---
 sound/soc/codecs/sn95031.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/sn95031.c +4 -4
index d0b7802..9c3db0d 100644
@@ -519,6 +519,8 @@ static const struct snd_soc_dapm_widget sn95031_dapm_widgets[] = {
 
 static const struct snd_soc_dapm_route sn95031_audio_map[] = {
 	/* headset and earpiece map */
+	{ "HPOUTL", NULL, "Headset Rail"},
+	{ "HPOUTR", NULL, "Headset Rail"},
 	{ "HPOUTL", NULL, "Headset Left Playback" },
 	{ "HPOUTR", NULL, "Headset Right Playback" },
 	{ "EPOUT", NULL, "Earpiece Playback" },
@@ -527,18 +529,16 @@ static const struct snd_soc_dapm_route sn95031_audio_map[] = {
 	{ "Earpiece Playback", NULL, "Headset Left Filter"},
 	{ "Headset Left Filter", NULL, "HSDAC Left"},
 	{ "Headset Right Filter", NULL, "HSDAC Right"},
-	{ "HSDAC Left", NULL, "Headset Rail"},
-	{ "HSDAC Right", NULL, "Headset Rail"},
 
 	/* speaker map */
+	{ "IHFOUTL", NULL, "Speaker Rail"},
+	{ "IHFOUTR", NULL, "Speaker Rail"},
 	{ "IHFOUTL", "NULL", "Speaker Left Playback"},
 	{ "IHFOUTR", "NULL", "Speaker Right Playback"},
 	{ "Speaker Left Playback", NULL, "Speaker Left Filter"},
 	{ "Speaker Right Playback", NULL, "Speaker Right Filter"},
 	{ "Speaker Left Filter", NULL, "IHFDAC Left"},
 	{ "Speaker Right Filter", NULL, "IHFDAC Right"},
-	{ "IHFDAC Left", NULL, "Speaker Rail"},
-	{ "IHFDAC Right", NULL, "Speaker Rail"},
 
 	/* vibra map */
 	{ "VIB1OUT", NULL, "Vibra1 Playback"},
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/5 ASoC: sn95031: fix the DMIC path routing

In reply to Koul, Vinod

From: Vinod Koul <[email protected]>

This patch makes the DMIC dynamically connect to TX Mux, earlier code had erroneously made this as static path

---
 sound/soc/codecs/sn95031.c |   48 ++++++++++++++++++++++----------------------
 1 files changed, 24 insertions(+), 24 deletions(-)
sound/soc/codecs/sn95031.c +24 -24
index 9c3db0d..5eb39c7 100644
@@ -602,30 +602,30 @@ static const struct snd_soc_dapm_route sn95031_audio_map[] = {
 	{ "Txpath2 Capture Route", "ADC Right", "ADC Right"},
 	{ "Txpath3 Capture Route", "ADC Right", "ADC Right"},
 	{ "Txpath4 Capture Route", "ADC Right", "ADC Right"},
-	{ "Txpath1 Capture Route", NULL, "DMIC1"},
-	{ "Txpath2 Capture Route", NULL, "DMIC1"},
-	{ "Txpath3 Capture Route", NULL, "DMIC1"},
-	{ "Txpath4 Capture Route", NULL, "DMIC1"},
-	{ "Txpath1 Capture Route", NULL, "DMIC2"},
-	{ "Txpath2 Capture Route", NULL, "DMIC2"},
-	{ "Txpath3 Capture Route", NULL, "DMIC2"},
-	{ "Txpath4 Capture Route", NULL, "DMIC2"},
-	{ "Txpath1 Capture Route", NULL, "DMIC3"},
-	{ "Txpath2 Capture Route", NULL, "DMIC3"},
-	{ "Txpath3 Capture Route", NULL, "DMIC3"},
-	{ "Txpath4 Capture Route", NULL, "DMIC3"},
-	{ "Txpath1 Capture Route", NULL, "DMIC4"},
-	{ "Txpath2 Capture Route", NULL, "DMIC4"},
-	{ "Txpath3 Capture Route", NULL, "DMIC4"},
-	{ "Txpath4 Capture Route", NULL, "DMIC4"},
-	{ "Txpath1 Capture Route", NULL, "DMIC5"},
-	{ "Txpath2 Capture Route", NULL, "DMIC5"},
-	{ "Txpath3 Capture Route", NULL, "DMIC5"},
-	{ "Txpath4 Capture Route", NULL, "DMIC5"},
-	{ "Txpath1 Capture Route", NULL, "DMIC6"},
-	{ "Txpath2 Capture Route", NULL, "DMIC6"},
-	{ "Txpath3 Capture Route", NULL, "DMIC6"},
-	{ "Txpath4 Capture Route", NULL, "DMIC6"},
+	{ "Txpath1 Capture Route", "DMIC1", "DMIC1"},
+	{ "Txpath2 Capture Route", "DMIC1", "DMIC1"},
+	{ "Txpath3 Capture Route", "DMIC1", "DMIC1"},
+	{ "Txpath4 Capture Route", "DMIC1", "DMIC1"},
+	{ "Txpath1 Capture Route", "DMIC2", "DMIC2"},
+	{ "Txpath2 Capture Route", "DMIC2", "DMIC2"},
+	{ "Txpath3 Capture Route", "DMIC2", "DMIC2"},
+	{ "Txpath4 Capture Route", "DMIC2", "DMIC2"},
+	{ "Txpath1 Capture Route", "DMIC3", "DMIC3"},
+	{ "Txpath2 Capture Route", "DMIC3", "DMIC3"},
+	{ "Txpath3 Capture Route", "DMIC3", "DMIC3"},
+	{ "Txpath4 Capture Route", "DMIC3", "DMIC3"},
+	{ "Txpath1 Capture Route", "DMIC4", "DMIC4"},
+	{ "Txpath2 Capture Route", "DMIC4", "DMIC4"},
+	{ "Txpath3 Capture Route", "DMIC4", "DMIC4"},
+	{ "Txpath4 Capture Route", "DMIC4", "DMIC4"},
+	{ "Txpath1 Capture Route", "DMIC5", "DMIC5"},
+	{ "Txpath2 Capture Route", "DMIC5", "DMIC5"},
+	{ "Txpath3 Capture Route", "DMIC5", "DMIC5"},
+	{ "Txpath4 Capture Route", "DMIC5", "DMIC5"},
+	{ "Txpath1 Capture Route", "DMIC6", "DMIC6"},
+	{ "Txpath2 Capture Route", "DMIC6", "DMIC6"},
+	{ "Txpath3 Capture Route", "DMIC6", "DMIC6"},
+	{ "Txpath4 Capture Route", "DMIC6", "DMIC6"},
 
 	/* tx path */
 	{ "TX1 Enable", NULL, "Txpath1 Capture Route"},
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 3/5 ASoC: sn95031: fix the amic tlv scale

In reply to Koul, Vinod

From: Vinod Koul <[email protected]>

The tlv scale is defined as (min, step, mute). The mute is not supported here so put the value to 0

---
 sound/soc/codecs/sn95031.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/sn95031.c +1 -1
index 5eb39c7..2a30eae 100644
@@ -359,7 +359,7 @@ static const struct snd_kcontrol_new sn95031_input4_mux_control =
 static const char *sn95031_micmode_text[] = {"Single Ended", "Differential"};
 
 /* 0dB to 30dB in 10dB steps */
-static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 10, 30);
+static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 10, 0);
 
 static const struct soc_enum sn95031_micmode1_enum =
 	SOC_ENUM_SINGLE(SN95031_MICAMP1, 1, 2, sn95031_micmode_text);
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 4/5 ASoC: sst_platform: fix the pulseaudio error

In reply to Koul, Vinod

From: Vinod Koul <[email protected]>

Pulseaudio doesnt work with current driver and it was root caused to absense of hw_params function and malloc_pages in it.
This patch adds this and allows pa to work fine with these drivers

---
 sound/soc/mid-x86/sst_platform.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
sound/soc/mid-x86/sst_platform.c +9 -0
index 96e6e9c..ee2c224 100644
@@ -365,6 +365,14 @@ static snd_pcm_uframes_t sst_platform_pcm_pointer
 	return stream->stream_info.buffer_ptr;
 }
 
+static int sst_platform_pcm_hw_params(struct snd_pcm_substream *substream,
+		struct snd_pcm_hw_params *params)
+{
+	snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
+	memset(substream->runtime->dma_area, 0, params_buffer_bytes(params));
+
+	return 0;
+}
 
 static struct snd_pcm_ops sst_platform_ops = {
 	.open = sst_platform_open,
@@ -373,6 +381,7 @@ static struct snd_pcm_ops sst_platform_ops = {
 	.prepare = sst_platform_pcm_prepare,
 	.trigger = sst_platform_pcm_trigger,
 	.pointer = sst_platform_pcm_pointer,
+	.hw_params = sst_platform_pcm_hw_params,
 };
 
 static void sst_pcm_free(struct snd_pcm *pcm)
Signature · 1 line
1.7.2.3
#5 lore raw

Re: [PATCH 4/5] ASoC: sst_platform: fix the pulseaudio error

Quoted 15 lines

+static int sst_platform_pcm_hw_params(struct snd_pcm_substream *substream,

sound/soc/mid-x86/sst_platform.c +4 -0
+		struct snd_pcm_hw_params *params)
+{
+	snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
+	memset(substream->runtime->dma_area, 0,

params_buffer_bytes(params));

sound/soc/mid-x86/sst_platform.c +3 -0
+
+	return 0;
+}
 
 static struct snd_pcm_ops sst_platform_ops = {
 	.open = sst_platform_open,

sound/soc/mid-x86/sst_platform.c static struct snd_pcm_ops sst_platform_ops = { · line 385

Quoted 5 lines
sound/soc/mid-x86/sst_platform.c +1 -0
@@ -373,6 +381,7 @@ static struct snd_pcm_ops sst_platform_ops = {
 	.prepare = sst_platform_pcm_prepare,
 	.trigger = sst_platform_pcm_trigger,
 	.pointer = sst_platform_pcm_pointer,
+	.hw_params = sst_platform_pcm_hw_params,
 };

Hi Vinod,

The sst_soc_platform_drv provides also .pcm_new callback which pre-allocates the DMA memory for the PCM Streams. Is the pcm_new callback required?

Selma.
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#6 lore raw

Re: [PATCH 4/5] ASoC: sst_platform: fix the pulseaudio error

Quoted 23 lines · Selma
Quoted 15 lines

+static int sst_platform_pcm_hw_params(struct snd_pcm_substream *substream,

sound/soc/mid-x86/sst_platform.c +4 -0
+		struct snd_pcm_hw_params *params)
+{
+	snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
+	memset(substream->runtime->dma_area, 0,

params_buffer_bytes(params));

sound/soc/mid-x86/sst_platform.c +3 -0
+
+	return 0;
+}
 
 static struct snd_pcm_ops sst_platform_ops = {
 	.open = sst_platform_open,

sound/soc/mid-x86/sst_platform.c static struct snd_pcm_ops sst_platform_ops = { · line 385

Quoted 5 lines
sound/soc/mid-x86/sst_platform.c +1 -0
@@ -373,6 +381,7 @@ static struct snd_pcm_ops sst_platform_ops = {
 	.prepare = sst_platform_pcm_prepare,
 	.trigger = sst_platform_pcm_trigger,
 	.pointer = sst_platform_pcm_pointer,
+	.hw_params = sst_platform_pcm_hw_params,
 };

Hi Vinod,

Quoted 2 lines

The sst_soc_platform_drv provides also .pcm_new callback which pre-allocates the DMA memory for the PCM Streams. Is the pcm_new callback required?

Selma,
Quoting Takshi's Writing alsa driver [1] "snd_pcm_lib_malloc_pages() is available only when the DMA buffers have been pre-allocated". The .pcm_new in this case allocates the buffer using snd_pcm_lib_preallocate_pages_for_all and in .hw_params we use the snd_pcm_lic_malloc_pages.
This seems to be required for aplay with mmap option to work (which pa seems to use as well), otherwise the mmap call fails

Signature · 5 lines
~Vinod Koul
Intel Corp.

[1]:
http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch05s06.html#pcm-interface-operators-open-callback
#7 lore raw

Re: [PATCH 4/5] ASoC: sst_platform: fix the pulseaudio error

In reply to Koul, Vinod
Quoted 5 lines · Vinod

From: Vinod Koul <[email protected]>

Pulseaudio doesnt work with current driver and it was root caused to absense of hw_params function and malloc_pages in it.
This patch adds this and allows pa to work fine with these drivers

For changes like this you really should provide changelogs which are more specific about what the actual problem is - it's fine to say that you found the problem while testing with PulseAudio but you really should say what the problem you found was. This is more useful for both review and for mining the changelog as it explains the change itself rather than the circumstances in which it was created.

Anyway, I've applied the whole series - thanks!

#8 lore raw

PATCH 5/5 ASoC: mfld_machine: make use of soc_register_card API

In reply to Koul, Vinod

From: Vinod Koul <[email protected]>

This patch removes the old method of soc-audio device creation in mfld machine and makes use of new soc_register_card API to register the card

---
 sound/soc/mid-x86/mfld_machine.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)
sound/soc/mid-x86/mfld_machine.c +6 -14
index 96487fb..429aa1b 100644
@@ -392,25 +392,17 @@ static int __devinit snd_mfld_mc_probe(struct platform_device *pdev)
 		pr_err("cannot register IRQ\n");
 		goto unalloc;
 	}
-	/* create soc device */
-	mc_drv_ctx->socdev = platform_device_alloc("soc-audio", -1);
-	if (!mc_drv_ctx->socdev) {
-		pr_err("soc-audio device allocation failed\n");
-		ret_val = -ENOMEM;
-		goto freeirq;
-	}
-	platform_set_drvdata(mc_drv_ctx->socdev, &snd_soc_card_mfld);
-	ret_val = platform_device_add(mc_drv_ctx->socdev);
+	/* register the soc card */
+	snd_soc_card_mfld.dev = &pdev->dev;
+	ret_val = snd_soc_register_card(&snd_soc_card_mfld);
 	if (ret_val) {
-		pr_err("Unable to add soc-audio device, err %d\n", ret_val);
-		goto unregister;
+		pr_debug("snd_soc_register_card failed %d\n", ret_val);
+		goto freeirq;
 	}
 	platform_set_drvdata(pdev, mc_drv_ctx);
 	pr_debug("successfully exited probe\n");
 	return ret_val;
 
-unregister:
-	platform_device_put(mc_drv_ctx->socdev);
 freeirq:
 	free_irq(irq, mc_drv_ctx);
 unalloc:
@@ -424,7 +416,7 @@ static int __devexit snd_mfld_mc_remove(struct platform_device *pdev)
 
 	pr_debug("snd_mfld_mc_remove called\n");
 	free_irq(platform_get_irq(pdev, 0), mc_drv_ctx);
-	platform_device_unregister(mc_drv_ctx->socdev);
+	snd_soc_unregister_card(&snd_soc_card_mfld);
 	kfree(mc_drv_ctx);
 	platform_set_drvdata(pdev, NULL);
 	return 0;
Signature · 1 line
1.7.2.3
Acked-by on the v1 series
#9 lore raw
In reply to Koul, Vinod
Quoted 15 lines · Vinod

From: Vinod Koul <[email protected]>

Hi,

This 5 patch series introduces some minor fixes in the TI sn95031 codec driver and the mfld_machine driver and sst_platfrom driver.
This also changes mfld_machine to use the soc_register_card() API.

Vinod Koul (5):
ASoC: sn95031: make playback rails depend on actual pins they control
ASoC: sn95031: fix the DMIC path routing
ASoC: sn95031: fix the amic tlv scale
ASoC: sst_platform: fix the pulseaudio error
ASoC: mfld_machine: make use of soc_register_card API

Quoted 5 lines
 sound/soc/codecs/sn95031.c       |   58 +++++++++++++++++++-------------------
 sound/soc/mid-x86/mfld_machine.c |   20 ++++---------
 sound/soc/mid-x86/sst_platform.c |    9 ++++++
 3 files changed, 44 insertions(+), 43 deletions(-)

All

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk