All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] ASoC: Intel: Skylake: Driver updates
@ 2016-12-02 17:41 jeeja.kp
  2016-12-02 17:41 ` [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
                   ` (11 more replies)
  0 siblings, 12 replies; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

This patch series includes driver updates for the handling scenarios 
during System S0/S3 transitions when audio stream is stopped during
system.
o move DMA configuration in DSP Gateway Module widget event handler to
ensure DMA is configured after resume. 
o Enable SSP MLCK using Supply widget. This will ensure the MCLK is
enabled when the widget is power on.
o Check DMA decouple register state before coupling/decoupling the DMA.
o In case of HDMI pass-through pipe, reset only the FE Pipe when stream
in in XRUN state.
o Resume the stream from HW renderer position.
o HDMI Codec pin and converter state need to be restored when stream
is resumed.

Jeeja KP (12):
  ASoC: Intel: Skylake: Add helper function to setup host/link dma
  ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer
  ASoC: Intel: Skylake: Removed unused skl_get_format()
  ALSA: hda: check stream decoupled register state
  ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK
  ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops
  ASoC: Intel: Skylake: Add supply widget as non DSP widget
  ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine
  ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine
  ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare
  ASoC: Intel: Skylake: set the resume point to LPIB
  ASoC: hdac_hdmi: Enable pin and converter in prepare

 sound/hda/ext/hdac_ext_stream.c                 |  15 +-
 sound/soc/codecs/hdac_hdmi.c                    |  28 ++--
 sound/soc/intel/boards/bxt_da7219_max98357a.c   |  34 ++++
 sound/soc/intel/boards/skl_nau88l25_max98357a.c |  34 ++++
 sound/soc/intel/skylake/skl-pcm.c               | 210 +++++++++++++-----------
 sound/soc/intel/skylake/skl-topology.c          |  27 ++-
 sound/soc/intel/skylake/skl-topology.h          |   6 +
 7 files changed, 240 insertions(+), 114 deletions(-)

-- 
2.5.0

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-05 11:35   ` Mark Brown
  2016-12-02 17:41 ` [PATCH 02/12] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer jeeja.kp
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

This patch adds helper function to configure the host/link DMA when the
DMA is in decoupled mode.
Next patch adds the usage of this helper routines for configuring DMA
in Mixer event handler.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c      | 82 ++++++++++++++++++++++++++++++++++
 sound/soc/intel/skylake/skl-topology.c |  2 +
 sound/soc/intel/skylake/skl-topology.h |  6 +++
 3 files changed, 90 insertions(+)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 84b5101..8a7b6f7 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -137,6 +137,80 @@ static void skl_set_suspend_active(struct snd_pcm_substream *substream,
 		skl->supend_active--;
 }
 
+int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
+{
+	struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
+	struct hdac_bus *bus = ebus_to_hbus(ebus);
+	unsigned int format_val;
+	struct hdac_stream *hstream;
+	struct hdac_ext_stream *stream;
+	int err;
+
+	hstream = snd_hdac_get_stream(bus, params->stream,
+					params->host_dma_id + 1);
+	if (!hstream)
+		return -EINVAL;
+
+	stream = stream_to_hdac_ext_stream(hstream);
+	snd_hdac_ext_stream_decouple(ebus, stream, true);
+
+	format_val = snd_hdac_calc_stream_format(params->s_freq,
+				params->ch, params->format, 32, 0);
+
+	dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
+		format_val, params->s_freq, params->ch, params->format);
+
+	snd_hdac_stream_reset(hdac_stream(stream));
+	err = snd_hdac_stream_set_params(hdac_stream(stream), format_val);
+	if (err < 0)
+		return err;
+
+	err = snd_hdac_stream_setup(hdac_stream(stream));
+	if (err < 0)
+		return err;
+
+	hdac_stream(stream)->prepared = 1;
+
+	return 0;
+}
+
+int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
+{
+	struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
+	struct hdac_bus *bus = ebus_to_hbus(ebus);
+	unsigned int format_val;
+	struct hdac_stream *hstream;
+	struct hdac_ext_stream *stream;
+	struct hdac_ext_link *link;
+
+	hstream = snd_hdac_get_stream(bus, params->stream,
+					params->link_dma_id + 1);
+	if (!hstream)
+		return -EINVAL;
+
+	stream = stream_to_hdac_ext_stream(hstream);
+	snd_hdac_ext_stream_decouple(ebus, stream, true);
+	format_val = snd_hdac_calc_stream_format(params->s_freq,
+				params->ch, params->format, 24, 0);
+
+	dev_dbg(dev, "format_val=%d, rate=%d, ch=%d, format=%d\n",
+		format_val, params->s_freq, params->ch, params->format);
+
+	snd_hdac_ext_link_stream_reset(stream);
+
+	snd_hdac_ext_link_stream_setup(stream, format_val);
+
+	list_for_each_entry(link, &ebus->hlink_list, list) {
+		if (link->index == params->link_index)
+			snd_hdac_ext_link_set_stream_id(link,
+					hstream->stream_tag);
+	}
+
+	stream->link_prepared = 1;
+
+	return 0;
+}
+
 static int skl_pcm_open(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
@@ -292,6 +366,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
 	p_params.s_freq = params_rate(params);
 	p_params.host_dma_id = dma_id;
 	p_params.stream = substream->stream;
+	p_params.format = params_format(params);
 
 	m_cfg = skl_tplg_fe_get_cpr_module(dai, p_params.stream);
 	if (m_cfg)
@@ -506,6 +581,7 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
 	struct hdac_ext_dma_params *dma_params;
 	struct snd_soc_dai *codec_dai = rtd->codec_dai;
 	struct skl_pipe_params p_params = {0};
+	struct hdac_ext_link *link;
 
 	link_dev = snd_hdac_ext_stream_assign(ebus, substream,
 					HDAC_EXT_STREAM_TYPE_LINK);
@@ -514,6 +590,10 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
 
 	snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev);
 
+	link = snd_hdac_ext_bus_get_link(ebus, rtd->codec->component.name);
+	if (!link)
+		return -EINVAL;
+
 	/* set the stream tag in the codec dai dma params  */
 	dma_params = snd_soc_dai_get_dma_data(codec_dai, substream);
 	if (dma_params)
@@ -524,6 +604,8 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
 	p_params.s_freq = params_rate(params);
 	p_params.stream = substream->stream;
 	p_params.link_dma_id = hdac_stream(link_dev)->stream_tag - 1;
+	p_params.link_index = link->index;
+	p_params.format = params_format(params);
 
 	return skl_tplg_be_update_params(dai, &p_params);
 }
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index bd313c9..484d451 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1207,6 +1207,7 @@ static void skl_tplg_fill_dma_id(struct skl_module_cfg *mcfg,
 		switch (mcfg->dev_type) {
 		case SKL_DEVICE_HDALINK:
 			pipe->p_params->link_dma_id = params->link_dma_id;
+			pipe->p_params->link_index = params->link_index;
 			break;
 
 		case SKL_DEVICE_HDAHOST:
@@ -1220,6 +1221,7 @@ static void skl_tplg_fill_dma_id(struct skl_module_cfg *mcfg,
 		pipe->p_params->ch = params->ch;
 		pipe->p_params->s_freq = params->s_freq;
 		pipe->p_params->stream = params->stream;
+		pipe->p_params->format = params->format;
 
 	} else {
 		memcpy(pipe->p_params, params, sizeof(*params));
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
index 08d3928..a0d3158 100644
--- a/sound/soc/intel/skylake/skl-topology.h
+++ b/sound/soc/intel/skylake/skl-topology.h
@@ -254,6 +254,8 @@ struct skl_pipe_params {
 	u32 s_freq;
 	u32 s_fmt;
 	u8 linktype;
+	snd_pcm_format_t format;
+	int link_index;
 	int stream;
 };
 
@@ -383,4 +385,8 @@ int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size,
 struct skl_module_cfg *skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai,
 								int stream);
 enum skl_bitdepth skl_get_bit_depth(int params);
+int skl_pcm_host_dma_prepare(struct device *dev,
+			struct skl_pipe_params *params);
+int skl_pcm_link_dma_prepare(struct device *dev,
+			struct skl_pipe_params *params);
 #endif
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/12] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
  2016-12-02 17:41 ` [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer" to the asoc tree Mark Brown
  2016-12-02 17:41 ` [PATCH 03/12] ASoC: Intel: Skylake: Removed unused skl_get_format() jeeja.kp
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

If system is suspended when PCM was paused/stopped, restart doesn't
configure DMA as it is we are in Pause state and results in IO error
eventually.

Configure host/link DMA before initializing DSP Gateway copier module
instead of DAI prepare(). So moved DMA configuration to mixer PRE_PMD
widget handler instead of DAI prepare.

This uses previously added new API to do the configuration and removes
old DAI prepare code.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c      | 50 +---------------------------------
 sound/soc/intel/skylake/skl-topology.c | 19 +++++++++++++
 2 files changed, 20 insertions(+), 49 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 8a7b6f7..1abff8e 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -305,37 +305,19 @@ static int skl_be_prepare(struct snd_pcm_substream *substream,
 static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
-	struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
 	struct skl *skl = get_skl_ctx(dai->dev);
-	unsigned int format_val;
-	int err;
 	struct skl_module_cfg *mconfig;
 
 	dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
 
-	format_val = skl_get_format(substream, dai);
-	dev_dbg(dai->dev, "stream_tag=%d formatvalue=%d\n",
-				hdac_stream(stream)->stream_tag, format_val);
-	snd_hdac_stream_reset(hdac_stream(stream));
-
 	/* In case of XRUN recovery, reset the FW pipe to clean state */
 	if (mconfig && (substream->runtime->status->state ==
 					SNDRV_PCM_STATE_XRUN))
 		skl_reset_pipe(skl->skl_sst, mconfig->pipe);
 
-	err = snd_hdac_stream_set_params(hdac_stream(stream), format_val);
-	if (err < 0)
-		return err;
-
-	err = snd_hdac_stream_setup(hdac_stream(stream));
-	if (err < 0)
-		return err;
-
-	hdac_stream(stream)->prepared = 1;
-
-	return err;
+	return 0;
 }
 
 static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
@@ -510,7 +492,6 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_RESUME:
 		if (!w->ignore_suspend) {
-			skl_pcm_prepare(substream, dai);
 			/*
 			 * enable DMA Resume enable bit for the stream, set the
 			 * dpib & lpib position to resume before starting the
@@ -531,7 +512,6 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 		 * 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;
@@ -613,41 +593,15 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
 static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
-	struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
-	struct hdac_ext_stream *link_dev =
-			snd_soc_dai_get_dma_data(dai, substream);
-	unsigned int format_val = 0;
-	struct skl_dma_params *dma_params;
-	struct snd_soc_dai *codec_dai = rtd->codec_dai;
-	struct hdac_ext_link *link;
 	struct skl *skl = get_skl_ctx(dai->dev);
 	struct skl_module_cfg *mconfig = NULL;
 
-	dma_params  = (struct skl_dma_params *)
-			snd_soc_dai_get_dma_data(codec_dai, substream);
-	if (dma_params)
-		format_val = dma_params->format;
-	dev_dbg(dai->dev, "stream_tag=%d formatvalue=%d codec_dai_name=%s\n",
-			hdac_stream(link_dev)->stream_tag, format_val, codec_dai->name);
-
-	link = snd_hdac_ext_bus_get_link(ebus, rtd->codec->component.name);
-	if (!link)
-		return -EINVAL;
-
-	snd_hdac_ext_link_stream_reset(link_dev);
-
 	/* In case of XRUN recovery, reset the FW pipe to clean state */
 	mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
 	if (mconfig && (substream->runtime->status->state ==
 					SNDRV_PCM_STATE_XRUN))
 		skl_reset_pipe(skl->skl_sst, mconfig->pipe);
 
-	snd_hdac_ext_link_stream_setup(link_dev, format_val);
-
-	snd_hdac_ext_link_set_stream_id(link, hdac_stream(link_dev)->stream_tag);
-	link_dev->link_prepared = 1;
-
 	return 0;
 }
 
@@ -662,10 +616,8 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
 	dev_dbg(dai->dev, "In %s cmd=%d\n", __func__, cmd);
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_RESUME:
-		skl_link_pcm_prepare(substream, dai);
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		snd_hdac_ext_stream_decouple(ebus, stream, true);
 		snd_hdac_ext_link_stream_start(link_dev);
 		break;
 
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 484d451..9cf8c51 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -496,6 +496,20 @@ static int skl_tplg_set_module_init_data(struct snd_soc_dapm_widget *w)
 	return 0;
 }
 
+static int skl_tplg_module_prepare(struct skl_sst *ctx, struct skl_pipe *pipe,
+		struct snd_soc_dapm_widget *w, struct skl_module_cfg *mcfg)
+{
+	switch (mcfg->dev_type) {
+	case SKL_DEVICE_HDAHOST:
+		return skl_pcm_host_dma_prepare(ctx->dev, pipe->p_params);
+
+	case SKL_DEVICE_HDALINK:
+		return skl_pcm_link_dma_prepare(ctx->dev, pipe->p_params);
+	}
+
+	return 0;
+}
+
 /*
  * Inside a pipe instance, we can have various modules. These modules need
  * to instantiated in DSP by invoking INIT_MODULE IPC, which is achieved by
@@ -535,6 +549,11 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
 			mconfig->m_state = SKL_MODULE_LOADED;
 		}
 
+		/* prepare the DMA if the module is gateway cpr */
+		ret = skl_tplg_module_prepare(ctx, pipe, w, mconfig);
+		if (ret < 0)
+			return ret;
+
 		/* update blob if blob is null for be with default value */
 		skl_tplg_update_be_blob(w, ctx);
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/12] ASoC: Intel: Skylake: Removed unused skl_get_format()
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
  2016-12-02 17:41 ` [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
  2016-12-02 17:41 ` [PATCH 02/12] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Removed unused skl_get_format()" to the asoc tree Mark Brown
  2016-12-02 17:41 ` [PATCH 04/12] ALSA: hda: check stream decoupled register state jeeja.kp
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Removed the unused function skl_get_format as the format is calculated
directly using the HDA core API.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 1abff8e..10fa10d 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -259,32 +259,6 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int skl_get_format(struct snd_pcm_substream *substream,
-		struct snd_soc_dai *dai)
-{
-	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
-	struct skl_dma_params *dma_params;
-	struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
-	int format_val = 0;
-
-	if ((ebus_to_hbus(ebus))->ppcap) {
-		struct snd_pcm_runtime *runtime = substream->runtime;
-
-		format_val = snd_hdac_calc_stream_format(runtime->rate,
-						runtime->channels,
-						runtime->format,
-						32, 0);
-	} else {
-		struct snd_soc_dai *codec_dai = rtd->codec_dai;
-
-		dma_params = snd_soc_dai_get_dma_data(codec_dai, substream);
-		if (dma_params)
-			format_val = dma_params->format;
-	}
-
-	return format_val;
-}
-
 static int skl_be_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/12] ALSA: hda: check stream decoupled register state
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (2 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 03/12] ASoC: Intel: Skylake: Removed unused skl_get_format() jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-02 19:03   ` Takashi Iwai
  2016-12-02 17:41 ` [PATCH 05/12] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK jeeja.kp
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Check stream decoupled register value with requested value
before decoupling/coupling the stream.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/hda/ext/hdac_ext_stream.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
index 3be051a..bd8187b 100644
--- a/sound/hda/ext/hdac_ext_stream.c
+++ b/sound/hda/ext/hdac_ext_stream.c
@@ -128,14 +128,17 @@ void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus,
 {
 	struct hdac_stream *hstream = &stream->hstream;
 	struct hdac_bus *bus = &ebus->bus;
+	u32 val;
+	int mask = AZX_PPCTL_PROCEN(hstream->index);
 
 	spin_lock_irq(&bus->reg_lock);
-	if (decouple)
-		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0,
-				AZX_PPCTL_PROCEN(hstream->index));
-	else
-		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL,
-					AZX_PPCTL_PROCEN(hstream->index), 0);
+	val = ((readw(bus->ppcap + AZX_REG_PP_PPCTL) & mask) >> mask);
+
+	if (decouple && (val == 0))
+		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0, mask);
+	else if (!decouple && (val > 0))
+		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
+
 	stream->decoupled = decouple;
 	spin_unlock_irq(&bus->reg_lock);
 }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/12] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (3 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 04/12] ALSA: hda: check stream decoupled register state jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-02 17:41 ` [PATCH 06/12] ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops jeeja.kp
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Some machine requires MCLK to be enabled before SSP start up, so add
set_tristate() DAI ops to enable/disable SSP MCLK. This ops will be
called from machine which requires early MCLK and removes the usage of
enabling early MLCK in platform DAI prepare by default which is not
machine specific.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 10fa10d..3c16d41 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -396,6 +396,33 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream,
 	return skl_tplg_be_update_params(dai, &p_params);
 }
 
+static int skl_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate)
+{
+	struct skl *skl = get_skl_ctx(dai->dev);
+	struct skl_sst *ctx = skl->skl_sst;
+	struct skl_module_cfg *mconfig;
+	int stream;
+
+	if (dai->playback_active)
+		stream = SNDRV_PCM_STREAM_PLAYBACK;
+	else
+		stream = SNDRV_PCM_STREAM_CAPTURE;
+
+	mconfig = skl_tplg_be_get_cpr_module(dai, stream);
+	if (!mconfig)
+		return -EINVAL;
+
+	/*
+	 * To enable ssp clk explicitly before gateway copier is configured,
+	 * need to use dma control IPC.
+	 * Disable will be done when DSP gateway copier modules are deleted.
+	 */
+	if (!tristate)
+		return skl_dsp_set_dma_control(ctx, mconfig);
+
+	return 0;
+}
+
 static int skl_decoupled_trigger(struct snd_pcm_substream *substream,
 		int cmd)
 {
@@ -646,7 +673,7 @@ static struct snd_soc_dai_ops skl_dmic_dai_ops = {
 
 static struct snd_soc_dai_ops skl_be_ssp_dai_ops = {
 	.hw_params = skl_be_hw_params,
-	.prepare = skl_be_prepare,
+	.set_tristate = skl_soc_dai_set_tristate,
 };
 
 static struct snd_soc_dai_ops skl_link_dai_ops = {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/12] ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (4 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 05/12] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-02 17:41 ` [PATCH 07/12] ASoC: Intel: Skylake: Add supply widget as non DSP widget jeeja.kp
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Removed unused prepare DAI ops as previous patch uses set_tristate
ops and this is no longer in use so remove the BE DAI prepare opd.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 3c16d41..688d6f7 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -259,23 +259,6 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int skl_be_prepare(struct snd_pcm_substream *substream,
-		struct snd_soc_dai *dai)
-{
-	struct skl *skl = get_skl_ctx(dai->dev);
-	struct skl_sst *ctx = skl->skl_sst;
-	struct skl_module_cfg *mconfig;
-
-	if (dai->playback_widget->power || dai->capture_widget->power)
-		return 0;
-
-	mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
-	if (mconfig == NULL)
-		return -EINVAL;
-
-	return skl_dsp_set_dma_control(ctx, mconfig);
-}
-
 static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/12] ASoC: Intel: Skylake: Add supply widget as non DSP widget
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (5 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 06/12] ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-02 17:41 ` [PATCH 08/12] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine jeeja.kp
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Supply widgets to model clock supplies for SSP and add this widget type
dapm supply widget as non DSP widget to bypass while parsing the source
and sink dapm widget list.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-topology.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 9cf8c51..edd0c60 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -87,6 +87,7 @@ static int is_skl_dsp_widget_type(struct snd_soc_dapm_widget *w)
 	case snd_soc_dapm_aif_out:
 	case snd_soc_dapm_dai_out:
 	case snd_soc_dapm_switch:
+	case snd_soc_dapm_supply:
 		return false;
 	default:
 		return true;
@@ -1484,12 +1485,13 @@ static int skl_tplg_be_set_src_pipe_params(struct snd_soc_dai *dai,
 	snd_soc_dapm_widget_for_each_source_path(w, p) {
 		if (p->connect && is_skl_dsp_widget_type(p->source) &&
 						p->source->priv) {
-
 			ret = skl_tplg_be_fill_pipe_params(dai,
 						p->source->priv, params);
 			if (ret < 0)
 				return ret;
 		} else {
+			if (p->source->id == snd_soc_dapm_supply)
+				continue;
 			ret = skl_tplg_be_set_src_pipe_params(dai,
 						p->source, params);
 			if (ret < 0)
@@ -1515,6 +1517,8 @@ static int skl_tplg_be_set_sink_pipe_params(struct snd_soc_dai *dai,
 			if (ret < 0)
 				return ret;
 		} else {
+			if (p->sink->id == snd_soc_dapm_supply)
+				continue;
 			ret = skl_tplg_be_set_sink_pipe_params(
 						dai, p->sink, params);
 			if (ret < 0)
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/12] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (6 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 07/12] ASoC: Intel: Skylake: Add supply widget as non DSP widget jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-02 17:41 ` [PATCH 09/12] ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine jeeja.kp
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Maxim codec needs clock to be configured before the SSP startup, so we
need to model the MLCK from SSP0 and turn it on before SSP port is
enabled, so model this in DSP widget parsing.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/boards/skl_nau88l25_max98357a.c | 34 +++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/sound/soc/intel/boards/skl_nau88l25_max98357a.c b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
index 25db5be..06abdf1 100644
--- a/sound/soc/intel/boards/skl_nau88l25_max98357a.c
+++ b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
@@ -100,6 +100,36 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 	return ret;
 }
 
+static struct snd_soc_dai *skl_get_dai_widget(struct snd_soc_dapm_widget *w)
+{
+	struct snd_soc_dapm_path *p = NULL;
+
+	snd_soc_dapm_widget_for_each_sink_path(w, p) {
+		if (p->sink->id == snd_soc_dapm_dai_in)
+			return p->sink->priv;
+
+		return skl_get_dai_widget(p->sink);
+	}
+
+	return NULL;
+}
+
+static int ssp_set_clk(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *k, int  event)
+{
+	struct snd_soc_dai *cpu_dai = NULL;
+
+	cpu_dai = skl_get_dai_widget(w);
+	if (!cpu_dai)
+		return -EIO;
+
+	/* Enable/Disable the SSP clk */
+	if (SND_SOC_DAPM_EVENT_ON(event))
+		return snd_soc_dai_set_tristate(cpu_dai, 0);
+	else
+		return snd_soc_dai_set_tristate(cpu_dai, 1);
+}
+
 static const struct snd_kcontrol_new skylake_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -113,6 +143,9 @@ static const struct snd_soc_dapm_widget skylake_widgets[] = {
 	SND_SOC_DAPM_MIC("SoC DMIC", NULL),
 	SND_SOC_DAPM_SPK("DP", NULL),
 	SND_SOC_DAPM_SPK("HDMI", NULL),
+	SND_SOC_DAPM_SUPPLY("ssp0 mclk", SND_SOC_NOPM, 0, 0,
+			ssp_set_clk, SND_SOC_DAPM_PRE_PMU |
+			SND_SOC_DAPM_POST_PMD),
 	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
 			platform_clock_control, SND_SOC_DAPM_PRE_PMU |
 			SND_SOC_DAPM_POST_PMD),
@@ -136,6 +169,7 @@ static const struct snd_soc_dapm_route skylake_map[] = {
 	/* CODEC BE connections */
 	{ "HiFi Playback", NULL, "ssp0 Tx" },
 	{ "ssp0 Tx", NULL, "codec0_out" },
+	{ "codec0_out", NULL, "ssp0 mclk"},
 
 	{ "Playback", NULL, "ssp1 Tx" },
 	{ "ssp1 Tx", NULL, "codec1_out" },
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/12] ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (7 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 08/12] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2016-12-02 17:41 ` [PATCH 10/12] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare jeeja.kp
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Maxim codec needs clock to be configured before the SSP startup, so we
need to model the MLCK from SSP5 and turn it on before SSP port is
enabled, so model this in DSP widget parsing.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 34 +++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c
index bff80b4..c702967 100644
--- a/sound/soc/intel/boards/bxt_da7219_max98357a.c
+++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c
@@ -43,6 +43,36 @@ enum {
 	BXT_DPCM_AUDIO_HDMI3_PB,
 };
 
+static struct snd_soc_dai *skl_get_dai_widget(struct snd_soc_dapm_widget *w)
+{
+	struct snd_soc_dapm_path *p = NULL;
+
+	snd_soc_dapm_widget_for_each_sink_path(w, p) {
+		if (p->sink->id == snd_soc_dapm_dai_in)
+			return p->sink->priv;
+
+		return skl_get_dai_widget(p->sink);
+	}
+
+	return NULL;
+}
+
+static int ssp_set_clk(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *k, int  event)
+{
+	struct snd_soc_dai *cpu_dai = NULL;
+
+	cpu_dai = skl_get_dai_widget(w);
+	if (!cpu_dai)
+		return -EIO;
+
+	/* Enable/Disable the SSP clk */
+	if (SND_SOC_DAPM_EVENT_ON(event))
+		return snd_soc_dai_set_tristate(cpu_dai, 0);
+	else
+		return snd_soc_dai_set_tristate(cpu_dai, 1);
+}
+
 static const struct snd_kcontrol_new broxton_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -57,6 +87,9 @@ static const struct snd_soc_dapm_widget broxton_widgets[] = {
 	SND_SOC_DAPM_SPK("HDMI1", NULL),
 	SND_SOC_DAPM_SPK("HDMI2", NULL),
 	SND_SOC_DAPM_SPK("HDMI3", NULL),
+	SND_SOC_DAPM_SUPPLY("ssp5 mclk", SND_SOC_NOPM, 0, 0,
+			ssp_set_clk, SND_SOC_DAPM_PRE_PMU |
+			SND_SOC_DAPM_POST_PMD),
 };
 
 static const struct snd_soc_dapm_route broxton_map[] = {
@@ -76,6 +109,7 @@ static const struct snd_soc_dapm_route broxton_map[] = {
 	/* CODEC BE connections */
 	{"HiFi Playback", NULL, "ssp5 Tx"},
 	{"ssp5 Tx", NULL, "codec0_out"},
+	{ "codec0_out", NULL, "ssp5 mclk"},
 
 	{"Playback", NULL, "ssp1 Tx"},
 	{"ssp1 Tx", NULL, "codec1_out"},
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/12] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (8 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 09/12] ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare" to the asoc tree Mark Brown
  2016-12-02 17:41 ` [PATCH 11/12] ASoC: Intel: Skylake: set the resume point to LPIB jeeja.kp
  2016-12-02 17:41 ` [PATCH 12/12] ASoC: hdac_hdmi: Enable pin and converter in prepare jeeja.kp
  11 siblings, 1 reply; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

When pipe is pass-through, BE and FE modules are defined inside
a pipe, reset of pipe will be done in FE DAI prepare. So don't
reset in the BE prepare.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 688d6f7..800fdad 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -582,8 +582,8 @@ static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,
 
 	/* In case of XRUN recovery, reset the FW pipe to clean state */
 	mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
-	if (mconfig && (substream->runtime->status->state ==
-					SNDRV_PCM_STATE_XRUN))
+	if (mconfig && !mconfig->pipe->passthru &&
+		(substream->runtime->status->state == SNDRV_PCM_STATE_XRUN))
 		skl_reset_pipe(skl->skl_sst, mconfig->pipe);
 
 	return 0;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/12] ASoC: Intel: Skylake: set the resume point to LPIB
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (9 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 10/12] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: set the resume point to LPIB" to the asoc tree Mark Brown
  2016-12-02 17:41 ` [PATCH 12/12] ASoC: hdac_hdmi: Enable pin and converter in prepare jeeja.kp
  11 siblings, 1 reply; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

In system suspend, the firmware pipelines will be deleted and there
is no need to save the pipeline context. Driver will save the DPIB and
LPIB pointers in suspend.

In system resume, the firmware pipelines will be created again and the
RD/RW pointers in the Firmware buffer points to the base address. So
need to fetch the non-played data again to firmware buffer. LPIB
indicates the HW rendered position.

Instead of setting DPIB as resume point, set it to LPIB to restore from
the HW render position so that DMA would fetch the non-played data one
more time.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 800fdad..508144b 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -484,7 +484,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 			snd_hdac_ext_stream_drsm_enable(ebus, true,
 						hdac_stream(stream)->index);
 			snd_hdac_ext_stream_set_dpibr(ebus, stream,
-							stream->dpib);
+							stream->lpib);
 			snd_hdac_ext_stream_set_lpib(stream, stream->lpib);
 		}
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/12] ASoC: hdac_hdmi: Enable pin and converter in prepare
  2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
                   ` (10 preceding siblings ...)
  2016-12-02 17:41 ` [PATCH 11/12] ASoC: Intel: Skylake: set the resume point to LPIB jeeja.kp
@ 2016-12-02 17:41 ` jeeja.kp
  11 siblings, 0 replies; 21+ messages in thread
From: jeeja.kp @ 2016-12-02 17:41 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Sachin Mokashi, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

Instead of enabling pin and cvt in pcm_open(), need to restore pin and
cvt state after system resume to restart the playback which is
paused/stopped before system suspend.
So enable pin and cvt in playback_prepare and call prepare when trigger
cmd is paused/started and resume to reconfigure pin and cvt.

Signed-off-by: Sachin Mokashi <sachinx.mokashi@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/codecs/hdac_hdmi.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index c602c49..8d47505 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -114,6 +114,12 @@ struct hdac_hdmi_priv {
 	struct hdac_chmap chmap;
 };
 
+static void hdac_hdmi_enable_cvt(struct hdac_ext_device *edev,
+			struct hdac_hdmi_dai_pin_map *dai_map);
+
+static int hdac_hdmi_enable_pin(struct hdac_ext_device *hdac,
+			struct hdac_hdmi_dai_pin_map *dai_map);
+
 static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi,
 						int pcm_idx)
 {
@@ -411,6 +417,10 @@ static int hdac_hdmi_playback_prepare(struct snd_pcm_substream *substream,
 	dev_dbg(&hdac->hdac.dev, "stream tag from cpu dai %d format in cvt 0x%x\n",
 			dd->stream_tag,	dd->format);
 
+	hdac_hdmi_enable_cvt(hdac, dai_map);
+	ret = hdac_hdmi_enable_pin(hdac, dai_map);
+	if (ret < 0)
+		return ret;
 	mutex_lock(&pin->lock);
 	pin->channels = substream->runtime->channels;
 
@@ -622,11 +632,6 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
 
 	dai_map->pin = pin;
 
-	hdac_hdmi_enable_cvt(hdac, dai_map);
-	ret = hdac_hdmi_enable_pin(hdac, dai_map);
-	if (ret < 0)
-		return ret;
-
 	ret = hdac_hdmi_eld_limit_formats(substream->runtime,
 				pin->eld.eld_buffer);
 	if (ret < 0)
@@ -642,15 +647,16 @@ static int hdac_hdmi_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct hdac_hdmi_dai_pin_map *dai_map;
 	struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai);
 	struct hdac_hdmi_priv *hdmi = hdac->private_data;
-	int ret;
 
 	dai_map = &hdmi->dai_map[dai->id];
-	if (cmd == SNDRV_PCM_TRIGGER_RESUME) {
-		ret = hdac_hdmi_enable_pin(hdac, dai_map);
-		if (ret < 0)
-			return ret;
-
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_RESUME:
+	case SNDRV_PCM_TRIGGER_START:
+	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		return hdac_hdmi_playback_prepare(substream, dai);
+
+	default:
+		return 0;
 	}
 
 	return 0;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 04/12] ALSA: hda: check stream decoupled register state
  2016-12-02 17:41 ` [PATCH 04/12] ALSA: hda: check stream decoupled register state jeeja.kp
@ 2016-12-02 19:03   ` Takashi Iwai
  2016-12-05  6:52     ` Jeeja KP
  0 siblings, 1 reply; 21+ messages in thread
From: Takashi Iwai @ 2016-12-02 19:03 UTC (permalink / raw)
  To: jeeja.kp; +Cc: patches.audio, alsa-devel, broonie, liam.r.girdwood

On Fri, 02 Dec 2016 18:41:41 +0100,
jeeja.kp@intel.com wrote:
> 
> From: Jeeja KP <jeeja.kp@intel.com>
> 
> Check stream decoupled register value with requested value
> before decoupling/coupling the stream.
> 
> Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
> ---
>  sound/hda/ext/hdac_ext_stream.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
> index 3be051a..bd8187b 100644
> --- a/sound/hda/ext/hdac_ext_stream.c
> +++ b/sound/hda/ext/hdac_ext_stream.c
> @@ -128,14 +128,17 @@ void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus,
>  {
>  	struct hdac_stream *hstream = &stream->hstream;
>  	struct hdac_bus *bus = &ebus->bus;
> +	u32 val;
> +	int mask = AZX_PPCTL_PROCEN(hstream->index);
>  
>  	spin_lock_irq(&bus->reg_lock);
> -	if (decouple)
> -		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0,
> -				AZX_PPCTL_PROCEN(hstream->index));
> -	else
> -		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL,
> -					AZX_PPCTL_PROCEN(hstream->index), 0);
> +	val = ((readw(bus->ppcap + AZX_REG_PP_PPCTL) & mask) >> mask);
> +
> +	if (decouple && (val == 0))
> +		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0, mask);
> +	else if (!decouple && (val > 0))
> +		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
> +

The usage of snd_hdac_updatel() looks strange.
The third argument must be the mask bits and the fourth be the value
bits.  So, usually for clearing a bit

	snd_hdac_update(pcap, REG, mask, 0);

and for setting a bit

	snd_hdac_update(pcap, REG, mask, mask);

Passing 0 to the mask bits means to replace the whole bits.

This usage pattern is found already in the old code, so it's not new,
and I'm not sure whether this behavior is intentional...


thanks,

Takashi

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 04/12] ALSA: hda: check stream decoupled register state
  2016-12-02 19:03   ` Takashi Iwai
@ 2016-12-05  6:52     ` Jeeja KP
  0 siblings, 0 replies; 21+ messages in thread
From: Jeeja KP @ 2016-12-05  6:52 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: patches.audio, alsa-devel, broonie, liam.r.girdwood

On Fri, Dec 02, 2016 at 08:03:18PM +0100, Takashi Iwai wrote:
> On Fri, 02 Dec 2016 18:41:41 +0100,
> jeeja.kp@intel.com wrote:
> > 
> > From: Jeeja KP <jeeja.kp@intel.com>
> > 
> > Check stream decoupled register value with requested value
> > before decoupling/coupling the stream.
> > 
> > Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
> > ---
> >  sound/hda/ext/hdac_ext_stream.c | 15 +++++++++------
> >  1 file changed, 9 insertions(+), 6 deletions(-)
> > 
> > diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
> > index 3be051a..bd8187b 100644
> > --- a/sound/hda/ext/hdac_ext_stream.c
> > +++ b/sound/hda/ext/hdac_ext_stream.c
> > @@ -128,14 +128,17 @@ void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus,
> >  {
> >  	struct hdac_stream *hstream = &stream->hstream;
> >  	struct hdac_bus *bus = &ebus->bus;
> > +	u32 val;
> > +	int mask = AZX_PPCTL_PROCEN(hstream->index);
> >  
> >  	spin_lock_irq(&bus->reg_lock);
> > -	if (decouple)
> > -		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0,
> > -				AZX_PPCTL_PROCEN(hstream->index));
> > -	else
> > -		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL,
> > -					AZX_PPCTL_PROCEN(hstream->index), 0);
> > +	val = ((readw(bus->ppcap + AZX_REG_PP_PPCTL) & mask) >> mask);
> > +
> > +	if (decouple && (val == 0))
> > +		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0, mask);
> > +	else if (!decouple && (val > 0))
> > +		snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0);
> > +
> 
> The usage of snd_hdac_updatel() looks strange.
> The third argument must be the mask bits and the fourth be the value
> bits.  So, usually for clearing a bit
> 
> 	snd_hdac_update(pcap, REG, mask, 0);
> 
> and for setting a bit
> 
> 	snd_hdac_update(pcap, REG, mask, mask);
> 
> Passing 0 to the mask bits means to replace the whole bits.
> 
> This usage pattern is found already in the old code, so it's not new,
> and I'm not sure whether this behavior is intentional...

Agreed, the correct way to set a bit is to pass third and fourth argument
as mask. Will fix this overall usage of this macro and send it in another
patch series.

> 
> 
> thanks,
> 
> Takashi

-- 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma
  2016-12-02 17:41 ` [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
@ 2016-12-05 11:35   ` Mark Brown
  2016-12-05 17:09     ` Jeeja KP
  0 siblings, 1 reply; 21+ messages in thread
From: Mark Brown @ 2016-12-05 11:35 UTC (permalink / raw)
  To: jeeja.kp; +Cc: tiwai, patches.audio, alsa-devel, liam.r.girdwood


[-- Attachment #1.1: Type: text/plain, Size: 402 bytes --]

On Fri, Dec 02, 2016 at 11:11:38PM +0530, jeeja.kp@intel.com wrote:

> This patch adds helper function to configure the host/link DMA when the
> DMA is in decoupled mode.

This isn't just adding a helper function...

> +	link = snd_hdac_ext_bus_get_link(ebus, rtd->codec->component.name);
> +	if (!link)
> +		return -EINVAL;
> +

...it's also doing some things that appear to use that helper function.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma
  2016-12-05 11:35   ` Mark Brown
@ 2016-12-05 17:09     ` Jeeja KP
  0 siblings, 0 replies; 21+ messages in thread
From: Jeeja KP @ 2016-12-05 17:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: tiwai, patches.audio, alsa-devel, liam.r.girdwood

On Mon, Dec 05, 2016 at 11:35:32AM +0000, Mark Brown wrote:
> On Fri, Dec 02, 2016 at 11:11:38PM +0530, jeeja.kp@intel.com wrote:
> 
> > This patch adds helper function to configure the host/link DMA when the
> > DMA is in decoupled mode.
> 
> This isn't just adding a helper function...
> 
> > +	link = snd_hdac_ext_bus_get_link(ebus, rtd->codec->component.name);
> > +	if (!link)
> > +		return -EINVAL;
> > +
> 
> ...it's also doing some things that appear to use that helper function.
Helper function requires 2 parameter format and link_index. these parameters
are updated in hw_params and used by the helper function to configure the link
DMA. so added these as part of the skl_pipe_params structure and these are
updated in hw_params and used in the helper function.

-- 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Applied "ASoC: Intel: Skylake: Removed unused skl_get_format()" to the asoc tree
  2016-12-02 17:41 ` [PATCH 03/12] ASoC: Intel: Skylake: Removed unused skl_get_format() jeeja.kp
@ 2016-12-15 12:20   ` Mark Brown
  0 siblings, 0 replies; 21+ messages in thread
From: Mark Brown @ 2016-12-15 12:20 UTC (permalink / raw)
  To: Jeeja KP; +Cc: tiwai, patches.audio, alsa-devel, broonie, liam.r.girdwood

The patch

   ASoC: Intel: Skylake: Removed unused skl_get_format()

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

>From f4e4e9893964684397dec517debe77cb7e405a6c Mon Sep 17 00:00:00 2001
From: Jeeja KP <jeeja.kp@intel.com>
Date: Thu, 8 Dec 2016 13:41:15 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Removed unused skl_get_format()

Removed the unused function skl_get_format as the format is calculated
directly using the HDA core API.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/skylake/skl-pcm.c | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 1abff8e1a298..10fa10df4e57 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -259,32 +259,6 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int skl_get_format(struct snd_pcm_substream *substream,
-		struct snd_soc_dai *dai)
-{
-	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
-	struct skl_dma_params *dma_params;
-	struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
-	int format_val = 0;
-
-	if ((ebus_to_hbus(ebus))->ppcap) {
-		struct snd_pcm_runtime *runtime = substream->runtime;
-
-		format_val = snd_hdac_calc_stream_format(runtime->rate,
-						runtime->channels,
-						runtime->format,
-						32, 0);
-	} else {
-		struct snd_soc_dai *codec_dai = rtd->codec_dai;
-
-		dma_params = snd_soc_dai_get_dma_data(codec_dai, substream);
-		if (dma_params)
-			format_val = dma_params->format;
-	}
-
-	return format_val;
-}
-
 static int skl_be_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Applied "ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer" to the asoc tree
  2016-12-02 17:41 ` [PATCH 02/12] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer jeeja.kp
@ 2016-12-15 12:20   ` Mark Brown
  0 siblings, 0 replies; 21+ messages in thread
From: Mark Brown @ 2016-12-15 12:20 UTC (permalink / raw)
  To: Jeeja KP; +Cc: tiwai, patches.audio, alsa-devel, broonie, liam.r.girdwood

The patch

   ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer

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

>From bb704a737cecc1c4c9f1b0251aa79d8276308ccc Mon Sep 17 00:00:00 2001
From: Jeeja KP <jeeja.kp@intel.com>
Date: Thu, 8 Dec 2016 13:41:14 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of
 Mixer

If system is suspended when PCM was paused/stopped, restart doesn't
configure DMA as it is we are in Pause state and results in IO error
eventually.

Configure host/link DMA before initializing DSP Gateway copier module
instead of DAI prepare(). So moved DMA configuration to mixer PRE_PMD
widget handler instead of DAI prepare.

This uses previously added new API to do the configuration and removes
old DAI prepare code.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/skylake/skl-pcm.c      | 50 +---------------------------------
 sound/soc/intel/skylake/skl-topology.c | 19 +++++++++++++
 2 files changed, 20 insertions(+), 49 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 105aab7593c8..aebae234152c 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -231,37 +231,19 @@ static int skl_be_prepare(struct snd_pcm_substream *substream,
 static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
-	struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
 	struct skl *skl = get_skl_ctx(dai->dev);
-	unsigned int format_val;
-	int err;
 	struct skl_module_cfg *mconfig;
 
 	dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
 
-	format_val = skl_get_format(substream, dai);
-	dev_dbg(dai->dev, "stream_tag=%d formatvalue=%d\n",
-				hdac_stream(stream)->stream_tag, format_val);
-	snd_hdac_stream_reset(hdac_stream(stream));
-
 	/* In case of XRUN recovery, reset the FW pipe to clean state */
 	if (mconfig && (substream->runtime->status->state ==
 					SNDRV_PCM_STATE_XRUN))
 		skl_reset_pipe(skl->skl_sst, mconfig->pipe);
 
-	err = snd_hdac_stream_set_params(hdac_stream(stream), format_val);
-	if (err < 0)
-		return err;
-
-	err = snd_hdac_stream_setup(hdac_stream(stream));
-	if (err < 0)
-		return err;
-
-	hdac_stream(stream)->prepared = 1;
-
-	return err;
+	return 0;
 }
 
 static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
@@ -436,7 +418,6 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_RESUME:
 		if (!w->ignore_suspend) {
-			skl_pcm_prepare(substream, dai);
 			/*
 			 * enable DMA Resume enable bit for the stream, set the
 			 * dpib & lpib position to resume before starting the
@@ -457,7 +438,6 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 		 * 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;
@@ -539,41 +519,15 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
 static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
 {
-	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
-	struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
-	struct hdac_ext_stream *link_dev =
-			snd_soc_dai_get_dma_data(dai, substream);
-	unsigned int format_val = 0;
-	struct skl_dma_params *dma_params;
-	struct snd_soc_dai *codec_dai = rtd->codec_dai;
-	struct hdac_ext_link *link;
 	struct skl *skl = get_skl_ctx(dai->dev);
 	struct skl_module_cfg *mconfig = NULL;
 
-	dma_params  = (struct skl_dma_params *)
-			snd_soc_dai_get_dma_data(codec_dai, substream);
-	if (dma_params)
-		format_val = dma_params->format;
-	dev_dbg(dai->dev, "stream_tag=%d formatvalue=%d codec_dai_name=%s\n",
-			hdac_stream(link_dev)->stream_tag, format_val, codec_dai->name);
-
-	link = snd_hdac_ext_bus_get_link(ebus, rtd->codec->component.name);
-	if (!link)
-		return -EINVAL;
-
-	snd_hdac_ext_link_stream_reset(link_dev);
-
 	/* In case of XRUN recovery, reset the FW pipe to clean state */
 	mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
 	if (mconfig && (substream->runtime->status->state ==
 					SNDRV_PCM_STATE_XRUN))
 		skl_reset_pipe(skl->skl_sst, mconfig->pipe);
 
-	snd_hdac_ext_link_stream_setup(link_dev, format_val);
-
-	snd_hdac_ext_link_set_stream_id(link, hdac_stream(link_dev)->stream_tag);
-	link_dev->link_prepared = 1;
-
 	return 0;
 }
 
@@ -588,10 +542,8 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
 	dev_dbg(dai->dev, "In %s cmd=%d\n", __func__, cmd);
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_RESUME:
-		skl_link_pcm_prepare(substream, dai);
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		snd_hdac_ext_stream_decouple(ebus, stream, true);
 		snd_hdac_ext_link_stream_start(link_dev);
 		break;
 
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 8f608c45e445..422a9dee9270 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -496,6 +496,20 @@ static int skl_tplg_set_module_init_data(struct snd_soc_dapm_widget *w)
 	return 0;
 }
 
+static int skl_tplg_module_prepare(struct skl_sst *ctx, struct skl_pipe *pipe,
+		struct snd_soc_dapm_widget *w, struct skl_module_cfg *mcfg)
+{
+	switch (mcfg->dev_type) {
+	case SKL_DEVICE_HDAHOST:
+		return skl_pcm_host_dma_prepare(ctx->dev, pipe->p_params);
+
+	case SKL_DEVICE_HDALINK:
+		return skl_pcm_link_dma_prepare(ctx->dev, pipe->p_params);
+	}
+
+	return 0;
+}
+
 /*
  * Inside a pipe instance, we can have various modules. These modules need
  * to instantiated in DSP by invoking INIT_MODULE IPC, which is achieved by
@@ -535,6 +549,11 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
 			mconfig->m_state = SKL_MODULE_LOADED;
 		}
 
+		/* prepare the DMA if the module is gateway cpr */
+		ret = skl_tplg_module_prepare(ctx, pipe, w, mconfig);
+		if (ret < 0)
+			return ret;
+
 		/* update blob if blob is null for be with default value */
 		skl_tplg_update_be_blob(w, ctx);
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Applied "ASoC: Intel: Skylake: set the resume point to LPIB" to the asoc tree
  2016-12-02 17:41 ` [PATCH 11/12] ASoC: Intel: Skylake: set the resume point to LPIB jeeja.kp
@ 2017-01-19 18:03   ` Mark Brown
  0 siblings, 0 replies; 21+ messages in thread
From: Mark Brown @ 2017-01-19 18:03 UTC (permalink / raw)
  To: Jeeja KP; +Cc: tiwai, patches.audio, alsa-devel, broonie, liam.r.girdwood

The patch

   ASoC: Intel: Skylake: set the resume point to LPIB

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

>From a700a1e65aa3ee76d2e8c58150ee7b7272d93608 Mon Sep 17 00:00:00 2001
From: Jeeja KP <jeeja.kp@intel.com>
Date: Tue, 10 Jan 2017 17:57:47 +0530
Subject: [PATCH] ASoC: Intel: Skylake: set the resume point to LPIB

In system suspend, the firmware pipelines will be deleted and there
is no need to save the pipeline context. Driver will save the DPIB and
LPIB pointers in suspend.

In system resume, the firmware pipelines will be created again and the
RD/RW pointers in the Firmware buffer points to the base address. So
need to fetch the non-played data again to firmware buffer. LPIB
indicates the HW rendered position.

Instead of setting DPIB as resume point, set it to LPIB to restore from
the HW render position so that DMA would fetch the non-played data one
more time.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/skylake/skl-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index aefcfca810f4..ae7997ab19b1 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -474,7 +474,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 			snd_hdac_ext_stream_drsm_enable(ebus, true,
 						hdac_stream(stream)->index);
 			snd_hdac_ext_stream_set_dpibr(ebus, stream,
-							stream->dpib);
+							stream->lpib);
 			snd_hdac_ext_stream_set_lpib(stream, stream->lpib);
 		}
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Applied "ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare" to the asoc tree
  2016-12-02 17:41 ` [PATCH 10/12] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare jeeja.kp
@ 2017-01-19 18:03   ` Mark Brown
  0 siblings, 0 replies; 21+ messages in thread
From: Mark Brown @ 2017-01-19 18:03 UTC (permalink / raw)
  To: Jeeja KP; +Cc: tiwai, patches.audio, alsa-devel, broonie, liam.r.girdwood

The patch

   ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare

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

>From 7cbfdf87f422211b9a1f2845acb2e39597b3ef7e Mon Sep 17 00:00:00 2001
From: Jeeja KP <jeeja.kp@intel.com>
Date: Tue, 10 Jan 2017 17:57:46 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE
 prepare

When pipe is pass-through, BE and FE modules are defined inside
a pipe, reset of pipe will be done in FE DAI prepare. So don't
reset in the BE prepare.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/skylake/skl-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 10fa10df4e57..aefcfca810f4 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -572,8 +572,8 @@ static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,
 
 	/* In case of XRUN recovery, reset the FW pipe to clean state */
 	mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
-	if (mconfig && (substream->runtime->status->state ==
-					SNDRV_PCM_STATE_XRUN))
+	if (mconfig && !mconfig->pipe->passthru &&
+		(substream->runtime->status->state == SNDRV_PCM_STATE_XRUN))
 		skl_reset_pipe(skl->skl_sst, mconfig->pipe);
 
 	return 0;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-01-19 18:04 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 17:41 [PATCH 00/12] ASoC: Intel: Skylake: Driver updates jeeja.kp
2016-12-02 17:41 ` [PATCH 01/12] ASoC: Intel: Skylake: Add helper function to setup host/link dma jeeja.kp
2016-12-05 11:35   ` Mark Brown
2016-12-05 17:09     ` Jeeja KP
2016-12-02 17:41 ` [PATCH 02/12] ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer jeeja.kp
2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 03/12] ASoC: Intel: Skylake: Removed unused skl_get_format() jeeja.kp
2016-12-15 12:20   ` Applied "ASoC: Intel: Skylake: Removed unused skl_get_format()" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 04/12] ALSA: hda: check stream decoupled register state jeeja.kp
2016-12-02 19:03   ` Takashi Iwai
2016-12-05  6:52     ` Jeeja KP
2016-12-02 17:41 ` [PATCH 05/12] ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK jeeja.kp
2016-12-02 17:41 ` [PATCH 06/12] ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops jeeja.kp
2016-12-02 17:41 ` [PATCH 07/12] ASoC: Intel: Skylake: Add supply widget as non DSP widget jeeja.kp
2016-12-02 17:41 ` [PATCH 08/12] ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine jeeja.kp
2016-12-02 17:41 ` [PATCH 09/12] ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine jeeja.kp
2016-12-02 17:41 ` [PATCH 10/12] ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare jeeja.kp
2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 11/12] ASoC: Intel: Skylake: set the resume point to LPIB jeeja.kp
2017-01-19 18:03   ` Applied "ASoC: Intel: Skylake: set the resume point to LPIB" to the asoc tree Mark Brown
2016-12-02 17:41 ` [PATCH 12/12] ASoC: hdac_hdmi: Enable pin and converter in prepare jeeja.kp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.