Skip to contentSkip to conversation

ASoC: pxa: possible regressions

DISCUSSION Petr Cvek 2 participants 5 messages Aug 8, 2018 – Aug 15, 2018

Subsystems (4)
lore
Share & tools
lore

Petr Cvek

author
#0 lore raw

Hello,

I was trying to update my system (PXA Magician) to 4.18-next and i've ran into few problems with sound. My setup has only a few changes from vanilla (change to using devm_snd_soc_register_card+devm_gpio_request). I've started digging around:

1) unimportant goto

Commit 7afd1b0b2ef9a812095 ("ASoC: pxa: move some functions to pxa2xx-lib") is this construct necessary?

	if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
			SNDRV_PCM_STREAM_CAPTURE);
		if (ret)
			goto out;
	}
 out:
	return ret;

After calling pxa2xx_pcm_preallocate_dma_buffer() the code will jump to out anyway.

2) wrong units (sample rate vs osc rate)

Commit 05739375f1c0a1048 ("ASoC: pxa-ssp: remove .set_pll() and .set_clkdiv() callbacks"). The function pxa_ssp_hw_params() get's called with sample rate so:

	/* The values in the table are for 16 bits */
	if (width == 32)
		acds--;

	ret = pxa_ssp_set_pll(priv, bclk);
	if (ret < 0)
		return ret;

	ssacd = pxa_ssp_read_reg(ssp, SSACD);
	ssacd &= ~(SSACD_ACDS(7) | SSACD_SCDB_1X);

pxa_ssp_set_pll() will try to set something like 8000, 44100, ... and not the speed of an oscilator. The line should be probably:

	ret = pxa_ssp_set_pll(priv, m->pll);

and there is a previous call to pxa_ssp_set_pll():

	if (sscr0 & SSCR0_ACS) {
		ret = pxa_ssp_set_pll(priv, bclk);

This one is OK I suppose?

3) setup fails

Recent changes in ASoC PXA DMA are causing a fail of a condition in pxa_ssp_hw_params():

	if ((sscr0 & SSCR0_MOD) && !ttsa) {
		dev_err(&ssp->pdev->dev, "No TDM timeslot configured\n");
		return -EINVAL;
	}

It seems the SSCR0_MOD flag is set in the fall through switch statement in pxa_ssp_configure_dai_fmt():

	case SND_SOC_DAIFMT_DSP_A:
		sspsp |= SSPSP_FSRT;
		/* fall through */
	case SND_SOC_DAIFMT_DSP_B:
		sscr0 |= SSCR0_MOD | SSCR0_PSP;
		sscr1 |= SSCR1_TRAIL | SSCR1_RWOT;
		break;

the switch statement is an old code and it worked in the past versions.

4) names are not unique

The initialization of magician_dai structure wants to have (at least in the past versions) for the .name item:

	static struct snd_soc_dai_link magician_dai[] = {
	{
		.name = "uda1380",
		.stream_name = "UDA1380 Playback",
		.cpu_dai_name = "pxa-ssp-dai.0",
		...
	{
		.name = "uda1380",
		.stream_name = "UDA1380 Capture",
		.cpu_dai_name = "pxa2xx-i2s",

my personal branch has them named as "uda1380_playback" and "uda1380_capture".

5) Unbalanced references

When trying to play a sound (with quick-and-dirty workarounds for problems above):

  # cat /dev/urandom | aplay -

the system will crash when terminating aplay (stopping playback). The backtrace:

 ------------[ cut here ]------------
 WARNING: CPU: 0 PID: 352 at drivers/dma/dmaengine.c:788 
dma_release_channel+0x44/0xa0
 chan reference count 0 != 1
 Modules linked in: snd_soc_magician snd_soc_uda1380 snd_soc_pxa2xx_i2s 
spi_pxa2xx_platform snd_soc_pxa_ssp snd_soc_pxa2xx snd_pxa2xx_lib snd_pcm_dmaengine snd_soc_core snd_pcm videobuf2_common snd_timer snd ssp soundcore ... [last unloaded: udc_core]
 CPU: 0 PID: 352 Comm: aplay Tainted: G         C 
4.18.0-rc6-next-20180726-magician+ #15
 Hardware name: HTC Magician
 [<c0107d90>] (unwind_backtrace) from [<c010594c>] (show_stack+0x10/0x14)
 [<c010594c>] (show_stack) from [<c0111680>] (__warn+0xd4/0xec)
 [<c0111680>] (__warn) from [<c01112d0>] (warn_slowpath_fmt+0x44/0x6c)
 [<c01112d0>] (warn_slowpath_fmt) from [<c034908c>] 
(dma_release_channel+0x44/0xa0)
 [<c034908c>] (dma_release_channel) from [<bf3183d4>] 
(snd_dmaengine_pcm_close_release_chan+0x2c/0x3c [snd_pcm_dmaengine])
 [<bf3183d4>] (snd_dmaengine_pcm_close_release_chan 
[snd_pcm_dmaengine]) from [<bf1e4fbc>] (soc_pcm_components_close+0x64/0x70 [snd_soc_core])
 [<bf1e4fbc>] (soc_pcm_components_close [snd_soc_core]) from 
[<bf1e74a0>] (soc_pcm_close+0xac/0x1c0 [snd_soc_core])
 [<bf1e74a0>] (soc_pcm_close [snd_soc_core]) from [<bf1407c8>] 
(snd_pcm_release_substream+0x68/0xb8 [snd_pcm])
 [<bf1407c8>] (snd_pcm_release_substream [snd_pcm]) from [<bf14085c>] 
(snd_pcm_release+0x44/0x8c [snd_pcm])
 [<bf14085c>] (snd_pcm_release [snd_pcm]) from [<c01c39e4>] 
(__fput+0xdc/0x1e8)
 [<c01c39e4>] (__fput) from [<c0129e7c>] (task_work_run+0xc4/0xd4)
 [<c0129e7c>] (task_work_run) from [<c01053ac>] (do_work_pending+0xc0/0xc8)
 [<c01053ac>] (do_work_pending) from [<c0101068>] 
(slow_work_pending+0xc/0x20)
 Exception stack(0xc2ffbfb0 to 0xc2ffbff8)
 bfa0:                                     00000000 01f7a1a0 01f6fa3c 

00000000
bfc0: 01f7a150 00000000 0009283c 00000006 000003f0 01f7a4c8 00000000
01f7a4c8
bfe0: b6ebbd70 be8ea960 b6e287b8 b6cd2018 60000010 00000004

 ---[ end trace b671f6531db6f6b3 ]---

I've only managed to discover there are two calls of pxa2xx_soc_pcm_new() (where DMA buffer is allocated) for both dai links:

	magician-audio magician-audio: uda1380-hifi-playback <-> pxa-ssp-dai.0 
mapping ok
	...
	magician-audio magician-audio: uda1380-hifi-capture <-> pxa2xx-i2s 

mapping ok

but I don't know if this information is relevant.

thanks for any help,
Petr Cvek

maintainer
#1 lore raw

Hi Petr,

Quoted 2 lines · Petr Cvek

I was trying to update my system (PXA Magician) to 4.18-next and i've ran into few problems with sound.

Ah, so you have a Magician platform, that's very good!

Quoted 2 lines

My setup has only a few changes from
vanilla (change to using devm_snd_soc_register_card+devm_gpio_request).

Care to share these changes, or ideally rebase them on top of 4.18-next for mainline inclusion? Also, I'm curious what mainline version you used to be based on that worked for you.

Quoted 1 line

I've started digging around:

Thanks for that. Are you also willing to send patches to fix things once they work for you?

Quoted 14 lines

1) unimportant goto

Commit 7afd1b0b2ef9a812095 ("ASoC: pxa: move some functions to pxa2xx-lib") is this construct necessary?

	if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
			SNDRV_PCM_STREAM_CAPTURE);
		if (ret)
			goto out;
	}
   out:
	return ret;
Quoted 2 lines

After calling pxa2xx_pcm_preallocate_dma_buffer() the code will jump to out anyway.

True. That's a cosmetic cleanup which can go in for 4.19. Would you want to send a patch after the merge window?

Quoted 17 lines

2) wrong units (sample rate vs osc rate)

Commit 05739375f1c0a1048 ("ASoC: pxa-ssp: remove .set_pll() and .set_clkdiv() callbacks"). The function pxa_ssp_hw_params() get's called with sample rate so:

	/* The values in the table are for 16 bits */
	if (width == 32)
		acds--;

	ret = pxa_ssp_set_pll(priv, bclk);
	if (ret < 0)
		return ret;

	ssacd = pxa_ssp_read_reg(ssp, SSACD);
	ssacd &= ~(SSACD_ACDS(7) | SSACD_SCDB_1X);
Quoted 6 lines

pxa_ssp_set_pll() will try to set something like 8000, 44100, ... and not the speed of an oscilator. The line should be probably:

	ret = pxa_ssp_set_pll(priv, m->pll);

and there is a previous call to pxa_ssp_set_pll():

Ah, yes. Does changing that fix it for you?

The changes in that machine driver where done blindly because I don't have Magician hardware, and I really don't like doing things that way.

Quoted 6 lines

3) setup fails

Recent changes in ASoC PXA DMA are causing a fail of a condition in pxa_ssp_hw_params():

	if ((sscr0 & SSCR0_MOD) && !ttsa) {

What are the values of sscr0 and ttsa in your case? Can you cross-check that with a kernel that doesn't have my recent changes?

Quoted 15 lines
		dev_err(&ssp->pdev->dev, "No TDM timeslot configured\n");
		return -EINVAL;
	}

It seems the SSCR0_MOD flag is set in the fall through switch statement in pxa_ssp_configure_dai_fmt():

	case SND_SOC_DAIFMT_DSP_A:
		sspsp |= SSPSP_FSRT;
		/* fall through */
	case SND_SOC_DAIFMT_DSP_B:
		sscr0 |= SSCR0_MOD | SSCR0_PSP;
		sscr1 |= SSCR1_TRAIL | SSCR1_RWOT;
		break;
Quoted 1 line

the switch statement is an old code and it worked in the past versions.

Yes, it was merely moved to some location that is called earlier. This was fixing a regression caused by a8bd0ee558714 ("ASoC: raumfeld: Use static DAI format setup"), so supposedly, all PXA sound was broken since v4.0.

Quoted 16 lines

4) names are not unique

The initialization of magician_dai structure wants to have (at least in the past versions) for the .name item:

	static struct snd_soc_dai_link magician_dai[] = {
	{
		.name = "uda1380",
		.stream_name = "UDA1380 Playback",
		.cpu_dai_name = "pxa-ssp-dai.0",
		...
	{
		.name = "uda1380",
		.stream_name = "UDA1380 Capture",
		.cpu_dai_name = "pxa2xx-i2s",
Quoted 2 lines

my personal branch has them named as "uda1380_playback" and "uda1380_capture".

Care to send a patch for that as well, please?

Quoted 9 lines

5) Unbalanced references

When trying to play a sound (with quick-and-dirty workarounds for problems above):

    # cat /dev/urandom | aplay -

the system will crash when terminating aplay (stopping playback). The backtrace:

So you did hear a sound?

[...]

Quoted 10 lines

I've only managed to discover there are two calls of pxa2xx_soc_pcm_new() (where DMA buffer is allocated) for both dai links:

	magician-audio magician-audio: uda1380-hifi-playback <-> pxa-ssp-dai.0
mapping ok
	...
	magician-audio magician-audio: uda1380-hifi-capture <-> pxa2xx-i2s

mapping ok

but I don't know if this information is relevant.

That seems fine. The question is why there are are unbalanced calls to snd_dmaengine_pcm_close_release_chan(). Could you dig a bit further maybe and add some printk()?

Thanks for helping fix these regressions!

Daniel

author
#2 lore raw

Dne 8.8.2018 v 07:38 Daniel Mack napsal(a):

Quoted 5 lines
Quoted 3 lines

My setup has only a few changes from
vanilla (change to using devm_snd_soc_register_card+devm_gpio_request).

Care to share these changes, or ideally rebase them on top of 4.18-next for mainline inclusion? Also, I'm curious what mainline version you used to be based on that worked for you.

I was planning to send patches before I've found regressions in the current -next.

I think I've had the first working version somewhere around 3.13, but I was updating versions only sporadically and fixing audio had low priority (higher priority got iwmmxt compiler, platform init source code, charger, USB, MMC and IrDA). Some versions until now worked, some didn't.

The last version I've used and where the sound worked was 4.14.0-rc7-next from somewhere around 3rd November 2017. The patch for sound subsystem should be the same as the current one.

The current patch is based on vanilla 4.18.0-rc6-next-20180726.

Quoted 18 lines
Quoted 18 lines

2) wrong units (sample rate vs osc rate)

Commit 05739375f1c0a1048 ("ASoC: pxa-ssp: remove .set_pll() and .set_clkdiv() callbacks"). The function pxa_ssp_hw_params() get's called with sample rate so:

    /* The values in the table are for 16 bits */
    if (width == 32)
        acds--;

    ret = pxa_ssp_set_pll(priv, bclk);
    if (ret < 0)
        return ret;

    ssacd = pxa_ssp_read_reg(ssp, SSACD);
    ssacd &= ~(SSACD_ACDS(7) | SSACD_SCDB_1X);

Quoted 9 lines
Quoted 6 lines

pxa_ssp_set_pll() will try to set something like 8000, 44100, ... and not the speed of an oscilator. The line should be probably:

    ret = pxa_ssp_set_pll(priv, m->pll);

and there is a previous call to pxa_ssp_set_pll():

Ah, yes. Does changing that fix it for you?

Nope it just allows the code to proceed behind.

The fixing 3) (SSCR0_MOD check) has the same effect. It just postpones the closing of the device until a valid termination of aplay.

Quoted 10 lines
Quoted 7 lines

3) setup fails

Recent changes in ASoC PXA DMA are causing a fail of a condition in pxa_ssp_hw_params():

    if ((sscr0 & SSCR0_MOD) && !ttsa) {

What are the values of sscr0 and ttsa in your case? Can you cross-check that with a kernel that doesn't have my recent changes?

-> full values in the attached log (the flag is set in the switch case and ttsa is zeroed)

On 4.14 (not sure, if it is the correct SSP controller)

Idle:

SSCR0:

	# devmem 0x41000000 32
	0x4000003F <- 31 bit is SSCR0_MOD
SSCR1:
	# devmem 0x41000004 32
	0x00C01D80
SSTSA:
	# devmem 0x41000030 32
	0x00000000 <- is "ttsa" variable
SSRSA:
	# devmem 0x41000034 32
	0x00000000
SSTSS:
	# devmem 0x41000038 32
	0x00000000

Playing noise:

SSCR0:

	# devmem 0x41000000 32
	0x400000BF <- 31 bit is SSCR0_MOD
SSCR1:
	# devmem 0x41000004 32
	0x00E01D80
SSTSA:
	# devmem 0x41000030 32
	0x00000000 <- is "ttsa" variable
SSRSA:
	# devmem 0x41000034 32
	0x00000000
SSTSS:
	# devmem 0x41000038 32
	0x00000000

.. so the time slots are correctly disabled.

Quoted 16 lines
Quoted 16 lines

4) names are not unique

The initialization of magician_dai structure wants to have (at least in the past versions) for the .name item:

    static struct snd_soc_dai_link magician_dai[] = { {
        .name = "uda1380",
        .stream_name = "UDA1380 Playback", .cpu_dai_name = "pxa-ssp-dai.0",
        ...
    {
        .name = "uda1380",
        .stream_name = "UDA1380 Capture", .cpu_dai_name = "pxa2xx-i2s",

Quoted 4 lines
Quoted 2 lines

my personal branch has them named as "uda1380_playback" and "uda1380_capture".

Care to send a patch for that as well, please?

If this is a correct solution then yes.

Quoted 6 lines
Quoted 6 lines

5) Unbalanced references

When trying to play a sound (with quick-and-dirty workarounds for problems above):

Quoted 6 lines
Quoted 4 lines
    # cat /dev/urandom | aplay -

the system will crash when terminating aplay (stopping playback). The backtrace:

So you did hear a sound?

No, nothing went through. Only clicking was probably caused by muting the speaker output.

Quoted 2 lines

That seems fine. The question is why there are are unbalanced calls to snd_dmaengine_pcm_close_release_chan(). Could you dig a bit further maybe and add some printk()?

Yes I did, patch with asserts and matching log attached. It gets really ugly but though. It is full dump of changes, so there is a conversion of magician-audio driver for module_platform_driver (wasn't able to load it from vanilla from around 3.13) and some bugfixes in uda codec (uda1380-hifi removed because it didn't work with split magician I2S/SSP channels and I didn't test it lately, and a bugfix for name/register settings).

Petr

Quoted 1 line

From 4235ede8483cb177ff26d7344699a6481a222cc7 Mon Sep 17 00:00:00 2001

From: Petr Cvek <[email protected]>
Date: Fri, 3 Aug 2018 06:21:41 +0200
Subject: [PATCH] ASoC pxa magician testing

---
 sound/arm/pxa2xx-pcm-lib.c |  23 +++++-
 sound/core/pcm_dmaengine.c |   7 ++
 sound/core/pcm_native.c    |  97 +++++++++++++----------
 sound/soc/codecs/uda1380.c |  56 +++++++++-----
 sound/soc/pxa/magician.c   | 152 +++++++++++++++++++------------------
 sound/soc/pxa/pxa-ssp.c    | 139 ++++++++++++++++++++++++++++++++-
 sound/soc/pxa/pxa2xx-i2s.c |  49 ++++++++++++
 sound/soc/soc-core.c       |  15 ++++
 sound/soc/soc-pcm.c        |  25 ++++++
 9 files changed, 428 insertions(+), 135 deletions(-)
sound/arm/pxa2xx-pcm-lib.c +22 -1
index 7931789d4a9f..1a3affb0b691 100644
@@ -29,7 +29,7 @@ static const struct snd_pcm_hardware pxa2xx_pcm_hardware = {
 	.period_bytes_max	= 8192 - 32,
 	.periods_min		= 1,
 	.periods_max		= 256,
-	.buffer_bytes_max	= 128 * 1024,
+	.buffer_bytes_max	= 16 * 1024,	//original value fails to allocate (128 * 1024 too big)
 	.fifo_size		= 32,
 };
 
@@ -42,23 +42,29 @@ int pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
 	struct dma_slave_config config;
 	int ret;
 
+pr_info("pxa2xx_pcm_hw_params A1\n");
 	dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 	if (!dma_params)
 		return 0;
 
+pr_info("pxa2xx_pcm_hw_params A2\n");
 	ret = snd_hwparams_to_dma_slave_config(substream, params, &config);
 	if (ret)
 		return ret;
 
+pr_info("pxa2xx_pcm_hw_params A3\n");
 	snd_dmaengine_pcm_set_config_from_dai_data(substream,
 			snd_soc_dai_get_dma_data(rtd->cpu_dai, substream),
 			&config);
 
+pr_info("pxa2xx_pcm_hw_params A4\n");
 	ret = dmaengine_slave_config(chan, &config);
 	if (ret)
 		return ret;
 
+pr_info("pxa2xx_pcm_hw_params A5\n");
 	snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
+pr_info("pxa2xx_pcm_hw_params A6 fin\n");
 
 	return 0;
 }
@@ -99,10 +105,13 @@ int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
 
 	runtime->hw = pxa2xx_pcm_hardware;
 
+pr_info("pxa2xx_pcm_open B1\n");
+
 	dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 	if (!dma_params)
 		return 0;
 
+pr_info("pxa2xx_pcm_open B2\n");
 	/*
 	 * For mysterious reasons (and despite what the manual says)
 	 * playback samples are lost if the DMA count is not a multiple
@@ -113,15 +122,19 @@ int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
 	if (ret)
 		return ret;
 
+pr_info("B3\n");
+
 	ret = snd_pcm_hw_constraint_step(runtime, 0,
 		SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 32);
 	if (ret)
 		return ret;
+pr_info("B4\n");
 
 	ret = snd_pcm_hw_constraint_integer(runtime,
 					    SNDRV_PCM_HW_PARAM_PERIODS);
 	if (ret < 0)
 		return ret;
+pr_info("B5 fin?\n");
 
 	return snd_dmaengine_pcm_open(
 		substream, dma_request_slave_channel(rtd->cpu_dai->dev,
@@ -185,13 +198,18 @@ int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
 	struct snd_pcm *pcm = rtd->pcm;
 	int ret;
 
+pr_info("C1 pxa2xx_soc_pcm_new\n");
+
 	ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
+pr_info("C2 from dma_coerce_mask_and_coherent %i\n",ret);
 	if (ret)
 		return ret;
 
+
 	if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
 		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
 			SNDRV_PCM_STREAM_PLAYBACK);
+pr_info("C3play from pxa2xx_pcm_preallocate_dma_buffer %i\n",ret);
 		if (ret)
 			goto out;
 	}
@@ -199,6 +217,9 @@ int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
 	if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
 		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm,
 			SNDRV_PCM_STREAM_CAPTURE);
+pr_info("C4capt from pxa2xx_pcm_preallocate_dma_buffer %i\n",ret);
+
+		//WTF konstrukce
 		if (ret)
 			goto out;
 	}
sound/core/pcm_dmaengine.c +7 -0
index 8eb58c709b14..124952e8a3f4 100644
@@ -18,6 +18,9 @@
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
+
+#define DEBUG 1
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/dmaengine.h>
@@ -369,11 +372,15 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
 int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream)
 {
 	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
+pr_info("GGG1 %i\n",prtd->dma_chan->client_count);
 
 	dmaengine_synchronize(prtd->dma_chan);
+pr_info("GGG2\n");
 	dma_release_channel(prtd->dma_chan);
+pr_info("GGG3\n");
 	kfree(prtd);
 
+pr_info("GGG4\n");
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close_release_chan);
sound/core/pcm_native.c +58 -39

326 lines not on this page · raw message

sound/soc/codecs/uda1380.c +38 -18

162 lines not on this page · raw message

sound/soc/pxa/magician.c +78 -74

306 lines not on this page · raw message

sound/soc/pxa/pxa-ssp.c +136 -3

424 lines not on this page · raw message

sound/soc/pxa/pxa2xx-i2s.c +49 -0

148 lines not on this page · raw message

sound/soc/soc-core.c +15 -0
index 81b27923303d..b794cfb583f4 100644
@@ -17,6 +17,8 @@
 //   o Add more codecs and platforms to ensure good API coverage.
 //   o Support TDM on PCM and I2S
 
+#define DEBUG 1
+
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
@@ -1531,12 +1533,14 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 	rtd->pmdown_time = pmdown_time;
 
 	ret = soc_probe_dai(cpu_dai, order);
+pr_info("JJJ1 soc_probe_link_dais %i\n",ret);
 	if (ret)
 		return ret;
 
 	/* probe the CODEC DAI */
 	for (i = 0; i < rtd->num_codecs; i++) {
 		ret = soc_probe_dai(rtd->codec_dais[i], order);
+pr_info("JJJ2 %i %i\n",i,ret);
 		if (ret)
 			return ret;
 	}
@@ -1548,6 +1552,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 	/* do machine specific initialization */
 	if (dai_link->init) {
 		ret = dai_link->init(rtd);
+pr_info("JJJ3 %i\n",ret);
 		if (ret < 0) {
 			dev_err(card->dev, "ASoC: failed to init %s: %d\n",
 				dai_link->name, ret);
@@ -1559,6 +1564,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 		snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
 
 	ret = soc_post_component_init(rtd, dai_link->name);
+pr_info("JJJ4 %i\n",ret);
 	if (ret)
 		return ret;
 
@@ -1581,6 +1587,8 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 		if (!component->driver->use_dai_pcm_id)
 			continue;
 
+pr_info("JJJ5\n");
+
 		if (rtd->dai_link->no_pcm)
 			num += component->driver->be_pcm_base;
 		else
@@ -1590,6 +1598,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 	if (cpu_dai->driver->compress_new) {
 		/*create compress_device"*/
 		ret = cpu_dai->driver->compress_new(rtd, num);
+pr_info("JJJ6 %i\n",ret);
 		if (ret < 0) {
 			dev_err(card->dev, "ASoC: can't create compress %s\n",
 					 dai_link->stream_name);
@@ -1599,18 +1608,23 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 
 		if (!dai_link->params) {
 			/* create the pcm */
+
 			ret = soc_new_pcm(rtd, num);
+pr_info("JJJ7 from soc_new_pcm %i\n",ret);
+
 			if (ret < 0) {
 				dev_err(card->dev, "ASoC: can't create pcm %s :%d\n",
 				       dai_link->stream_name, ret);
 				return ret;
 			}
 			ret = soc_link_dai_pcm_new(&cpu_dai, 1, rtd);
+pr_info("JJJ8 from soc_link_dai_pcm_new %i\n",ret);
 			if (ret < 0)
 				return ret;
 			ret = soc_link_dai_pcm_new(rtd->codec_dais,
 						   rtd->num_codecs, rtd);
 			if (ret < 0)
+pr_info("JJJ9 from soc_link_dai_pcm_new %i\n",ret);
 				return ret;
 		} else {
 			INIT_DELAYED_WORK(&rtd->delayed_work,
@@ -1618,6 +1632,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,
 
 			/* link the DAI widgets */
 			ret = soc_link_dai_widgets(card, dai_link, rtd);
+pr_info("JJJ10 from soc_link_dai_widgets %i\n",ret);
 			if (ret)
 				return ret;
 		}
sound/soc/soc-pcm.c +25 -0
index 98be04b543ae..8998d20c7807 100644
@@ -10,6 +10,8 @@
 // Authors: Liam Girdwood <[email protected]>
 //          Mark Brown <[email protected]>
 
+#define DEBUG 1
+
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
@@ -449,6 +451,8 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
 	struct snd_soc_rtdcom_list *rtdcom;
 	struct snd_soc_component *component;
 
+pr_info("FFF1 soc_pcm_components_close\n");
+
 	for_each_rtdcom(rtd, rtdcom) {
 		component = rtdcom->component;
 
@@ -459,7 +463,10 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream,
 		    !component->driver->ops->close)
 			continue;
 
+pr_info("FFF2 %s\n",substream->name);
+
 		component->driver->ops->close(substream);
+pr_info("FFF3\n");
 	}
 
 	return 0;
@@ -692,10 +699,13 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
 	struct snd_soc_dai *codec_dai;
 	int i;
+pr_info("EEE1 soc_pcm_close\n");
 
 	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
 
+pr_info("EEE2\n");
 	snd_soc_runtime_deactivate(rtd, substream->stream);
+pr_info("EEE3\n");
 
 	/* clear the corresponding DAIs rate when inactive */
 	if (!cpu_dai->active)
@@ -706,12 +716,16 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 		if (!codec_dai->active)
 			codec_dai->rate = 0;
 	}
+pr_info("EEE4\n");
 
 	snd_soc_dai_digital_mute(cpu_dai, 1, substream->stream);
+pr_info("EEE5\n");
 
 	if (cpu_dai->driver->ops->shutdown)
 		cpu_dai->driver->ops->shutdown(substream, cpu_dai);
 
+pr_info("EEE6\n");
+
 	for (i = 0; i < rtd->num_codecs; i++) {
 		codec_dai = rtd->codec_dais[i];
 		if (codec_dai->driver->ops->shutdown)
@@ -721,7 +735,9 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 	if (rtd->dai_link->ops->shutdown)
 		rtd->dai_link->ops->shutdown(substream);
 
+pr_info("EEE7\n");
 	soc_pcm_components_close(substream, NULL);
+pr_info("EEE8\n");
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
@@ -742,6 +758,8 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 					  SND_SOC_DAPM_STREAM_STOP);
 	}
 
+pr_info("EEE9\n");
+
 	mutex_unlock(&rtd->pcm_mutex);
 
 	for_each_rtdcom(rtd, rtdcom) {
@@ -751,12 +769,15 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 		pm_runtime_put_autosuspend(component->dev);
 	}
 
+pr_info("EEE10\n");
+
 	for (i = 0; i < rtd->num_codecs; i++) {
 		if (!rtd->codec_dais[i]->active)
 			pinctrl_pm_select_sleep_state(rtd->codec_dais[i]->dev);
 	}
 	if (!cpu_dai->active)
 		pinctrl_pm_select_sleep_state(cpu_dai->dev);
+pr_info("EEE11\n");
 
 	return 0;
 }
@@ -3075,6 +3096,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 				(rtd->num_codecs > 1) ?
 				"multicodec" : rtd->codec_dai->name, num);
 
+pr_info("!!!HHH1 soc_new_pcm %i %i\n",playback,capture);
 		ret = snd_pcm_new(rtd->card->snd_card, new_name, num, playback,
 			capture, &pcm);
 	}
@@ -3153,7 +3175,10 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 		if (!component->driver->pcm_new)
 			continue;
 
+// NOTICE pxa2xx_soc_pcm_new called here, contains pxa2xx_pcm_preallocate_dma_buffer
+pr_info("!!!HHH2\n");
 		ret = component->driver->pcm_new(rtd);
+pr_info("!!!HHH3 %i\n",ret);
 		if (ret < 0) {
 			dev_err(component->dev,
 				"ASoC: pcm constructor failed: %d\n",
Signature · 1 line
2.18.0

modprobe snd-soc-pxa_ssp
modprobe snd-soc-pxa2xx_i2s
modprobe snd-soc-uda1380
modprobe snd-soc-pxa2xx
modprobe snd-soc-magician
alsactl restore
=====

[ 1230.308722] !!pxa UDC queue 80fbffd2
[ 1231.047868] pxa2xx-i2s pxa2xx-i2s: ASoC: dai register pxa2xx-i2s #1
[ 1231.047928] pxa2xx-i2s pxa2xx-i2s: ASoC: dynamically register DAI pxa2xx-i2s
[ 1231.047983] pxa2xx-i2s pxa2xx-i2s: ASoC: Registered DAI 'pxa2xx-i2s'
[ 1231.915193] uda1380-codec 0-0018: ASoC: dai register 0-0018 #2
[ 1231.915253] uda1380-codec 0-0018: ASoC: dynamically register DAI 0-0018
[ 1231.915297] uda1380-codec 0-0018: ASoC: Registered DAI 'uda1380-hifi-playback'
[ 1231.915319] uda1380-codec 0-0018: ASoC: dynamically register DAI 0-0018
[ 1231.915352] uda1380-codec 0-0018: ASoC: Registered DAI 'uda1380-hifi-capture'
[ 1231.915388] uda1380_i2c_probe ret=0
[ 1233.244748] magician_audio_probe AAA1
[ 1233.245366] magician-audio magician-audio: ASoC: binding uda1380_playback
[ 1233.255132] magician-audio magician-audio: ASoC: binding uda1380_capture
[ 1233.467018] uda1380-codec 0-0018: ASoC: adding Playback widget
[ 1233.467092] uda1380-codec 0-0018: ASoC: adding Capture widget
[ 1233.535174] uda1380-codec 0-0018: Control not supported for path Right PGA -> [Mic + Line R] -> Right ADC
[ 1233.540103] uda1380-codec 0-0018: ASoC: no dapm match for Right PGA --> Mic + Line R --> Right ADC
[ 1233.542096] uda1380-codec 0-0018: ASoC: Failed to add route Right PGA -> Mic + Line R -> Right ADC
[ 1233.542872] uda1380-codec 0-0018: Control not supported for path Right PGA -> [Line] -> Right ADC
[ 1233.543170] uda1380-codec 0-0018: ASoC: no dapm match for Right PGA --> Line --> Right ADC
[ 1233.547803] uda1380-codec 0-0018: ASoC: Failed to add route Right PGA -> Line -> Right ADC
[ 1233.549405] magician-audio magician-audio: ASoC: probe Magician dai link 0 late -2
[ 1233.551888] JJJ1 soc_probe_link_dais 0
[ 1233.552159] JJJ2 0 0
[ 1233.552292] magician-audio magician-audio: ASoC: probe Magician dai link 1 late -2
[ 1233.552305] JJJ1 soc_probe_link_dais 0
[ 1233.552742] JJJ2 0 0
[ 1233.552887] magician-audio magician-audio: ASoC: probe Magician dai link 0 late -1
[ 1233.552900] JJJ1 soc_probe_link_dais 0
[ 1233.553027] JJJ2 0 0
[ 1233.553124] magician-audio magician-audio: ASoC: probe Magician dai link 1 late -1
[ 1233.553135] JJJ1 soc_probe_link_dais 0
[ 1233.553250] JJJ2 0 0
[ 1233.553345] magician-audio magician-audio: ASoC: probe Magician dai link 0 late 0
[ 1233.553360] AD1 pxa_ssp_probe
[ 1233.556087] AD2
[ 1233.556359] AD3
[ 1233.558818] AD4
[ 1233.559085] AD5 fin
[ 1233.559178] JJJ1 soc_probe_link_dais 0
[ 1233.559299] JJJ2 0 0
[ 1233.665046] magician-audio magician-audio: ASoC: probe Magician dai link 1 late 0
[ 1233.665111] T1 pxa2xx_i2s_probe
[ 1233.665758] T2 fin ok
[ 1233.665911] JJJ1 soc_probe_link_dais 0
[ 1233.666056] JJJ2 0 0
[ 1233.666194] magician-audio magician-audio: ASoC: probe Magician dai link 0 late 1
[ 1233.666215] JJJ1 soc_probe_link_dais 0
[ 1233.666363] JJJ2 0 0
[ 1233.666650] magician-audio magician-audio: ASoC: probe Magician dai link 1 late 1
[ 1233.666674] JJJ1 soc_probe_link_dais 0
[ 1233.666834] JJJ2 0 0
[ 1233.666936] magician-audio magician-audio: ASoC: probe Magician dai link 0 late 2
[ 1233.666949] JJJ1 soc_probe_link_dais 0
[ 1233.667072] JJJ2 0 0
[ 1233.671051] JJJ4 0
[ 1233.671335] !!!HHH1 soc_new_pcm 1 0
[ 1233.777422] magician-audio magician-audio: ASoC: registered pcm #0 UDA1380 Playback uda1380-hifi-playback-0
[ 1233.777795] !!!HHH2
[ 1233.778026] C1 pxa2xx_soc_pcm_new
[ 1233.778159] C2 from dma_coerce_mask_and_coherent 0
[ 1233.804002] C3play from pxa2xx_pcm_preallocate_dma_buffer 0
[ 1233.804347] !!!HHH3 0
[ 1233.804726] !!!HHH2
[ 1233.804823] C1 pxa2xx_soc_pcm_new
[ 1233.808244] C2 from dma_coerce_mask_and_coherent 0
[ 1233.890316] C3play from pxa2xx_pcm_preallocate_dma_buffer 0
[ 1233.935667] !!!HHH3 0
[ 1233.939808] magician-audio magician-audio: uda1380-hifi-playback <-> pxa-ssp-dai.0 mapping ok
[ 1233.948848] JJJ7 from soc_new_pcm 0
[ 1233.960808] JJJ8 from soc_link_dai_pcm_new 0
[ 1233.976827] magician-audio magician-audio: ASoC: probe Magician dai link 1 late 2
[ 1233.976876] JJJ1 soc_probe_link_dais 0
[ 1233.991121] JJJ2 0 0
[ 1234.025446] JJJ4 0
[ 1234.042327] !!!HHH1 soc_new_pcm 0 1
[ 1234.097295] magician-audio magician-audio: ASoC: registered pcm #1 UDA1380 Capture uda1380-hifi-capture-1
[ 1234.097362] !!!HHH2
[ 1234.116768] C1 pxa2xx_soc_pcm_new
[ 1234.134276] C2 from dma_coerce_mask_and_coherent 0
[ 1234.149297] C4capt from pxa2xx_pcm_preallocate_dma_buffer 0
[ 1234.183391] !!!HHH3 0
[ 1234.194771] !!!HHH2
[ 1234.210842] C1 pxa2xx_soc_pcm_new
[ 1234.224151] C2 from dma_coerce_mask_and_coherent 0
[ 1234.245172] C4capt from pxa2xx_pcm_preallocate_dma_buffer 0
[ 1234.271813] !!!HHH3 0
[ 1234.289025] magician-audio magician-audio: uda1380-hifi-capture <-> pxa2xx-i2s mapping ok
[ 1234.322781] JJJ7 from soc_new_pcm 0
[ 1234.326307] JJJ8 from soc_link_dai_pcm_new 0
[ 1234.331769] uda1380-codec 0-0018: Playback -> DAC
[ 1234.331861] uda1380-codec 0-0018: Left ADC -> Capture
[ 1234.331892] uda1380-codec 0-0018: Right ADC -> Capture
[ 1234.438108] uda1380-codec 0-0018: ASoC: mux Capture Mux has no paths
[ 1234.582733] D1 uda1380_sync_cache
[ 1234.626753] D2 fin
[ 1234.865116] magician_audio_probe devm_snd_soc_register_card ret=0
[ 1234.897584] magician_audio_probe ALL OK
[ 1237.759360] K1 magician_set_hp
[ 1237.775295] L1 magician_set_spk 1
[ 1237.804672] M1 magician_set_input
========
cat /dev/urandom | aplay -
========
[ 1288.126302] W1 pxa_ssp_startup
[ 1288.137893] W2
[ 1288.157093] W3
[ 1288.174632] W4 fin 0
[ 1288.195780] pxa2xx_pcm_open B1
[ 1288.220112] pxa2xx_pcm_open B2
[ 1288.238129] B3
[ 1288.255617] B4
[ 1288.269827] B5 fin?
[ 1288.286974] pxa2xx_pcm_open B1
[ 1288.301613] pxa2xx_pcm_open B2
[ 1288.345629] B3
[ 1288.357587] B4
[ 1288.366630] B5 fin?
[ 1288.378694] I1 magician_ext_control
[ 1288.390580] I2
[ 1288.399882] I3
[ 1288.411624] I4
[ 1288.421187] I5
[ 1288.433005] I6 fin
[ 1288.484899] ASoC: uda1380-hifi-playback <-> pxa-ssp-dai.0 info:
[ 1288.484954] ASoC: rate mask 0xde
[ 1288.484972] ASoC: min ch 1 max ch 2
[ 1288.484993] ASoC: min rate 8000 max rate 48000
[ 1288.616436] !!pxa UDC queue 1d7a7c2b
[ 1288.782892] !!pxa UDC queue 37d3a997
[ 1288.792200] J1 magician_playback_hw_params
[ 1288.808617] F1 uda1380_set_dai_fmt_playback
[ 1288.821822] F2
[ 1288.839847] F3
[ 1288.854608] F4
[ 1288.871863] F5 fin
[ 1288.881625] J2
[ 1288.896620] !!!!! pxa_ssp_set_dai_fmt 16900
[ 1288.908846] J3
[ 1288.923687] ZZZ1 pxa_ssp_set_dai_tdm_slot
[ 1288.967240] ZZZ2 00000000
[ 1288.981680] ZZZ3 00000000
[ 1288.995804] ZZZ4 0000000f
[ 1289.008651] ZZZ5 0000000f
[ 1289.025359] J4
[ 1289.042626] Y1 pxa_ssp_set_dai_sysclk
[ 1289.063637] Y2 sscr0=0000000f
[ 1289.077765] pxa2xx-ssp pxa27x-ssp.0: pxa_ssp_set_dai_sysclk id: 0, clk_id 3, freq 0
[ 1289.077813] X1 pxa_ssp_set_scr
[ 1289.092615] X2 fin
[ 1289.110028] Y3
[ 1289.150879] !!pxa UDC queue 07059cbc
[ 1289.160669] Y4 fin
[ 1289.168613] J5 fin
[ 1289.182914] H1 uda1380_pcm_hw_params
[ 1289.198760] H2
[ 1289.207622] H3
[ 1289.225398] H4 fin
[ 1289.232837] AA1 pxa_ssp_hw_params
[ 1289.248580] AA2
[ 1289.260817] V1 pxa_ssp_set_dma_params
[ 1289.270816] V2 fin
[ 1289.282628] AA3
[ 1289.298130] AA4
[ 1289.432647] !!XXX1a 4000000f
[ 1289.445771] !!XXX1b c000003f
[ 1289.455950] pxa2xx-ssp pxa27x-ssp.0: SSCR0 0xc000003f SSCR1 0x00c01d80 SSTO 0x00000000
[ 1289.456006] pxa2xx-ssp pxa27x-ssp.0: SSPSP 0x02000000 SSSR 0x0000f004 SSACD 0x00000000
[ 1289.456026] AA5
[ 1289.479644] AA6 0xc0000030
[ 1289.489192] AA7
[ 1289.501020] AA8 16000
[ 1289.516616] Z1 pxa_ssp_set_pll
[ 1289.527612] Z2
[ 1289.538644] Z3!!!!!!!!!! 16000
[ 1289.552122] AA8b -22
[ 1289.565645] AA8b rate=8000 ?= 8000
[ 1289.576081] Z1 pxa_ssp_set_pll
[ 1289.591041] Z2
[ 1289.600946] Z3!!!!!!!!!! 32842000
[ 1289.612002] Z4
[ 1289.627072] Z5 fin
[ 1289.640613] AA9
[ 1289.651643] AA10 ttsa=00000000
[ 1289.664734] pxa2xx-ssp pxa27x-ssp.0: No TDM timeslot configured
[ 1289.684614] AA11
[ 1289.694794] pxa2xx-ssp pxa27x-ssp.0: SSCR0 0xc000003f SSCR1 0x00c01d80 SSTO 0x00000000
[ 1289.694850] pxa2xx-ssp pxa27x-ssp.0: SSPSP 0x02000000 SSSR 0x0000f004 SSACD 0x00000045
[ 1289.694870] AA12 fin
[ 1289.715872] pxa2xx_pcm_hw_params A1
[ 1289.730777] pxa2xx_pcm_hw_params A2
[ 1289.746964] pxa2xx_pcm_hw_params A3
[ 1289.764105] pxa2xx_pcm_hw_params A4
[ 1289.787621] pxa2xx_pcm_hw_params A5
[ 1289.808937] pxa2xx_pcm_hw_params A6 fin
[ 1289.821969] pxa2xx_pcm_hw_params A1
[ 1289.834624] pxa2xx_pcm_hw_params A2
[ 1289.847102] pxa2xx_pcm_hw_params A3
[ 1289.861847] pxa2xx_pcm_hw_params A4
[ 1289.873620] pxa2xx_pcm_hw_params A5
[ 1289.884612] pxa2xx_pcm_hw_params A6 fin
[ 1289.913674] N1 magician_spk_power
[ 1289.921084] N2 fin
[ 1289.951169] G1 uda1380_trigger
[ 1289.953698] G2 fin
[ 1289.956020] AC1 pxa_ssp_trigger
[ 1289.958138] AB1 pxa_ssp_set_running_bit
[ 1289.960201] AB2
[ 1289.962205] AB3
[ 1289.964196] AB4
[ 1289.966155] AB5 fin
[ 1289.968095] AC2
[ 1289.970099] pxa2xx-ssp pxa27x-ssp.0: SSCR0 0xc00000bf SSCR1 0x00e01d80 SSTO 0x00000000
[ 1289.970134] pxa2xx-ssp pxa27x-ssp.0: SSPSP 0x02000000 SSSR 0x0000f804 SSACD 0x00000045
[ 1289.970151] AC3 fin 0
======
pressed ctrl+c
======
[ 1322.707977] G1 uda1380_trigger
[ 1322.710466] G2 fin
[ 1322.712555] AC1 pxa_ssp_trigger
[ 1322.714568] AB1 pxa_ssp_set_running_bit
[ 1322.716539] AB2
[ 1322.718491] AB3
[ 1322.720441] AB4
[ 1322.722369] AB5 fin
[ 1322.724301] AC2
[ 1322.726274] pxa2xx-ssp pxa27x-ssp.0: SSCR0 0xc00000bf SSCR1 0x00c01d80 SSTO 0x00000000
[ 1322.726304] pxa2xx-ssp pxa27x-ssp.0: SSPSP 0x02000000 SSSR 0x0000f804 SSACD 0x00000045
[ 1322.726316] AC3 fin 0
[ 1322.835896] CCC1 snd_pcm_release
[ 1322.848577] CCC2
[ 1322.862690] CCC3
[ 1322.872937] DDD1 snd_pcm_release_substream 1
[ 1322.925967] DDD2
[ 1322.935932] DDD3
[ 1322.950893] EEE1 soc_pcm_close
[ 1322.966994] EEE2
[ 1322.979679] EEE3
[ 1322.987889] EEE4
[ 1322.995830] EEE5
[ 1323.003925] WWW1 pxa_ssp_shutdown
[ 1323.013163] WWW2
[ 1323.022023] WWW3
[ 1323.030961] WWW4
[ 1323.041123] WWW5
[ 1323.055619] WWW6
[ 1323.066615] EEE6
[ 1323.084429] EEE7
[ 1323.090085] FFF1 soc_pcm_components_close
[ 1323.105632] FFF2 subdevice #0
[ 1323.115104] GGG1 1
[ 1323.126622] GGG2
[ 1323.140709] GGG3
[ 1323.151642] GGG4
[ 1323.162626] FFF3
[ 1323.173631] FFF2 subdevice #0
[ 1323.184653] GGG1 0
[ 1323.193024] GGG2
[ 1323.206027] ------------[ cut here ]------------
[ 1323.217886] WARNING: CPU: 0 PID: 892 at drivers/dma/dmaengine.c:788 dma_release_channel+0x44/0xa0
[ 1323.239818] chan reference count 0 != 1
[ 1323.261919] Modules linked in: snd_soc_magician snd_soc_uda1380 snd_soc_pxa2xx_i2s ppp_async ppp_generic slhc ircomm_tty(C) ircomm(C) ds2760_battery ds1wm wire usb_f_eem g_ether usb_f_rndis u_ether libcomposite btintel bluetooth drbg ecdh_generic firmware_class ads7846 ov9640 max1586 8250_pxa pxaficp_ir(C) 8250 8250_base fixed irda(C) serial_core spi_pxa2xx_platform ohci_pxa27x pxa_camera snd_soc_pxa2xx snd_soc_pxa_ssp videobuf2_dma_sg ohci_hcd snd_pxa2xx_lib v4l2_common pxa27x_udc snd_pcm_dmaengine videobuf2_memops i2c_pxa udc_core snd_soc_core videobuf2_v4l2 backlight usbcore videodev snd_pcm usb_common pwm_pxa videobuf2_common snd_timer i2c_core rtc_sa1100 snd ssp soundcore pda_power htc_pasic3 leds_gpio mfd_core led_class configfs [last unloaded: pwm_bl]
[ 1323.381942] CPU: 0 PID: 892 Comm: aplay Tainted: G         C        4.18.0-rc6-next-20180726-magician+ #16
[ 1323.402847] Hardware name: HTC Magician
[ 1323.420046] [<c0107d90>] (unwind_backtrace) from [<c010594c>] (show_stack+0x10/0x14)
[ 1323.444245] [<c010594c>] (show_stack) from [<c0111680>] (__warn+0xd4/0xec)
[ 1323.469874] [<c0111680>] (__warn) from [<c01112d0>] (warn_slowpath_fmt+0x44/0x6c)
[ 1323.495267] [<c01112d0>] (warn_slowpath_fmt) from [<c034908c>] (dma_release_channel+0x44/0xa0)
[ 1323.526012] [<c034908c>] (dma_release_channel) from [<bf330528>] (snd_dmaengine_pcm_close_release_chan+0x44/0xb1c [snd_pcm_dmaengine])
[ 1323.583125] [<bf330528>] (snd_dmaengine_pcm_close_release_chan [snd_pcm_dmaengine]) from [<bf26c29c>] (soc_pcm_components_close+0x8c/0xac [snd_soc_core])
[ 1323.630458] [<bf26c29c>] (soc_pcm_components_close [snd_soc_core]) from [<bf26c3a0>] (soc_pcm_close+0xe4/0xd44 [snd_soc_core])
[ 1323.682178] [<bf26c3a0>] (soc_pcm_close [snd_soc_core]) from [<bf167254>] (snd_pcm_release_substream+0x88/0x108 [snd_pcm])
[ 1323.729372] [<bf167254>] (snd_pcm_release_substream [snd_pcm]) from [<bf167330>] (snd_pcm_release+0x5c/0xd2c [snd_pcm])
[ 1323.778573] [<bf167330>] (snd_pcm_release [snd_pcm]) from [<c01c39e4>] (__fput+0xdc/0x1e8)
[ 1323.820098] [<c01c39e4>] (__fput) from [<c0129e7c>] (task_work_run+0xc4/0xd4)
[ 1323.868014] [<c0129e7c>] (task_work_run) from [<c01053ac>] (do_work_pending+0xc0/0xc8)
[ 1323.903237] [<c01053ac>] (do_work_pending) from [<c0101068>] (slow_work_pending+0xc/0x20)
[ 1323.939366] Exception stack(0xc2fdffb0 to 0xc2fdfff8)
[ 1323.957051] ffa0:                                     00000000 0154d1a0 01542a3c 00000000
[ 1323.992950] ffc0: 0154d150 00000000 0009283c 00000006 000003f0 0154d4c8 00000000 0154d4c8
[ 1324.028886] ffe0: b6ee7d70 bef13960 b6e547b8 b6cfe018 60000010 00000004
[ 1324.063896] ---[ end trace 547338f9f5eb52a2 ]---
[ 1324.083619] GGG3
[ 1324.109639] GGG4
[ 1324.135071] FFF3
[ 1324.163890] EEE8
[ 1324.183879] EEE9
[ 1324.201846] EEE10
[ 1324.221827] EEE11
[ 1324.248090] DDD4
[ 1324.261591] DDD5
[ 1324.281652] DDD6
[ 1324.304036] CCC4
[ 1324.320046] CCC5
[ 1324.339609] CCC6
[ 1324.359638] CCC7
[ 1324.374692] CCC8
[ 1324.391962] CCC9
Segmentation fault
[ 1324.881218] BUG: Bad rss-counter state mm:b111e1cc idx:0 val:1
[ 1324.899571] BUG: Bad rss-counter state mm:b111e1cc idx:1 val:2
[ 1325.098335] BUG: Bad page state in process sh  pfn:a2eaa
[ 1325.102496] page:c3fd7540 count:1 mapcount:0 mapping:00000000 index:0x0
[ 1325.109756] flags: 0x1100(slab|private)
[ 1325.113407] raw: 00001100 00000100 00000200 00000000 00000000 00000000 ffffc5aa 00000001
[ 1325.120606] page dumped because: PAGE_FLAGS_CHECK_AT_PREP flag set
[ 1325.127777] bad because of flags: 0x1100(slab|private)
[ 1325.131451] Modules linked in: snd_soc_magician snd_soc_uda1380 snd_soc_pxa2xx_i2s ppp_async ppp_generic slhc ircomm_tty(C) ircomm(C) ds2760_battery ds1wm wire usb_f_eem g_ether usb_f_rndis u_ether libcomposite btintel bluetooth drbg ecdh_generic firmware_class ads7846 ov9640 max1586 8250_pxa pxaficp_ir(C) 8250 8250_base fixed irda(C) serial_core spi_pxa2xx_platform ohci_pxa27x pxa_camera snd_soc_pxa2xx snd_soc_pxa_ssp videobuf2_dma_sg ohci_hcd snd_pxa2xx_lib v4l2_common pxa27x_udc snd_pcm_dmaengine videobuf2_memops i2c_pxa udc_core snd_soc_core videobuf2_v4l2 backlight usbcore videodev snd_pcm usb_common pwm_pxa videobuf2_common snd_timer i2c_core rtc_sa1100 snd ssp soundcore pda_power htc_pasic3 leds_gpio mfd_core led_class configfs [last unloaded: pwm_bl]
[ 1325.179640] CPU: 0 PID: 271 Comm: sh Tainted: G        WC        4.18.0-rc6-next-20180726-magician+ #16
[ 1325.186932] Hardware name: HTC Magician
[ 1325.190695] [<c0107d90>] (unwind_backtrace) from [<c010594c>] (show_stack+0x10/0x14)
[ 1325.198061] [<c010594c>] (show_stack) from [<c017f76c>] (bad_page+0xfc/0x134)
[ 1325.205439] [<c017f76c>] (bad_page) from [<c0182204>] (get_page_from_freelist+0x9bc/0xb2c)
[ 1325.212812] [<c0182204>] (get_page_from_freelist) from [<c0182928>] (__alloc_pages_nodemask+0xc0/0x9a4)
[ 1325.220225] [<c0182928>] (__alloc_pages_nodemask) from [<c010ef88>] (copy_process.part.3+0xe4/0x1514)
[ 1325.227857] [<c010ef88>] (copy_process.part.3) from [<c0110510>] (_do_fork+0xb8/0x368)
[ 1325.235679] [<c0110510>] (_do_fork) from [<c0110880>] (sys_clone+0x1c/0x24)
[ 1325.243748] [<c0110880>] (sys_clone) from [<c0101000>] (ret_fast_syscall+0x0/0x50)
[ 1325.252081] Exception stack(0xc3beffa8 to 0xc3befff0)
[ 1325.256407] ffa0:                   b6f77208 bec2b9c0 01200011 00000000 00000000 00000000
[ 1325.265144] ffc0: b6f77208 bec2b9c0 00000000 00000078 b6f77660 00000000 b6ee2000 bec2b9ec
[ 1325.274152] ffe0: b6f771a0 bec2b9c0 b6e3b3b4 b6e3b460
[ 1325.278804] Disabling lock debugging due to kernel taint
[ 1329.399835]  uda1380_playback: ASoC: pop wq checking: Playback status: inactive waiting: yes
[ 1329.405064] N1 magician_spk_power
[ 1329.424527] N2 fin

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#3 lore raw

Hi Petr,

Quoted 11 lines · Petr Cvek

Dne 8.8.2018 v 07:38 Daniel Mack napsal(a):

I was planning to send patches before I've found regressions in the current -next.

I think I've had the first working version somewhere around 3.13, but I was updating versions only sporadically and fixing audio had low priority (higher priority got iwmmxt compiler, platform init source code, charger, USB, MMC and IrDA). Some versions until now worked, some didn't.

Quoted 3 lines

The last version I've used and where the sound worked was 4.14.0-rc7-next from somewhere around 3rd November 2017. The patch for sound subsystem should be the same as the current one.

That's strange, because as I said, the SSP rework went in in 4.0, so without my regression fix (737e370a57e4e8 "ASoC: pxa-ssp: allow more flexible setup order"), I doubt SSP had worked for you.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

3) setup fails

Recent changes in ASoC PXA DMA are causing a fail of a condition in pxa_ssp_hw_params():

????if ((sscr0 & SSCR0_MOD) && !ttsa) {

Quoted 8 lines
Quoted 3 lines

What are the values of sscr0 and ttsa in your case? Can you cross-check that with a kernel that doesn't have my recent changes?

-> full values in the attached log (the flag is set in the switch case and ttsa is zeroed)

On 4.14 (not sure, if it is the correct SSP controller)

Hmm, why shouldn't it be the correct one? And do you hear sound with that 4.14 setup?

Quoted 37 lines

Idle:

SSCR0:

	# devmem 0x41000000 32
	0x4000003F <- 31 bit is SSCR0_MOD
SSCR1:
	# devmem 0x41000004 32
	0x00C01D80
SSTSA:
	# devmem 0x41000030 32
	0x00000000 <- is "ttsa" variable
SSRSA:
	# devmem 0x41000034 32
	0x00000000
SSTSS:
	# devmem 0x41000038 32
	0x00000000

Playing noise:

SSCR0:

	# devmem 0x41000000 32
	0x400000BF <- 31 bit is SSCR0_MOD
SSCR1:
	# devmem 0x41000004 32
	0x00E01D80
SSTSA:
	# devmem 0x41000030 32
	0x00000000 <- is "ttsa" variable
SSRSA:
	# devmem 0x41000034 32
	0x00000000
SSTSS:
	# devmem 0x41000038 32
	0x00000000
Quoted 1 line

.. so the time slots are correctly disabled.

The idea was to compare a working against a non-working setup to spot the differences in the register settings.

If recent mainline versions have worked for you (modulo some minor modifications), I think one good way forward could be to bisect the problems and make the platform work for 4.18 again. Then, see if any of the recent ASoC/DMA related PXA patches break it again.

Sorry for the trouble, but without hardware, these things are hard to reproduce on my side.

Let me know if I can help further, but not that my resources are a bit limited in the next weeks.

Thanks,
Daniel

author
#4 lore raw

Dne 13.8.2018 v 07:54 Daniel Mack napsal(a):

Quoted 14 lines

Hi Petr,

Quoted 11 lines · Petr Cvek

Dne 8.8.2018 v 07:38 Daniel Mack napsal(a):

I was planning to send patches before I've found regressions in the current -next.

I think I've had the first working version somewhere around 3.13, but I was updating versions only sporadically and fixing audio had low priority (higher priority got iwmmxt compiler, platform init source code, charger, USB, MMC and IrDA). Some versions until now worked, some didn't.

Quoted 8 lines
Quoted 3 lines

The last version I've used and where the sound worked was 4.14.0-rc7-next from somewhere around 3rd November 2017. The patch for sound subsystem should be the same as the current one.

That's strange, because as I said, the SSP rework went in in 4.0, so without my regression fix (737e370a57e4e8 "ASoC: pxa-ssp: allow more flexible setup order"), I doubt SSP had worked for you.

OK I found the problem I've had compiled and load (on both v4.14 and v4.18) snd-soc-pxa2xx driver (from linux/sound/arm/pxa2xx-pcm.c). This component calls pxa2xx_soc_pcm_new() which is already called by snd_soc_pxa_ssp (pxa-ssp-dai.0) or snd_soc_pxa2xx_i2s (pxa2xx-i2s). In the function the dma gets registered twice, which is a wrong behavior (kernel oops on DMA stopping). Without snd-soc-pxa2xx driver loaded the playback works (after the rest of my patches) so it seems in the old version DMA wasn't registered twice.

So the easy solution for snd_soc_pxa_ssp OR snd_soc_pxa2xx_i2s would be a mutual exclusivity with snd_soc_pxa_ssp. I don't know about other users, but I can add a condition to magician Kconfig entry.

Best regards,
Petr