Skip to contentSkip to conversation

ASoC: Intel: Skylake: Fix suspend issues

PATCH In review Vinod Koul 3 participants 19 messages Nov 23, 2015 – Jan 10, 2016

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

cover ASoC: Intel: Skylake: Fix suspend issues

While testing legacy Suspend on Skylake, we found few issues that require driver changes. This was tested with usermode apps and aplay.

We need to add RESUME capability in driver to let ALSA resume us, then HDA was not getting reconfigured upon resume so that is updated. CLDMA needs to be polled as that takes a little while like HDA DMA, also clear of registers is required per spec upon setup

Last one fixes resource leak upon failures by movng free call up (not related to suspend though but observed when we saw failures)

Jeeja KP (6):
ASoC: Intel: Skylake: Add Resume capability in PCM info.
ASoC: Intel: Skylake: Reconfigure HDA stream register in
prepare/resume
ASoC: Intel: Skylake: Fix to update bit depth for module params
ASoC: Intel: Skylake: Add pcm capability to support 16/8k rates.
ASoC: Intel: Skylake: Poll CLDMA RUN bit when set
ASoC: Intel: Skylake: Clear stream registers before setting up stream

Vinod Koul (1):
ASoC: Intel: Skylake: Move up pipe mem free

 sound/soc/intel/skylake/skl-pcm.c       | 22 +++++----
 sound/soc/intel/skylake/skl-sst-cldma.c | 82 +++++++++++++++++++++------------
 sound/soc/intel/skylake/skl-topology.c  | 22 +++++++--
 3 files changed, 86 insertions(+), 40 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/7 ASoC: Intel: Skylake: Add Resume capability in PCM info.

From: Jeeja KP <[email protected]>

This patch adds pcm capability to support Resume.

---
 sound/soc/intel/skylake/skl-pcm.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/intel/skylake/skl-pcm.c +1 -0
index dae332beea3f..4378bf452582 100644
@@ -35,6 +35,7 @@ static struct snd_pcm_hardware azx_pcm_hw = {
 				 SNDRV_PCM_INFO_BLOCK_TRANSFER |
 				 SNDRV_PCM_INFO_MMAP_VALID |
 				 SNDRV_PCM_INFO_PAUSE |
+				 SNDRV_PCM_INFO_RESUME |
 				 SNDRV_PCM_INFO_SYNC_START |
 				 SNDRV_PCM_INFO_HAS_WALL_CLOCK | /* legacy */
 				 SNDRV_PCM_INFO_HAS_LINK_ATIME |
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 1/7] ASoC: Intel: Skylake: Add Resume capability in PCM info.

Quoted 4 lines · Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds pcm capability to support Resume.

The flag indicates that the driver is capable of the full resume -- i.e. it must resume everything at the exactly same point to be suspended. Is it really the case?

If it's not and it's instead a kind of restart of streams, don't add this flag. The lack of the flag doesn't mean that the driver can't resume at all.

Takashi

Quoted 27 lines
---
 sound/soc/intel/skylake/skl-pcm.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/intel/skylake/skl-pcm.c +1 -0
index dae332beea3f..4378bf452582 100644
@@ -35,6 +35,7 @@ static struct snd_pcm_hardware azx_pcm_hw = {
 				 SNDRV_PCM_INFO_BLOCK_TRANSFER |
 				 SNDRV_PCM_INFO_MMAP_VALID |
 				 SNDRV_PCM_INFO_PAUSE |
+				 SNDRV_PCM_INFO_RESUME |
 				 SNDRV_PCM_INFO_SYNC_START |
 				 SNDRV_PCM_INFO_HAS_WALL_CLOCK | /* legacy */
 				 SNDRV_PCM_INFO_HAS_LINK_ATIME |
Signature · 6 lines
1.9.1

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
author
#3 lore raw

Re: [PATCH 1/7] ASoC: Intel: Skylake: Add Resume capability in PCM info.

Quoted 7 lines · Takashi Iwai
Quoted 4 lines · Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds pcm capability to support Resume.

Quoted 7 lines

The flag indicates that the driver is capable of the full resume -- i.e. it must resume everything at the exactly same point to be suspended. Is it really the case?

If it's not and it's instead a kind of restart of streams, don't add this flag. The lack of the flag doesn't mean that the driver can't resume at all.

Yes, with this patch series we are able to resume from previous position.

Here is my test:

# aplay -Dhw:0,0 play.wav
Playing WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz,
Stereo
Suspended. Trying resume. Done.

Thanks

Signature · 1 line
~Vinod
#4 lore raw

Re: [PATCH 1/7] ASoC: Intel: Skylake: Add Resume capability in PCM info.

Quoted 13 lines · Vinod Koul
Quoted 11 lines · Takashi Iwai
Quoted 4 lines · Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds pcm capability to support Resume.

The flag indicates that the driver is capable of the full resume -- i.e. it must resume everything at the exactly same point to be suspended. Is it really the case?

Quoted 5 lines
Quoted 3 lines

If it's not and it's instead a kind of restart of streams, don't add this flag. The lack of the flag doesn't mean that the driver can't resume at all.

Yes, with this patch series we are able to resume from previous position.

I suppose you tested hibernation, too?
How does it assure that the in-flight data on FIFO are restored after the link reset and re-prepare?

Quoted 6 lines

Here is my test:

# aplay -Dhw:0,0 play.wav
Playing WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz,
Stereo
Suspended. Trying resume. Done.

As mentioned, the resume usually works (sort of), even without SNDRV_PCM_INFO_RESUME bit. It's because alsa-lib tries to re-prepare the stuff by itself.

Did you try only the patch 2 without this patch?

Takashi

author
#5 lore raw

Re: [PATCH 1/7] ASoC: Intel: Skylake: Add Resume capability in PCM info.

Quoted 15 lines · Takashi Iwai
Quoted 13 lines · Vinod Koul
Quoted 11 lines · Takashi Iwai
Quoted 4 lines · Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds pcm capability to support Resume.

The flag indicates that the driver is capable of the full resume -- i.e. it must resume everything at the exactly same point to be suspended. Is it really the case?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

If it's not and it's instead a kind of restart of streams, don't add this flag. The lack of the flag doesn't mean that the driver can't resume at all.

Yes, with this patch series we are able to resume from previous position.

I suppose you tested hibernation, too?

No, only suspend and freeze

Quoted 2 lines

How does it assure that the in-flight data on FIFO are restored after the link reset and re-prepare?

SKL has DMA resume capability, so we can restore the registers, Jeeja is preparing those patches and we should be able to send those shortly :)

Quoted 7 lines
Quoted 6 lines

Here is my test:

# aplay -Dhw:0,0 play.wav
Playing WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz,
Stereo
Suspended. Trying resume. Done.
Quoted 5 lines

As mentioned, the resume usually works (sort of), even without SNDRV_PCM_INFO_RESUME bit. It's because alsa-lib tries to re-prepare the stuff by itself.

Did you try only the patch 2 without this patch?

Yes Jeeja did that and in that case it does prepare and resumes

Signature · 1 line
~Vinod
#6 lore raw

Re: [PATCH 1/7] ASoC: Intel: Skylake: Add Resume capability in PCM info.

Quoted 25 lines · Vinod Koul
Quoted 15 lines · Takashi Iwai
Quoted 13 lines · Vinod Koul
Quoted 11 lines · Takashi Iwai
Quoted 4 lines · Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds pcm capability to support Resume.

The flag indicates that the driver is capable of the full resume -- i.e. it must resume everything at the exactly same point to be suspended. Is it really the case?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

If it's not and it's instead a kind of restart of streams, don't add this flag. The lack of the flag doesn't mean that the driver can't resume at all.

Yes, with this patch series we are able to resume from previous position.

I suppose you tested hibernation, too?

Quoted 7 lines

No, only suspend and freeze

Quoted 2 lines

How does it assure that the in-flight data on FIFO are restored after the link reset and re-prepare?

SKL has DMA resume capability, so we can restore the registers, Jeeja is preparing those patches and we should be able to send those shortly :)

Well, the question is about hibernation. Then the in-flight data on the device is basically gone, and we can handle only the remaining CPU data. If your DMA can do that, it's fine, we can go in that way.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Here is my test:

# aplay -Dhw:0,0 play.wav
Playing WAVE 'play.wav' : Signed 16 bit Little Endian, Rate 48000 Hz,
Stereo
Suspended. Trying resume. Done.
Quoted 7 lines
Quoted 5 lines

As mentioned, the resume usually works (sort of), even without SNDRV_PCM_INFO_RESUME bit. It's because alsa-lib tries to re-prepare the stuff by itself.

Did you try only the patch 2 without this patch?

Yes Jeeja did that and in that case it does prepare and resumes

That's the expected result. As a fallback, user-space expects prepares and restarts.

Takashi

maintainer
#7 lore raw

Applied "ASoC: Intel: Skylake: Add Resume capability in PCM info." to the asoc tree

In reply to Vinod Koul

The patch

ASoC: Intel: Skylake: Add Resume capability in PCM info.

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 3637976b8975afb0a55a1fc88a2c320a2839a9da Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Fri, 18 Dec 2015 15:12:09 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Add Resume capability in PCM info.

This patch adds pcm capability to support Resume.

---
 sound/soc/intel/skylake/skl-pcm.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/intel/skylake/skl-pcm.c +1 -0
index 17a64362b283..f3553258091a 100644
@@ -38,6 +38,7 @@ static struct snd_pcm_hardware azx_pcm_hw = {
 				 SNDRV_PCM_INFO_BLOCK_TRANSFER |
 				 SNDRV_PCM_INFO_MMAP_VALID |
 				 SNDRV_PCM_INFO_PAUSE |
+				 SNDRV_PCM_INFO_RESUME |
 				 SNDRV_PCM_INFO_SYNC_START |
 				 SNDRV_PCM_INFO_HAS_WALL_CLOCK | /* legacy */
 				 SNDRV_PCM_INFO_HAS_LINK_ATIME |
Signature · 1 line
2.7.0.rc3
author
#8 lore raw

PATCH 2/7 ASoC: Intel: Skylake: Reconfigure HDA stream register in prepare/resume

In reply to Vinod Koul

From: Jeeja KP <[email protected]>

PCM prepare callbacks can be called multiple times. During S3 the stream registers will be reset when Controller is reset. When stream is resumed, these stream registers needs to reconfigured.

This patch removes the check in prepare callback() if stream already prepared, which will allow reconfiguring of stream registers and also decouple stream when stream is resumed to route audio via DSP.

---
 sound/soc/intel/skylake/skl-pcm.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +7 -5
index 4378bf452582..43944aff8dcb 100644
@@ -182,10 +182,6 @@ static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 	int err;
 
 	dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
-	if (hdac_stream(stream)->prepared) {
-		dev_dbg(dai->dev, "already stream is prepared - returning\n");
-		return 0;
-	}
 
 	format_val = skl_get_format(substream, dai);
 	dev_dbg(dai->dev, "stream_tag=%d formatvalue=%d\n",
@@ -343,6 +339,8 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct skl *skl = get_skl_ctx(dai->dev);
 	struct skl_sst *ctx = skl->skl_sst;
 	struct skl_module_cfg *mconfig;
+	struct hdac_ext_bus *ebus = get_bus_ctx(substream);
+	struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
 	int ret;
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
@@ -350,15 +348,17 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 		return -EIO;
 
 	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_RESUME:
+		skl_pcm_prepare(substream, dai);
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-	case SNDRV_PCM_TRIGGER_RESUME:
 		/*
 		 * Start HOST DMA and Start FE Pipe.This is to make sure that
 		 * there are no underrun/overrun in the case when the FE
 		 * pipeline is started but there is a delay in starting the
 		 * DMA channel on the host.
 		 */
+		snd_hdac_ext_stream_decouple(ebus, stream, true);
 		ret = skl_decoupled_trigger(substream, cmd);
 		if (ret < 0)
 			return ret;
@@ -378,6 +378,8 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 			return ret;
 
 		ret = skl_decoupled_trigger(substream, cmd);
+		if (cmd == SNDRV_PCM_TRIGGER_SUSPEND)
+			snd_hdac_ext_stream_decouple(ebus, stream, false);
 		break;
 
 	default:
Signature · 1 line
1.9.1
maintainer
#9 lore raw

Applied "ASoC: Intel: Skylake: Reconfigure HDA stream register in prepare/resume" to the asoc tree

The patch

ASoC: Intel: Skylake: Reconfigure HDA stream register in prepare/resume

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 7e3a17d311ca89a74cfd39e02e96d29d92849d34 Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 23 Nov 2015 22:26:24 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Reconfigure HDA stream register in
prepare/resume

PCM prepare callbacks can be called multiple times. During S3 the stream registers will be reset when Controller is reset. When stream is resumed, these stream registers needs to reconfigured.

This patch removes the check in prepare callback() if stream already prepared, which will allow reconfiguring of stream registers and also decouple stream when stream is resumed to route audio via DSP.

---
 sound/soc/intel/skylake/skl-pcm.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +7 -5
index dae332beea3f..3c891d78ba58 100644
@@ -181,10 +181,6 @@ static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 	int err;
 
 	dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
-	if (hdac_stream(stream)->prepared) {
-		dev_dbg(dai->dev, "already stream is prepared - returning\n");
-		return 0;
-	}
 
 	format_val = skl_get_format(substream, dai);
 	dev_dbg(dai->dev, "stream_tag=%d formatvalue=%d\n",
@@ -342,6 +338,8 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct skl *skl = get_skl_ctx(dai->dev);
 	struct skl_sst *ctx = skl->skl_sst;
 	struct skl_module_cfg *mconfig;
+	struct hdac_ext_bus *ebus = get_bus_ctx(substream);
+	struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
 	int ret;
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
@@ -349,15 +347,17 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 		return -EIO;
 
 	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_RESUME:
+		skl_pcm_prepare(substream, dai);
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-	case SNDRV_PCM_TRIGGER_RESUME:
 		/*
 		 * Start HOST DMA and Start FE Pipe.This is to make sure that
 		 * there are no underrun/overrun in the case when the FE
 		 * pipeline is started but there is a delay in starting the
 		 * DMA channel on the host.
 		 */
+		snd_hdac_ext_stream_decouple(ebus, stream, true);
 		ret = skl_decoupled_trigger(substream, cmd);
 		if (ret < 0)
 			return ret;
@@ -377,6 +377,8 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 			return ret;
 
 		ret = skl_decoupled_trigger(substream, cmd);
+		if (cmd == SNDRV_PCM_TRIGGER_SUSPEND)
+			snd_hdac_ext_stream_decouple(ebus, stream, false);
 		break;
 
 	default:
Signature · 1 line
2.6.2
author
#10 lore raw

PATCH 3/7 ASoC: Intel: Skylake: Fix to update bit depth for module params

In reply to Vinod Koul

From: Jeeja KP <[email protected]>

Module hw param fixup will change the valid bit depth based on the fixup flag. If valid bit depth changes, need to set the bit depth according to valid bit depth. This patch fixes this issue of updating bit depth correctly.

---
 sound/soc/intel/skylake/skl-topology.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-topology.c +18 -2
index 0937ea2129c1..698c4aa03933 100644
@@ -147,8 +147,24 @@ static void skl_tplg_update_params(struct skl_module_fmt *fmt,
 		fmt->s_freq = params->s_freq;
 	if (fixup & SKL_CH_FIXUP_MASK)
 		fmt->channels = params->ch;
-	if (fixup & SKL_FMT_FIXUP_MASK)
-		fmt->valid_bit_depth = params->s_fmt;
+	if (fixup & SKL_FMT_FIXUP_MASK) {
+		fmt->valid_bit_depth = skl_get_bit_depth(params->s_fmt);
+
+		/*
+		 * 16 bit is 16 bit container whereas 24 bit is in 32 bit
+		 * container so update bit depth accordingly
+		 */
+		switch (fmt->valid_bit_depth) {
+		case SKL_DEPTH_16BIT:
+			fmt->bit_depth = fmt->valid_bit_depth;
+			break;
+
+		default:
+			fmt->bit_depth = SKL_DEPTH_32BIT;
+			break;
+		}
+	}
+
 }
 
 /*
Signature · 1 line
1.9.1
maintainer
#11 lore raw

Applied "ASoC: Intel: Skylake: Fix to update bit depth for module params" to the asoc tree

The patch

ASoC: Intel: Skylake: Fix to update bit depth for module params

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 98256f83d2895fda3e596824797762937ab79f6b Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 23 Nov 2015 22:26:25 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Fix to update bit depth for module
params

Module hw param fixup will change the valid bit depth based on the fixup flag. If valid bit depth changes, need to set the bit depth according to valid bit depth. This patch fixes this issue of updating bit depth correctly.

---
 sound/soc/intel/skylake/skl-topology.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-topology.c +18 -2
index 0937ea2129c1..698c4aa03933 100644
@@ -147,8 +147,24 @@ static void skl_tplg_update_params(struct skl_module_fmt *fmt,
 		fmt->s_freq = params->s_freq;
 	if (fixup & SKL_CH_FIXUP_MASK)
 		fmt->channels = params->ch;
-	if (fixup & SKL_FMT_FIXUP_MASK)
-		fmt->valid_bit_depth = params->s_fmt;
+	if (fixup & SKL_FMT_FIXUP_MASK) {
+		fmt->valid_bit_depth = skl_get_bit_depth(params->s_fmt);
+
+		/*
+		 * 16 bit is 16 bit container whereas 24 bit is in 32 bit
+		 * container so update bit depth accordingly
+		 */
+		switch (fmt->valid_bit_depth) {
+		case SKL_DEPTH_16BIT:
+			fmt->bit_depth = fmt->valid_bit_depth;
+			break;
+
+		default:
+			fmt->bit_depth = SKL_DEPTH_32BIT;
+			break;
+		}
+	}
+
 }
 
 /*
Signature · 1 line
2.6.2
author
#12 lore raw

PATCH 4/7 ASoC: Intel: Skylake: Update pcm capability

In reply to Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds pcm capability to support 16/8k rates and 32 bit formats

---
 sound/soc/intel/skylake/skl-pcm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +6 -3
index 43944aff8dcb..787fd3c0cc4e 100644
@@ -40,9 +40,12 @@ static struct snd_pcm_hardware azx_pcm_hw = {
 				 SNDRV_PCM_INFO_HAS_WALL_CLOCK | /* legacy */
 				 SNDRV_PCM_INFO_HAS_LINK_ATIME |
 				 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP),
-	.formats =		SNDRV_PCM_FMTBIT_S16_LE,
-	.rates =		SNDRV_PCM_RATE_48000,
-	.rate_min =		48000,
+	.formats =		SNDRV_PCM_FMTBIT_S16_LE |
+				SNDRV_PCM_FMTBIT_S32_LE |
+				SNDRV_PCM_FMTBIT_S24_LE,
+	.rates =		SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000 |
+				SNDRV_PCM_RATE_8000,
+	.rate_min =		8000,
 	.rate_max =		48000,
 	.channels_min =		2,
 	.channels_max =		2,
Signature · 1 line
1.9.1
maintainer
#13 lore raw

Applied "ASoC: Intel: Skylake: Update pcm capability" to the asoc tree

The patch

ASoC: Intel: Skylake: Update pcm capability

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 06b23d9379d4cd034b7a5edad323ea9419ab2016 Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 23 Nov 2015 22:26:26 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Update pcm capability

This patch adds pcm capability to support 16/8k rates and 32 bit formats

---
 sound/soc/intel/skylake/skl-pcm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +6 -3
index 3c891d78ba58..c79bbff00cb7 100644
@@ -39,9 +39,12 @@ static struct snd_pcm_hardware azx_pcm_hw = {
 				 SNDRV_PCM_INFO_HAS_WALL_CLOCK | /* legacy */
 				 SNDRV_PCM_INFO_HAS_LINK_ATIME |
 				 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP),
-	.formats =		SNDRV_PCM_FMTBIT_S16_LE,
-	.rates =		SNDRV_PCM_RATE_48000,
-	.rate_min =		48000,
+	.formats =		SNDRV_PCM_FMTBIT_S16_LE |
+				SNDRV_PCM_FMTBIT_S32_LE |
+				SNDRV_PCM_FMTBIT_S24_LE,
+	.rates =		SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000 |
+				SNDRV_PCM_RATE_8000,
+	.rate_min =		8000,
 	.rate_max =		48000,
 	.channels_min =		2,
 	.channels_max =		2,
Signature · 1 line
2.6.2
author
#14 lore raw

PATCH 5/7 ASoC: Intel: Skylake: Poll CLDMA RUN bit when set

In reply to Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds polling of CLDMA stream run bit when set to confirm the HW reports the same value.

---
 sound/soc/intel/skylake/skl-sst-cldma.c | 43 ++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 14 deletions(-)
sound/soc/intel/skylake/skl-sst-cldma.c +29 -14
index b03d9db0acad..faaa852ed015 100644
@@ -18,6 +18,7 @@
 #include <linux/device.h>
 #include <linux/mm.h>
 #include <linux/kthread.h>
+#include <linux/delay.h>
 #include "../common/sst-dsp.h"
 #include "../common/sst-dsp-priv.h"
 
@@ -33,6 +34,32 @@ void skl_cldma_int_disable(struct sst_dsp *ctx)
 			SKL_ADSP_REG_ADSPIC, SKL_ADSPIC_CL_DMA, 0);
 }
 
+static void skl_cldma_stream_run(struct sst_dsp  *ctx, bool enable)
+{
+	unsigned char val;
+	int timeout;
+
+	sst_dsp_shim_update_bits_unlocked(ctx,
+			SKL_ADSP_REG_CL_SD_CTL,
+			CL_SD_CTL_RUN_MASK, CL_SD_CTL_RUN(enable));
+
+	udelay(3);
+	timeout = 300;
+	do {
+		/* waiting for hardware to report that the stream Run bit set */
+		val = sst_dsp_shim_read(ctx, SKL_ADSP_REG_CL_SD_CTL) &
+			CL_SD_CTL_RUN_MASK;
+		if (enable && val)
+			break;
+		else if (!enable && !val)
+			break;
+		udelay(3);
+	} while (--timeout);
+
+	if (timeout == 0)
+		dev_err(ctx->dev, "Failed to set Run bit=%d enable=%d\n", val, enable);
+}
+
 /* Code loader helper APIs */
 static void skl_cldma_setup_bdle(struct sst_dsp *ctx,
 		struct snd_dma_buffer *dmab_data,
@@ -107,18 +134,6 @@ static void skl_cldma_cleanup_spb(struct sst_dsp  *ctx)
 	sst_dsp_shim_write_unlocked(ctx, SKL_ADSP_REG_CL_SPBFIFO_SPIB, 0);
 }
 
-static void skl_cldma_trigger(struct sst_dsp  *ctx, bool enable)
-{
-	if (enable)
-		sst_dsp_shim_update_bits_unlocked(ctx,
-			SKL_ADSP_REG_CL_SD_CTL,
-			CL_SD_CTL_RUN_MASK, CL_SD_CTL_RUN(1));
-	else
-		sst_dsp_shim_update_bits_unlocked(ctx,
-			SKL_ADSP_REG_CL_SD_CTL,
-			CL_SD_CTL_RUN_MASK, CL_SD_CTL_RUN(0));
-}
-
 static void skl_cldma_cleanup(struct sst_dsp  *ctx)
 {
 	skl_cldma_cleanup_spb(ctx);
@@ -169,7 +184,7 @@ cleanup:
 
 static void skl_cldma_stop(struct sst_dsp *ctx)
 {
-	ctx->cl_dev.ops.cl_trigger(ctx, false);
+	skl_cldma_stream_run(ctx, false);
 }
 
 static void skl_cldma_fill_buffer(struct sst_dsp *ctx, unsigned int size,
@@ -311,7 +326,7 @@ int skl_cldma_prepare(struct sst_dsp *ctx)
 	ctx->cl_dev.ops.cl_setup_controller = skl_cldma_setup_controller;
 	ctx->cl_dev.ops.cl_setup_spb = skl_cldma_setup_spb;
 	ctx->cl_dev.ops.cl_cleanup_spb = skl_cldma_cleanup_spb;
-	ctx->cl_dev.ops.cl_trigger = skl_cldma_trigger;
+	ctx->cl_dev.ops.cl_trigger = skl_cldma_stream_run;
 	ctx->cl_dev.ops.cl_cleanup_controller = skl_cldma_cleanup;
 	ctx->cl_dev.ops.cl_copy_to_dmabuf = skl_cldma_copy_to_buf;
 	ctx->cl_dev.ops.cl_stop_dma = skl_cldma_stop;
Signature · 1 line
1.9.1
maintainer
#15 lore raw

Applied "ASoC: Intel: Skylake: Poll CLDMA RUN bit when set" to the asoc tree

The patch

ASoC: Intel: Skylake: Poll CLDMA RUN bit when set

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 2434caf098588856d1c332d2f60b8a2d8a198450 Mon Sep 17 00:00:00 2001

From: Jeeja KP <[email protected]>
Date: Mon, 23 Nov 2015 22:26:27 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Poll CLDMA RUN bit when set

This patch adds polling of CLDMA stream run bit when set to confirm the HW reports the same value.

---
 sound/soc/intel/skylake/skl-sst-cldma.c | 43 ++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 14 deletions(-)
sound/soc/intel/skylake/skl-sst-cldma.c +29 -14
index 947a08e42e86..8c7e8576cba3 100644
@@ -18,6 +18,7 @@
 #include <linux/device.h>
 #include <linux/mm.h>
 #include <linux/kthread.h>
+#include <linux/delay.h>
 #include "../common/sst-dsp.h"
 #include "../common/sst-dsp-priv.h"
 
@@ -33,6 +34,32 @@ void skl_cldma_int_disable(struct sst_dsp *ctx)
 			SKL_ADSP_REG_ADSPIC, SKL_ADSPIC_CL_DMA, 0);
 }
 
+static void skl_cldma_stream_run(struct sst_dsp  *ctx, bool enable)
+{
+	unsigned char val;
+	int timeout;
+
+	sst_dsp_shim_update_bits_unlocked(ctx,
+			SKL_ADSP_REG_CL_SD_CTL,
+			CL_SD_CTL_RUN_MASK, CL_SD_CTL_RUN(enable));
+
+	udelay(3);
+	timeout = 300;
+	do {
+		/* waiting for hardware to report that the stream Run bit set */
+		val = sst_dsp_shim_read(ctx, SKL_ADSP_REG_CL_SD_CTL) &
+			CL_SD_CTL_RUN_MASK;
+		if (enable && val)
+			break;
+		else if (!enable && !val)
+			break;
+		udelay(3);
+	} while (--timeout);
+
+	if (timeout == 0)
+		dev_err(ctx->dev, "Failed to set Run bit=%d enable=%d\n", val, enable);
+}
+
 /* Code loader helper APIs */
 static void skl_cldma_setup_bdle(struct sst_dsp *ctx,
 		struct snd_dma_buffer *dmab_data,
@@ -107,18 +134,6 @@ static void skl_cldma_cleanup_spb(struct sst_dsp  *ctx)
 	sst_dsp_shim_write_unlocked(ctx, SKL_ADSP_REG_CL_SPBFIFO_SPIB, 0);
 }
 
-static void skl_cldma_trigger(struct sst_dsp  *ctx, bool enable)
-{
-	if (enable)
-		sst_dsp_shim_update_bits_unlocked(ctx,
-			SKL_ADSP_REG_CL_SD_CTL,
-			CL_SD_CTL_RUN_MASK, CL_SD_CTL_RUN(1));
-	else
-		sst_dsp_shim_update_bits_unlocked(ctx,
-			SKL_ADSP_REG_CL_SD_CTL,
-			CL_SD_CTL_RUN_MASK, CL_SD_CTL_RUN(0));
-}
-
 static void skl_cldma_cleanup(struct sst_dsp  *ctx)
 {
 	skl_cldma_cleanup_spb(ctx);
@@ -167,7 +182,7 @@ cleanup:
 
 static void skl_cldma_stop(struct sst_dsp *ctx)
 {
-	ctx->cl_dev.ops.cl_trigger(ctx, false);
+	skl_cldma_stream_run(ctx, false);
 }
 
 static void skl_cldma_fill_buffer(struct sst_dsp *ctx, unsigned int size,
@@ -309,7 +324,7 @@ int skl_cldma_prepare(struct sst_dsp *ctx)
 	ctx->cl_dev.ops.cl_setup_controller = skl_cldma_setup_controller;
 	ctx->cl_dev.ops.cl_setup_spb = skl_cldma_setup_spb;
 	ctx->cl_dev.ops.cl_cleanup_spb = skl_cldma_cleanup_spb;
-	ctx->cl_dev.ops.cl_trigger = skl_cldma_trigger;
+	ctx->cl_dev.ops.cl_trigger = skl_cldma_stream_run;
 	ctx->cl_dev.ops.cl_cleanup_controller = skl_cldma_cleanup;
 	ctx->cl_dev.ops.cl_copy_to_dmabuf = skl_cldma_copy_to_buf;
 	ctx->cl_dev.ops.cl_stop_dma = skl_cldma_stop;
Signature · 1 line
2.6.2
author
#16 lore raw

PATCH 6/7 ASoC: Intel: Skylake: Clear stream registers before setting up stream

In reply to Vinod Koul

From: Jeeja KP <[email protected]>

This patch adds clean up routine to clear the stream registers and calls this routine before setting up stream registers.

---
 sound/soc/intel/skylake/skl-sst-cldma.c | 39 ++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 15 deletions(-)
sound/soc/intel/skylake/skl-sst-cldma.c +24 -15
index faaa852ed015..b845c3acd3eb 100644
@@ -60,6 +60,28 @@ static void skl_cldma_stream_run(struct sst_dsp  *ctx, bool enable)
 		dev_err(ctx->dev, "Failed to set Run bit=%d enable=%d\n", val, enable);
 }
 
+static void skl_cldma_stream_clear(struct sst_dsp  *ctx)
+{
+	/* make sure Run bit is cleared before setting stream register */
+	skl_cldma_stream_run(ctx, 0);
+
+	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
+				CL_SD_CTL_IOCE_MASK, CL_SD_CTL_IOCE(0));
+	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
+				CL_SD_CTL_FEIE_MASK, CL_SD_CTL_FEIE(0));
+	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
+				CL_SD_CTL_DEIE_MASK, CL_SD_CTL_DEIE(0));
+	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
+				CL_SD_CTL_STRM_MASK, CL_SD_CTL_STRM(0));
+
+	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPL, CL_SD_BDLPLBA(0));
+	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPU, 0);
+
+	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_CBL, 0);
+	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_LVI, 0);
+}
+
+
 /* Code loader helper APIs */
 static void skl_cldma_setup_bdle(struct sst_dsp *ctx,
 		struct snd_dma_buffer *dmab_data,
@@ -95,6 +117,7 @@ static void skl_cldma_setup_controller(struct sst_dsp  *ctx,
 		struct snd_dma_buffer *dmab_bdl, unsigned int max_size,
 		u32 count)
 {
+	skl_cldma_stream_clear(ctx);
 	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPL,
 			CL_SD_BDLPLBA(dmab_bdl->addr));
 	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPU,
@@ -137,21 +160,7 @@ static void skl_cldma_cleanup_spb(struct sst_dsp  *ctx)
 static void skl_cldma_cleanup(struct sst_dsp  *ctx)
 {
 	skl_cldma_cleanup_spb(ctx);
-
-	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
-				CL_SD_CTL_IOCE_MASK, CL_SD_CTL_IOCE(0));
-	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
-				CL_SD_CTL_FEIE_MASK, CL_SD_CTL_FEIE(0));
-	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
-				CL_SD_CTL_DEIE_MASK, CL_SD_CTL_DEIE(0));
-	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_CL_SD_CTL,
-				CL_SD_CTL_STRM_MASK, CL_SD_CTL_STRM(0));
-
-	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPL, CL_SD_BDLPLBA(0));
-	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_BDLPU, 0);
-
-	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_CBL, 0);
-	sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_LVI, 0);
+	skl_cldma_stream_clear(ctx);
 
 	if (&ctx->cl_dev.dmab_data)
 		ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data);
Signature · 1 line
1.9.1
author
#17 lore raw

PATCH 7/7 ASoC: Intel: Skylake: Move up pipe mem free

In reply to Vinod Koul

The MCPS is freed first thing in pmd events but non memory. So if we face error during teardown we leak this mem, so move the code up

---
 sound/soc/intel/skylake/skl-topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl-topology.c +1 -1
index 698c4aa03933..f221c758d601 100644
@@ -652,6 +652,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
 	int ret = 0;
 
 	skl_tplg_free_pipe_mcps(skl, mconfig);
+	skl_tplg_free_pipe_mem(skl, mconfig);
 
 	list_for_each_entry(w_module, &s_pipe->w_list, node) {
 		dst_module = w_module->w->priv;
@@ -670,7 +671,6 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
 	}
 
 	ret = skl_delete_pipe(ctx, mconfig->pipe);
-	skl_tplg_free_pipe_mem(skl, mconfig);
 
 	return ret;
 }
Signature · 1 line
1.9.1
maintainer
#18 lore raw

Applied "ASoC: Intel: Skylake: Move up pipe mem free" to the asoc tree

The patch

ASoC: Intel: Skylake: Move up pipe mem free

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 65976878ca692566ed066f4fa977de517f697c59 Mon Sep 17 00:00:00 2001

From: Vinod Koul <[email protected]>
Date: Mon, 23 Nov 2015 22:26:29 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Move up pipe mem free

The MCPS is freed first thing in pmd events but non memory. So if we face error during teardown we leak this mem, so move the code up

---
 sound/soc/intel/skylake/skl-topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl-topology.c +1 -1
index 698c4aa03933..f221c758d601 100644
@@ -652,6 +652,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
 	int ret = 0;
 
 	skl_tplg_free_pipe_mcps(skl, mconfig);
+	skl_tplg_free_pipe_mem(skl, mconfig);
 
 	list_for_each_entry(w_module, &s_pipe->w_list, node) {
 		dst_module = w_module->w->priv;
@@ -670,7 +671,6 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
 	}
 
 	ret = skl_delete_pipe(ctx, mconfig->pipe);
-	skl_tplg_free_pipe_mem(skl, mconfig);
 
 	return ret;
 }
Signature · 1 line
2.6.2