ASoC: Intel: Skylake: Driver updates
Subsystems (3)
v2 cover ASoC: Intel: Skylake: Driver updates
From: Jeeja KP <[email protected]>
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.
Changes in v2:
- Addressed Mark's comment on patch 1, split this into 2 as this had
additional changes other than configuring the DMA.
- Addressed Takashi's comment on the usage of snd_hdac_updatel()
Jeeja KP (13):
ASoC: Intel: Skylake: Update link_index and format in pipe params
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(-)
Signature · 1 line
2.5.0
PATCH v2 1/13 ASoC: Intel: Skylake: Update link_index and format in pipe params
From: Jeeja KP <[email protected]>
To configure Host/Link DMA, additionally link index and format are required based on the hw params. So added these parameters in the pipe params and in hw_params the pipe params are updated.
--- sound/soc/intel/skylake/skl-pcm.c | 8 ++++++++ sound/soc/intel/skylake/skl-topology.c | 2 ++ sound/soc/intel/skylake/skl-topology.h | 2 ++ 3 files changed, 12 insertions(+)
sound/soc/intel/skylake/skl-pcm.c +8 -0
@@ -292,6 +292,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 +507,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 +516,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 +530,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); }
sound/soc/intel/skylake/skl-topology.c +2 -0
@@ -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));
sound/soc/intel/skylake/skl-topology.h +2 -0
@@ -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; };
Signature · 1 line
2.5.0
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Update link_index and format in pipe params" to the asoc tree
The patch
ASoC: Intel: Skylake: Update link_index and format in pipe 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
12c3be0e720fe8c4e0f456fd25a6dcc8b254606cMon Sep 17 00:00:00 2001
From: Jeeja KP <[email protected]>
Date: Thu, 8 Dec 2016 13:41:12 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Update link_index and format in pipe
params
To configure Host/Link DMA, additionally link index and format are required based on the hw params. So added these parameters in the pipe params and in hw_params the pipe params are updated.
--- sound/soc/intel/skylake/skl-pcm.c | 8 ++++++++ sound/soc/intel/skylake/skl-topology.c | 2 ++ sound/soc/intel/skylake/skl-topology.h | 2 ++ 3 files changed, 12 insertions(+)
sound/soc/intel/skylake/skl-pcm.c +8 -0
@@ -292,6 +292,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 +507,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 +516,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 +530,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); }
sound/soc/intel/skylake/skl-topology.c +2 -0
@@ -1206,6 +1206,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 :
@@ -1219,6 +1220,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));
sound/soc/intel/skylake/skl-topology.h +2 -0
@@ -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; };
Signature · 1 line
2.11.0
PATCH v2 2/13 ASoC: Intel: Skylake: Add helper function to setup host/link dma
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-pcm.c | 74 ++++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 4 ++ 2 files changed, 78 insertions(+)
sound/soc/intel/skylake/skl-pcm.c +74 -0
@@ -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) {
sound/soc/intel/skylake/skl-topology.h +4 -0
@@ -385,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
Signature · 1 line
2.5.0
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Add helper function to setup host/link dma" to the asoc tree
The patch
ASoC: Intel: Skylake: Add helper function to setup host/link dma
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
ad036bdee57ab2287535fe53864bb5154e101991Mon Sep 17 00:00:00 2001
From: Jeeja KP <[email protected]>
Date: Thu, 8 Dec 2016 13:41:13 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Add helper function to setup host/link
dma
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.
--- sound/soc/intel/skylake/skl-pcm.c | 74 ++++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 4 ++ 2 files changed, 78 insertions(+)
sound/soc/intel/skylake/skl-pcm.c +74 -0
@@ -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) {
sound/soc/intel/skylake/skl-topology.h +4 -0
@@ -385,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
Signature · 1 line
2.11.0
PATCH v2 3/13 ASoC: Intel: Skylake: Configure DMA in PRE_PMD handler of Mixer
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-pcm.c | 50 +--------------------------------- sound/soc/intel/skylake/skl-topology.c | 19 +++++++++++++ 2 files changed, 20 insertions(+), 49 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +1 -49
@@ -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 ;
sound/soc/intel/skylake/skl-topology.c +19 -0
@@ -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);
Signature · 1 line
2.5.0
PATCH v2 4/13 ASoC: Intel: Skylake: Removed unused skl_get_format()
In reply to [email protected]From: Jeeja KP <[email protected]>
Removed the unused function skl_get_format as the format is calculated directly using the HDA core API.
--- sound/soc/intel/skylake/skl-pcm.c | 26 -------------------------- 1 file changed, 26 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -26
@@ -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) {
Signature · 1 line
2.5.0
PATCH v2 5/13 ALSA: hda: check stream decoupled register state
In reply to [email protected]From: Jeeja KP <[email protected]>
Check stream decoupled register value with requested value before decoupling/coupling the stream.
--- sound/hda/ext/hdac_ext_stream.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
sound/hda/ext/hdac_ext_stream.c +9 -6
@@ -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 , mask, 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); }
Signature · 1 line
2.5.0
Re: [PATCH v2 05/13] ALSA: hda: check stream decoupled register state
Quoted 20 lines · On Wed, 07 Dec 2016 14:44:27 +0100, [email protected] wrote:
From: Jeeja KP <[email protected]>
Check stream decoupled register value with requested value before decoupling/coupling the stream.
Signed-off-by Jeeja KP <[email protected]>--- sound/hda/ext/hdac_ext_stream.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)sound/hda/ext/hdac_ext_stream.c +1
-0@@ -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;
sound/hda/ext/hdac_ext_stream.c void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus, · line 135
Quoted 10 lines
sound/hda/ext/hdac_ext_stream.c +2
-6+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);
This looks wrong.
And you just need to know whether it's zero or not in below, so the shift is anyway superfluous.
Takashi
Quoted 11 lines
sound/hda/ext/hdac_ext_stream.c +5
-0+if (decouple && (val ==0 )) +snd_hdac_updatel (bus->ppcap,AZX_REG_PP_PPCTL , mask, 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); }Signature · 1 line
2.5.0
Re: [PATCH v2 05/13] ALSA: hda: check stream decoupled register state
Quoted 24 lines · Takashi Iwai
Quoted 22 lines · On Wed, 07 Dec 2016 14:44:27 +0100, [email protected] wrote:
From: Jeeja KP <[email protected]>
Check stream decoupled register value with requested value before decoupling/coupling the stream.
Signed-off-by Jeeja KP <[email protected]>--- sound/hda/ext/hdac_ext_stream.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)sound/hda/ext/hdac_ext_stream.c +2
-0@@ -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);
Quoted 12 lines
sound/hda/ext/hdac_ext_stream.c void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus, · line 135
Quoted 8 lines
sound/hda/ext/hdac_ext_stream.c +1
-6spin_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);This looks wrong.
And you just need to know whether it's zero or not in below, so the shift is anyway superfluous.
Yes, shift is superfluous here. I will fix this.
Quoted 16 lines
Takashi
Quoted 11 lines
sound/hda/ext/hdac_ext_stream.c +5
-0+if (decouple && (val ==0 )) +snd_hdac_updatel (bus->ppcap,AZX_REG_PP_PPCTL , mask, 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); }Signature · 1 line
2.5.0
PATCH v2 6/13 ASoC: Intel: Skylake: Add set_tristate DAI ops to enable SSP MCLK
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-pcm.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-pcm.c +28 -1
@@ -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 = {
Signature · 1 line
2.5.0
PATCH v2 7/13 ASoC: Intel: Skylake: Remove unused SSP BE prepare DAI ops
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-pcm.c | 17 ----------------- 1 file changed, 17 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -17
@@ -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) {
Signature · 1 line
2.5.0
PATCH v2 8/13 ASoC: Intel: Skylake: Add supply widget as non DSP widget
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-topology.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/skl-topology.c +5 -1
@@ -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 )
Signature · 1 line
2.5.0
PATCH v2 9/13 ASoC: Intel: Skylake: Add supply widget in skl_nau_max machine
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/boards/skl_nau88l25_max98357a.c | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
sound/soc/intel/boards/skl_nau88l25_max98357a.c +34 -0
@@ -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" },
Signature · 1 line
2.5.0
PATCH v2 10/13 ASoC: Intel: Skylake: Add supply widget in bxt_da_max machine
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/boards/bxt_da7219_max98357a.c | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
sound/soc/intel/boards/bxt_da7219_max98357a.c +34 -0
@@ -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"},
Signature · 1 line
2.5.0
PATCH v2 11/13 ASoC: Intel: Skylake: Don't reset pass-through pipe in BE prepare
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +2 -2
@@ -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 ;
Signature · 1 line
2.5.0
PATCH v2 12/13 ASoC: Intel: Skylake: set the resume point to LPIB
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/intel/skylake/skl-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/skl-pcm.c +1 -1
@@ -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); }
Signature · 1 line
2.5.0
PATCH v2 13/13 ASoC: hdac_hdmi: Enable pin and converter in prepare
In reply to [email protected]From: Jeeja KP <[email protected]>
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.
--- sound/soc/codecs/hdac_hdmi.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
sound/soc/codecs/hdac_hdmi.c +17 -11
@@ -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 ;
Signature · 1 line
2.5.0