[alsa-devel] [PATCH 0/5] mfld machine and codec fixes
From: Vinod Koul vinod.koul@intel.com
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(-)
From: Vinod Koul vinod.koul@intel.com
This patch makes the codec playback rails (headset and speaker) depend on actual pins they control. This enables better power management of the codec
Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Harsha Priya priya.harsha@intel.com --- sound/soc/codecs/sn95031.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index d0b7802..9c3db0d 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -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"},
From: Vinod Koul vinod.koul@intel.com
This patch makes the DMIC dynamically connect to TX Mux, earlier code had erroneously made this as static path
Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Harsha Priya priya.harsha@intel.com --- sound/soc/codecs/sn95031.c | 48 ++++++++++++++++++++++---------------------- 1 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 9c3db0d..5eb39c7 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -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"},
From: Vinod Koul vinod.koul@intel.com
The tlv scale is defined as (min, step, mute). The mute is not supported here so put the value to 0
Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Harsha Priya priya.harsha@intel.com --- sound/soc/codecs/sn95031.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 5eb39c7..2a30eae 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -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);
From: Vinod Koul vinod.koul@intel.com
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
Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Harsha Priya priya.harsha@intel.com --- sound/soc/mid-x86/sst_platform.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index 96e6e9c..ee2c224 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c @@ -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)
+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,
};
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.
On Tue, 2011-02-15 at 20:16 +0530, Bensaid, Selma wrote:
+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,
};
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, 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
On Tue, Feb 15, 2011 at 06:28:54PM +0530, Koul, Vinod wrote:
From: Vinod Koul vinod.koul@intel.com
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!
From: Vinod Koul vinod.koul@intel.com
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
Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Harsha Priya priya.harsha@intel.com --- sound/soc/mid-x86/mfld_machine.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index 96487fb..429aa1b 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -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;
On Tue, 2011-02-15 at 18:28 +0530, Koul, Vinod wrote:
From: Vinod Koul vinod.koul@intel.com
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(-)
All
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
participants (4)
-
Bensaid, Selma
-
Koul, Vinod
-
Liam Girdwood
-
Mark Brown