Skip to contentSkip to conversation

ASoC: Intel: Skylake: Add deep buffer support

PATCH Superseded Subhransu S. Prusty 2 participants 6 messages Jun 12, 2017 – Jun 19, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ASoC: Intel: Skylake: Add deep buffer support

Now that we can configure DSP dma buffer size, the device can support deep buffer playback. DSP fetches large buffer and can result fewer wakes, which helps in power reduction.

So this series first adds a token in topology to get dma_buffer_size and sends to firmware after conversion. Also ads a deepbuffer device to use this support.

Ramesh Babu (2):
ASoC: Intel: Skylake: Add deep buffer support
ASoC: Intel: Skylake: Fix dma buffer size calculation

Subhransu S. Prusty (1):
ASoC: skl_rt286: Add deepbuffer dai link

 include/uapi/sound/snd_sst_tokens.h    |  7 +++++--
 sound/soc/intel/boards/skl_rt286.c     | 18 ++++++++++++++++++
 sound/soc/intel/skylake/skl-messages.c | 29 +++++++++++++++++++++++++----
 sound/soc/intel/skylake/skl-topology.c |  4 ++++
 sound/soc/intel/skylake/skl-topology.h |  1 +
 5 files changed, 53 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 ASoC: Intel: Skylake: Add deep buffer support

From: Ramesh Babu <[email protected]>

With this patch, the dma buffer size is fetched from topology binary. This buffer size is applicable for gateway copier modules.

Now that we can configure DSP dma buffer size, the device can support deep buffer playback. DSP fetches large buffer and can result fewer wakes, which helps in power reduction.

---
 include/uapi/sound/snd_sst_tokens.h    | 7 +++++--
 sound/soc/intel/skylake/skl-topology.c | 4 ++++
 sound/soc/intel/skylake/skl-topology.h | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)
include/uapi/sound/snd_sst_tokens.h +5 -2
index 89b82f6256ad..f1c9416294a5 100644
@@ -152,7 +152,7 @@
  * %SKL_TKN_U32_CAPS_SIZE:      Caps size
  *
  * %SKL_TKN_U32_PROC_DOMAIN:    Specify processing domain
- *
+
  * %SKL_TKN_U32_LIB_COUNT:      Specifies the number of libraries
  *
  * %SKL_TKN_STR_LIB_NAME:       Specifies the library name
@@ -161,6 +161,8 @@
  *
  * %SKL_TKL_U32_D0I3_CAPS:	Specifies the D0i3 capability for module
  *
+ * %SKL_TKN_U32_DMA_BUF_SIZE:	DMA buffer size in millisec
+ *
  * module_id and loadable flags dont have tokens as these values will be
  * read from the DSP FW manifest
  */
@@ -215,7 +217,8 @@ enum SKL_TKNS {
 	SKL_TKN_U32_PMODE,
 	SKL_TKL_U32_D0I3_CAPS, /* Typo added at v4.10 */
 	SKL_TKN_U32_D0I3_CAPS = SKL_TKL_U32_D0I3_CAPS,
-	SKL_TKN_MAX = SKL_TKN_U32_D0I3_CAPS,
+	SKL_TKN_U32_DMA_BUF_SIZE,
+	SKL_TKN_MAX = SKL_TKN_U32_DMA_BUF_SIZE,
 };
 
 #endif
sound/soc/intel/skylake/skl-topology.c +4 -0
index b687ae455a61..2cadfa74438b 100644
@@ -2086,6 +2086,10 @@ static int skl_tplg_get_token(struct device *dev,
 
 		break;
 
+	case SKL_TKN_U32_DMA_BUF_SIZE:
+		mconfig->dma_buffer_size = tkn_elem->value;
+		break;
+
 	case SKL_TKN_U8_IN_PIN_TYPE:
 	case SKL_TKN_U8_OUT_PIN_TYPE:
 	case SKL_TKN_U8_CONN_TYPE:
sound/soc/intel/skylake/skl-topology.h +1 -0
index cc64d6bdb4f6..e760e835b885 100644
@@ -314,6 +314,7 @@ struct skl_module_cfg {
 	u32 vbus_id;
 	u32 mem_pages;
 	enum d0i3_capability d0i3_caps;
+	u32 dma_buffer_size; /* in milli seconds */
 	struct skl_module_pin *m_in_pin;
 	struct skl_module_pin *m_out_pin;
 	enum skl_module_type m_type;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 ASoC: Intel: Skylake: Fix dma buffer size calculation

In reply to Subhransu S. Prusty

From: Ramesh Babu <[email protected]>

DMA buffer size for gateway copier will be calculated based on:

For host DMA copier:
Input buffer size (ibs) for output direction (playback) Output buffer size (obs) for input direction (capture)

For link DMA copier:
IBS for input direction (capture)
OBS for output direction (playback)

Update the driver to use the above.

---
 sound/soc/intel/skylake/skl-messages.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
sound/soc/intel/skylake/skl-messages.c +25 -4
index ab1adc0c9cc3..7063b451b109 100644
@@ -507,6 +507,8 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
 			struct skl_module_cfg *mconfig,
 			struct skl_cpr_cfg *cpr_mconfig)
 {
+	u32 dma_io_buf;
+
 	cpr_mconfig->gtw_cfg.node_id = skl_get_node_id(ctx, mconfig);
 
 	if (cpr_mconfig->gtw_cfg.node_id == SKL_NON_GATEWAY_CPR_NODE_ID) {
@@ -514,10 +516,29 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
 		return;
 	}
 
-	if (SKL_CONN_SOURCE == mconfig->hw_conn_type)
-		cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->obs;
-	else
-		cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->ibs;
+	switch (mconfig->hw_conn_type) {
+	case SKL_CONN_SOURCE:
+		if (mconfig->dev_type == SKL_DEVICE_HDAHOST)
+			dma_io_buf =  mconfig->ibs;
+		else
+			dma_io_buf =  mconfig->obs;
+		break;
+
+	case SKL_CONN_SINK:
+		if (mconfig->dev_type == SKL_DEVICE_HDAHOST)
+			dma_io_buf =  mconfig->obs;
+		else
+			dma_io_buf =  mconfig->ibs;
+		break;
+
+	default:
+		dev_warn(ctx->dev, "wrong connection type: %d\n",
+				mconfig->hw_conn_type);
+		return;
+	}
+
+	cpr_mconfig->gtw_cfg.dma_buffer_size =
+				mconfig->dma_buffer_size * dma_io_buf;
 
 	cpr_mconfig->cpr_feature_mask = 0;
 	cpr_mconfig->gtw_cfg.config_length  = 0;
Signature · 1 line
1.9.1
maintainer
#3 lore raw

Applied "ASoC: Intel: Skylake: Fix dma buffer size calculation" to the asoc tree

The patch

ASoC: Intel: Skylake: Fix dma buffer size calculation

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 f6e6ab1d16ec9dafa65557b5637f5217b32702ef Mon Sep 17 00:00:00 2001

From: Ramesh Babu <[email protected]>
Date: Mon, 19 Jun 2017 11:59:20 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Fix dma buffer size calculation

DMA buffer size for gateway copier will be calculated based on:

For host DMA copier:
Input buffer size (ibs) for output direction (playback) Output buffer size (obs) for input direction (capture)

For link DMA copier:
IBS for input direction (capture)
OBS for output direction (playback)

Update the driver to use the above.

---
 sound/soc/intel/skylake/skl-messages.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
sound/soc/intel/skylake/skl-messages.c +25 -4
index 5a465020ebd8..eca85827dbd2 100644
@@ -507,6 +507,8 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
 			struct skl_module_cfg *mconfig,
 			struct skl_cpr_cfg *cpr_mconfig)
 {
+	u32 dma_io_buf;
+
 	cpr_mconfig->gtw_cfg.node_id = skl_get_node_id(ctx, mconfig);
 
 	if (cpr_mconfig->gtw_cfg.node_id == SKL_NON_GATEWAY_CPR_NODE_ID) {
@@ -514,10 +516,29 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
 		return;
 	}
 
-	if (SKL_CONN_SOURCE == mconfig->hw_conn_type)
-		cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->obs;
-	else
-		cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->ibs;
+	switch (mconfig->hw_conn_type) {
+	case SKL_CONN_SOURCE:
+		if (mconfig->dev_type == SKL_DEVICE_HDAHOST)
+			dma_io_buf =  mconfig->ibs;
+		else
+			dma_io_buf =  mconfig->obs;
+		break;
+
+	case SKL_CONN_SINK:
+		if (mconfig->dev_type == SKL_DEVICE_HDAHOST)
+			dma_io_buf =  mconfig->obs;
+		else
+			dma_io_buf =  mconfig->ibs;
+		break;
+
+	default:
+		dev_warn(ctx->dev, "wrong connection type: %d\n",
+				mconfig->hw_conn_type);
+		return;
+	}
+
+	cpr_mconfig->gtw_cfg.dma_buffer_size =
+				mconfig->dma_buffer_size * dma_io_buf;
 
 	cpr_mconfig->cpr_feature_mask = 0;
 	cpr_mconfig->gtw_cfg.config_length  = 0;
Signature · 1 line
2.11.0
#4 lore raw

PATCH 3/3 ASoC: skl_rt286: Add deepbuffer dai link

In reply to Subhransu S. Prusty

This patch adds the deepbuffer device which can be opened with a bigger buffer size. The application can disable interrupts and sleep for longer duration.

---
 sound/soc/intel/boards/skl_rt286.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
sound/soc/intel/boards/skl_rt286.c +18 -0
index f5ab7b8d51d1..453826ea1367 100644
@@ -43,6 +43,7 @@ struct skl_rt286_private {
 
 enum {
 	SKL_DPCM_AUDIO_PB = 0,
+	SKL_DPCM_AUDIO_DB_PB,
 	SKL_DPCM_AUDIO_CP,
 	SKL_DPCM_AUDIO_REF_CP,
 	SKL_DPCM_AUDIO_DMIC_CP,
@@ -310,6 +311,23 @@ static int skylake_dmic_startup(struct snd_pcm_substream *substream)
 		.dpcm_playback = 1,
 		.ops = &skylake_rt286_fe_ops,
 	},
+	[SKL_DPCM_AUDIO_DB_PB] = {
+		.name = "Skl Deepbuffer Port",
+		.stream_name = "Deep Buffer Audio",
+		.cpu_dai_name = "Deepbuffer Pin",
+		.platform_name = "0000:00:1f.3",
+		.nonatomic = 1,
+		.dynamic = 1,
+		.codec_name = "snd-soc-dummy",
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.trigger = {
+			SND_SOC_DPCM_TRIGGER_POST,
+			SND_SOC_DPCM_TRIGGER_POST
+		},
+		.dpcm_playback = 1,
+		.ops = &skylake_rt286_fe_ops,
+
+	},
 	[SKL_DPCM_AUDIO_CP] = {
 		.name = "Skl Audio Capture Port",
 		.stream_name = "Audio Record",
Signature · 1 line
1.9.1
maintainer
#5 lore raw

Applied "ASoC: skl_rt286: Add deepbuffer dai link" to the asoc tree

The patch

ASoC: skl_rt286: Add deepbuffer dai link

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 1f0f8bde45a7ea843bb2e7a8f45f255b23cdc2e7 Mon Sep 17 00:00:00 2001

From: "Subhransu S. Prusty" <[email protected]>
Date: Mon, 19 Jun 2017 11:59:21 +0530
Subject: [PATCH] ASoC: skl_rt286: Add deepbuffer dai link

This patch adds the deepbuffer device which can be opened with a bigger buffer size. The application can disable interrupts and sleep for longer duration.

---
 sound/soc/intel/boards/skl_rt286.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
sound/soc/intel/boards/skl_rt286.c +18 -0
index e08c71625fd0..2bc4cfca594e 100644
@@ -43,6 +43,7 @@ struct skl_rt286_private {
 
 enum {
 	SKL_DPCM_AUDIO_PB = 0,
+	SKL_DPCM_AUDIO_DB_PB,
 	SKL_DPCM_AUDIO_CP,
 	SKL_DPCM_AUDIO_REF_CP,
 	SKL_DPCM_AUDIO_DMIC_CP,
@@ -310,6 +311,23 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = {
 		.dpcm_playback = 1,
 		.ops = &skylake_rt286_fe_ops,
 	},
+	[SKL_DPCM_AUDIO_DB_PB] = {
+		.name = "Skl Deepbuffer Port",
+		.stream_name = "Deep Buffer Audio",
+		.cpu_dai_name = "Deepbuffer Pin",
+		.platform_name = "0000:00:1f.3",
+		.nonatomic = 1,
+		.dynamic = 1,
+		.codec_name = "snd-soc-dummy",
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.trigger = {
+			SND_SOC_DPCM_TRIGGER_POST,
+			SND_SOC_DPCM_TRIGGER_POST
+		},
+		.dpcm_playback = 1,
+		.ops = &skylake_rt286_fe_ops,
+
+	},
 	[SKL_DPCM_AUDIO_CP] = {
 		.name = "Skl Audio Capture Port",
 		.stream_name = "Audio Record",
Signature · 1 line
2.11.0