[alsa-devel] [PATCH 0/9] ASoC: Intel: Skylake: Stability fixes
The QA reported few issues while doing extensive on driver and esp in area of suspend and doing suspend while audio is active. This path series fixes those issues
Jeeja KP (8): ASoC: Intel: Skylake: remove BE startup dai ops ASoC: Intel: Skylake: Don't enable WAKEENABLE on suspend ASoC: Intel: Skylake: Remove redundant init in resume ASoC: Intel: Skylake: Fix cleanup of dma buffer ASoC: Intel: Skylake: Reset the DSP when set D3 fails ASoC: Intel: Skylake: Fix CLDMA buffer wrap case ASoC: Intel: Skylake: Fix null ptr dereferenced in skl_tplg_bind_sinks ASoC: Intel: Skylake: Add pm ops for skl_rt286 machine
Vinod Koul (1): ASoC: Intel: Skylake: Constrain the audio devices
sound/soc/intel/boards/skl_rt286.c | 50 +++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-pcm.c | 22 ++++++++------- sound/soc/intel/skylake/skl-sst-cldma.c | 20 +++++++++++++ sound/soc/intel/skylake/skl-sst.c | 29 ++++++++++--------- sound/soc/intel/skylake/skl-topology.c | 6 ++-- sound/soc/intel/skylake/skl.c | 13 --------- 6 files changed, 100 insertions(+), 40 deletions(-)
From: Jeeja KP jeeja.kp@intel.com
We have moved the runtime calls from BE startup to HW params, this helps to optimize the unnecessary wakes due to users opening and closing device As a result startup is empty so remove that
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl-pcm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index e652d58bd9a9..3ccfa7be95cb 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -285,6 +285,8 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { + int ret; + struct skl_pipe_params p_params = {0};
p_params.s_fmt = snd_pcm_format_width(params_format(params)); @@ -292,7 +294,11 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream, p_params.s_freq = params_rate(params); p_params.stream = substream->stream;
- return skl_tplg_be_update_params(dai, &p_params); + ret = skl_tplg_be_update_params(dai, &p_params); + if (ret < 0) + return ret; + + return pm_runtime_get_sync(dai->dev); }
static int skl_decoupled_trigger(struct snd_pcm_substream *substream, @@ -402,6 +408,11 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream, struct skl_dma_params *dma_params; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct skl_pipe_params p_params = {0}; + int ret; + + ret = pm_runtime_get_sync(dai->dev); + if (ret < 0) + return ret;
link_dev = snd_hdac_ext_stream_assign(ebus, substream, HDAC_EXT_STREAM_TYPE_LINK); @@ -512,12 +523,6 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream, return 0; }
-static int skl_be_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - return pm_runtime_get_sync(dai->dev); -} - static void skl_be_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -535,19 +540,16 @@ static struct snd_soc_dai_ops skl_pcm_dai_ops = { };
static struct snd_soc_dai_ops skl_dmic_dai_ops = { - .startup = skl_be_startup, .hw_params = skl_be_hw_params, .shutdown = skl_be_shutdown, };
static struct snd_soc_dai_ops skl_be_ssp_dai_ops = { - .startup = skl_be_startup, .hw_params = skl_be_hw_params, .shutdown = skl_be_shutdown, };
static struct snd_soc_dai_ops skl_link_dai_ops = { - .startup = skl_be_startup, .prepare = skl_link_pcm_prepare, .hw_params = skl_link_hw_params, .hw_free = skl_link_hw_free,
From: Jeeja KP jeeja.kp@intel.com
For HDA codecs WAKEENABLE bit is to programmed if codec event change has to wake the system when suspended.
In skylake I2S systems which are currently supported we have only HDMI codec, which doesn't use this capability to detect a HDMI connect/ disconnect event. HDMI HDA codec uses display interface to detect connect/disconnect event.
This patch removes the WAKEBIT enabling during device D0/D3 as this seems to cause spurious wakes on the system
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl.c | 9 --------- 1 file changed, 9 deletions(-)
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 390f839d6168..b771b74781ca 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -191,9 +191,6 @@ static int skl_runtime_suspend(struct device *dev)
dev_dbg(bus->dev, "in %s\n", __func__);
- /* enable controller wake up event */ - snd_hdac_chip_updatew(bus, WAKEEN, 0, STATESTS_INT_MASK); - return _skl_suspend(ebus); }
@@ -203,17 +200,11 @@ static int skl_runtime_resume(struct device *dev) struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct hdac_bus *bus = ebus_to_hbus(ebus); struct skl *skl = ebus_to_skl(ebus); - int status;
dev_dbg(bus->dev, "in %s\n", __func__);
- /* Read STATESTS before controller reset */ - status = snd_hdac_chip_readw(bus, STATESTS); - skl_init_pci(skl); snd_hdac_bus_init_chip(bus, true); - /* disable controller Wake Up event */ - snd_hdac_chip_updatew(bus, WAKEEN, STATESTS_INT_MASK, 0);
return _skl_resume(ebus); }
The patch
ASoC: Intel: Skylake: Don't enable WAKEENABLE on suspend
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 a71e269728ce42216cca8ce5145e97e777a36467 Mon Sep 17 00:00:00 2001
From: Jeeja KP jeeja.kp@intel.com Date: Fri, 13 Nov 2015 19:22:06 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Don't enable WAKEENABLE on suspend
For HDA codecs WAKEENABLE bit is to programmed if codec event change has to wake the system when suspended.
In skylake I2S systems which are currently supported we have only HDMI codec, which doesn't use this capability to detect a HDMI connect/ disconnect event. HDMI HDA codec uses display interface to detect connect/disconnect event.
This patch removes the WAKEBIT enabling during device D0/D3 as this seems to cause spurious wakes on the system
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl.c | 9 --------- 1 file changed, 9 deletions(-)
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 8ead864f354a..bdb99dcbfdca 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -191,9 +191,6 @@ static int skl_runtime_suspend(struct device *dev)
dev_dbg(bus->dev, "in %s\n", __func__);
- /* enable controller wake up event */ - snd_hdac_chip_updatew(bus, WAKEEN, 0, STATESTS_INT_MASK); - return _skl_suspend(ebus); }
@@ -203,17 +200,11 @@ static int skl_runtime_resume(struct device *dev) struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct hdac_bus *bus = ebus_to_hbus(ebus); struct skl *skl = ebus_to_skl(ebus); - int status;
dev_dbg(bus->dev, "in %s\n", __func__);
- /* Read STATESTS before controller reset */ - status = snd_hdac_chip_readw(bus, STATESTS); - skl_init_pci(skl); snd_hdac_bus_init_chip(bus, true); - /* disable controller Wake Up event */ - snd_hdac_chip_updatew(bus, WAKEEN, STATESTS_INT_MASK, 0);
return _skl_resume(ebus); }
From: Jeeja KP jeeja.kp@intel.com
Since we call _skl_resume which also initializes the chip we no need to call these explicitly, so remove the duplication
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index b771b74781ca..5e468b167325 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -199,13 +199,9 @@ static int skl_runtime_resume(struct device *dev) struct pci_dev *pci = to_pci_dev(dev); struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct hdac_bus *bus = ebus_to_hbus(ebus); - struct skl *skl = ebus_to_skl(ebus);
dev_dbg(bus->dev, "in %s\n", __func__);
- skl_init_pci(skl); - snd_hdac_bus_init_chip(bus, true); - return _skl_resume(ebus); } #endif /* CONFIG_PM */
The patch
ASoC: Intel: Skylake: Remove redundant init in resume
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From e03fc82d7c474b2f9bcdb0f6a5ef26c6c3ab24ee Mon Sep 17 00:00:00 2001
From: Jeeja KP jeeja.kp@intel.com Date: Fri, 13 Nov 2015 19:22:07 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Remove redundant init in resume
Since we call _skl_resume which also initializes the chip we no need to call these explicitly, so remove the duplication
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index bdb99dcbfdca..d3e87b6f93fe 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -199,13 +199,9 @@ static int skl_runtime_resume(struct device *dev) struct pci_dev *pci = to_pci_dev(dev); struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct hdac_bus *bus = ebus_to_hbus(ebus); - struct skl *skl = ebus_to_skl(ebus);
dev_dbg(bus->dev, "in %s\n", __func__);
- skl_init_pci(skl); - snd_hdac_bus_init_chip(bus, true); - return _skl_resume(ebus); } #endif /* CONFIG_PM */
From: Jeeja KP jeeja.kp@intel.com
During firmware download, dma buffers are allocated in prepare and never freed on clean up. This patch frees the allocated dma buffer in cldma controller clean up.
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl-sst-cldma.c | 5 +++++ sound/soc/intel/skylake/skl-sst.c | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-sst-cldma.c b/sound/soc/intel/skylake/skl-sst-cldma.c index 44748ba98da2..f62dc339a1ce 100644 --- a/sound/soc/intel/skylake/skl-sst-cldma.c +++ b/sound/soc/intel/skylake/skl-sst-cldma.c @@ -137,6 +137,11 @@ static void skl_cldma_cleanup(struct sst_dsp *ctx)
sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_CBL, 0); sst_dsp_shim_write(ctx, SKL_ADSP_REG_CL_SD_LVI, 0); + + if (&ctx->cl_dev.dmab_data) + ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data); + if (&ctx->cl_dev.dmab_bdl) + ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_bdl); }
static int skl_cldma_wait_interruptible(struct sst_dsp *ctx) diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c index 0c5039f2bd09..36dfc326d1fa 100644 --- a/sound/soc/intel/skylake/skl-sst.c +++ b/sound/soc/intel/skylake/skl-sst.c @@ -115,7 +115,7 @@ static int skl_load_base_firmware(struct sst_dsp *ctx) dev_err(ctx->dev, "Timeout waiting for ROM init done, reg:0x%x\n", reg); ret = -EIO; - goto skl_load_base_firmware_failed; + goto transfer_firmware_failed; }
ret = skl_transfer_firmware(ctx, ctx->fw->data, ctx->fw->size); @@ -128,15 +128,17 @@ static int skl_load_base_firmware(struct sst_dsp *ctx) if (ret == 0) { dev_err(ctx->dev, "DSP boot failed, FW Ready timed-out\n"); ret = -EIO; - goto skl_load_base_firmware_failed; + goto transfer_firmware_failed; }
dev_dbg(ctx->dev, "Download firmware successful%d\n", ret); skl_dsp_set_state_locked(ctx, SKL_DSP_RUNNING); } return 0; - +transfer_firmware_failed: + ctx->cl_dev.ops.cl_cleanup_controller(ctx); skl_load_base_firmware_failed: + ctx->cl_dev.ops.cl_cleanup_controller(ctx); skl_dsp_disable_core(ctx); release_firmware(ctx->fw); ctx->fw = NULL; @@ -277,7 +279,6 @@ EXPORT_SYMBOL_GPL(skl_sst_dsp_init); void skl_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx) { skl_ipc_free(&ctx->ipc); - ctx->dsp->cl_dev.ops.cl_cleanup_controller(ctx->dsp); ctx->dsp->ops->free(ctx->dsp); } EXPORT_SYMBOL_GPL(skl_sst_dsp_cleanup);
From: Jeeja KP jeeja.kp@intel.com
Sometimes firmware D3 IPC fails causing firmware to be in invalid state. To recover we need to reset the DSP and then shut it down, so don't return on error and continue resetting to recover.
On D0, firmware will be redownloaded and DSP will be back in clean state
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl-sst.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c index 36dfc326d1fa..bc6f03c9b27c 100644 --- a/sound/soc/intel/skylake/skl-sst.c +++ b/sound/soc/intel/skylake/skl-sst.c @@ -19,6 +19,7 @@ #include <linux/module.h> #include <linux/delay.h> #include <linux/device.h> +#include <linux/err.h> #include "../common/sst-dsp.h" #include "../common/sst-dsp-priv.h" #include "../common/sst-ipc.h" @@ -177,10 +178,15 @@ static int skl_set_dsp_D3(struct sst_dsp *ctx) dx.core_mask = SKL_DSP_CORE0_MASK; dx.dx_mask = SKL_IPC_D3_MASK; ret = skl_ipc_set_dx(&skl->ipc, SKL_INSTANCE_ID, SKL_BASE_FW_MODULE_ID, &dx); - if (ret < 0) { - dev_err(ctx->dev, "Failed to set DSP to D3 state\n"); - return ret; - } + if (ret < 0) + dev_err(ctx->dev, + "D3 request to FW failed, continuing reset: %d", ret); + + /* disable Interrupt */ + ctx->cl_dev.ops.cl_cleanup_controller(ctx); + skl_cldma_int_disable(ctx); + skl_ipc_op_int_disable(ctx); + skl_ipc_int_disable(ctx);
ret = skl_dsp_disable_core(ctx); if (ret < 0) { @@ -189,12 +195,6 @@ static int skl_set_dsp_D3(struct sst_dsp *ctx) } skl_dsp_set_state_locked(ctx, SKL_DSP_RESET);
- /* disable Interrupt */ - ctx->cl_dev.ops.cl_cleanup_controller(ctx); - skl_cldma_int_disable(ctx); - skl_ipc_op_int_disable(ctx); - skl_ipc_int_disable(ctx); - return ret; }
The patch
ASoC: Intel: Skylake: Reset the DSP when set D3 fails
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 53afce2c5764ebf5e933efe9a2dd58cbc316c854 Mon Sep 17 00:00:00 2001
From: Jeeja KP jeeja.kp@intel.com Date: Fri, 13 Nov 2015 19:22:09 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Reset the DSP when set D3 fails
Sometimes firmware D3 IPC fails causing firmware to be in invalid state. To recover we need to reset the DSP and then shut it down, so don't return on error and continue resetting to recover.
On D0, firmware will be redownloaded and DSP will be back in clean state
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl-sst.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c index 51f07f0e4735..e1d34d5c3f9a 100644 --- a/sound/soc/intel/skylake/skl-sst.c +++ b/sound/soc/intel/skylake/skl-sst.c @@ -19,6 +19,7 @@ #include <linux/module.h> #include <linux/delay.h> #include <linux/device.h> +#include <linux/err.h> #include "../common/sst-dsp.h" #include "../common/sst-dsp-priv.h" #include "../common/sst-ipc.h" @@ -176,10 +177,15 @@ static int skl_set_dsp_D3(struct sst_dsp *ctx) dx.core_mask = SKL_DSP_CORE0_MASK; dx.dx_mask = SKL_IPC_D3_MASK; ret = skl_ipc_set_dx(&skl->ipc, SKL_INSTANCE_ID, SKL_BASE_FW_MODULE_ID, &dx); - if (ret < 0) { - dev_err(ctx->dev, "Failed to set DSP to D3 state\n"); - return ret; - } + if (ret < 0) + dev_err(ctx->dev, + "D3 request to FW failed, continuing reset: %d", ret); + + /* disable Interrupt */ + ctx->cl_dev.ops.cl_cleanup_controller(ctx); + skl_cldma_int_disable(ctx); + skl_ipc_op_int_disable(ctx); + skl_ipc_int_disable(ctx);
ret = skl_dsp_disable_core(ctx); if (ret < 0) { @@ -188,12 +194,6 @@ static int skl_set_dsp_D3(struct sst_dsp *ctx) } skl_dsp_set_state_locked(ctx, SKL_DSP_RESET);
- /* disable Interrupt */ - ctx->cl_dev.ops.cl_cleanup_controller(ctx); - skl_cldma_int_disable(ctx); - skl_ipc_op_int_disable(ctx); - skl_ipc_int_disable(ctx); - return ret; }
From: Jeeja KP jeeja.kp@intel.com
When downloading the firmware/module, if the ring buffer boundary is reached, we need to wrap to the zeroth position. On next copy we need to copy till end of buffer and the remaining buffer needs to be copied from zeroth position.
In this case copy was not handled correctly when wrap condition is reached which caused invalid data to be copied resulting in invalid hash failure.
This patch fixes the issue by handling copy at the boundary condition correctly.
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl-sst-cldma.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/sound/soc/intel/skylake/skl-sst-cldma.c b/sound/soc/intel/skylake/skl-sst-cldma.c index f62dc339a1ce..0647c3aeec0f 100644 --- a/sound/soc/intel/skylake/skl-sst-cldma.c +++ b/sound/soc/intel/skylake/skl-sst-cldma.c @@ -180,6 +180,21 @@ static void skl_cldma_fill_buffer(struct sst_dsp *ctx, unsigned int size, ctx->cl_dev.dma_buffer_offset, trigger); dev_dbg(ctx->dev, "spib position: %d\n", ctx->cl_dev.curr_spib_pos);
+ /* + * Check if the size exceeds buffer boundary. If it exceeds + * max_buffer size, then copy till buffer size and then copy + * remaining buffer from the start of ring buffer. + */ + if (ctx->cl_dev.dma_buffer_offset + size > ctx->cl_dev.bufsize) { + unsigned int size_b = ctx->cl_dev.bufsize - + ctx->cl_dev.dma_buffer_offset; + memcpy(ctx->cl_dev.dmab_data.area + ctx->cl_dev.dma_buffer_offset, + curr_pos, size_b); + size -= size_b; + curr_pos += size_b; + ctx->cl_dev.dma_buffer_offset = 0; + } + memcpy(ctx->cl_dev.dmab_data.area + ctx->cl_dev.dma_buffer_offset, curr_pos, size);
The patch
ASoC: Intel: Skylake: Fix CLDMA buffer wrap case
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 e797af53b8814dfbc3c6ac134c528b8ab480f275 Mon Sep 17 00:00:00 2001
From: Jeeja KP jeeja.kp@intel.com Date: Fri, 13 Nov 2015 19:22:10 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Fix CLDMA buffer wrap case
When downloading the firmware/module, if the ring buffer boundary is reached, we need to wrap to the zeroth position. On next copy we need to copy till end of buffer and the remaining buffer needs to be copied from zeroth position.
In this case copy was not handled correctly when wrap condition is reached which caused invalid data to be copied resulting in invalid hash failure.
This patch fixes the issue by handling copy at the boundary condition correctly.
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl-sst-cldma.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/sound/soc/intel/skylake/skl-sst-cldma.c b/sound/soc/intel/skylake/skl-sst-cldma.c index 4ddabe30b62a..b03d9db0acad 100644 --- a/sound/soc/intel/skylake/skl-sst-cldma.c +++ b/sound/soc/intel/skylake/skl-sst-cldma.c @@ -180,6 +180,21 @@ static void skl_cldma_fill_buffer(struct sst_dsp *ctx, unsigned int size, ctx->cl_dev.dma_buffer_offset, trigger); dev_dbg(ctx->dev, "spib position: %d\n", ctx->cl_dev.curr_spib_pos);
+ /* + * Check if the size exceeds buffer boundary. If it exceeds + * max_buffer size, then copy till buffer size and then copy + * remaining buffer from the start of ring buffer. + */ + if (ctx->cl_dev.dma_buffer_offset + size > ctx->cl_dev.bufsize) { + unsigned int size_b = ctx->cl_dev.bufsize - + ctx->cl_dev.dma_buffer_offset; + memcpy(ctx->cl_dev.dmab_data.area + ctx->cl_dev.dma_buffer_offset, + curr_pos, size_b); + size -= size_b; + curr_pos += size_b; + ctx->cl_dev.dma_buffer_offset = 0; + } + memcpy(ctx->cl_dev.dmab_data.area + ctx->cl_dev.dma_buffer_offset, curr_pos, size);
From: Jeeja KP jeeja.kp@intel.com
This patch fixes the below warning form smatch and makes the skl_tplg_bind_sinks take the next sink as argument which is true when the current sink is valid
sound/soc/intel/skylake/skl-topology.c:453 skl_tplg_bind_sinks() error: we previously assumed 'sink' could be null (see line 452)
sound/soc/intel/skylake/skl-topology.c 451 452 if (!sink) ^^^^ New check. Reversed?
453 return skl_tplg_bind_sinks(sink, skl, src_mconfig); ^^^^ This is dereferenced inside the function.
454 455 return 0;
Reported-by: Dan Carpenter dan.carpenter@oracle.com Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl-topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 2b6ee22b5ea2..0937ea2129c1 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -408,7 +408,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, struct skl_module_cfg *src_mconfig) { struct snd_soc_dapm_path *p; - struct snd_soc_dapm_widget *sink = NULL; + struct snd_soc_dapm_widget *sink = NULL, *next_sink = NULL; struct skl_module_cfg *sink_mconfig; struct skl_sst *ctx = skl->skl_sst; int ret; @@ -420,7 +420,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, dev_dbg(ctx->dev, "%s: src widget=%s\n", __func__, w->name); dev_dbg(ctx->dev, "%s: sink widget=%s\n", __func__, p->sink->name);
- sink = p->sink; + next_sink = p->sink; /* * here we will check widgets in sink pipelines, so that * can be any widgets type and we are only interested if @@ -450,7 +450,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, }
if (!sink) - return skl_tplg_bind_sinks(sink, skl, src_mconfig); + return skl_tplg_bind_sinks(next_sink, skl, src_mconfig);
return 0; }
The patch
ASoC: Intel: Skylake: Fix null ptr dereferenced in skl_tplg_bind_sinks
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 0ed95d769c8d6c1030dd9f94cf6fb2a6ed98a4ce Mon Sep 17 00:00:00 2001
From: Jeeja KP jeeja.kp@intel.com Date: Fri, 13 Nov 2015 19:22:11 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Fix null ptr dereferenced in skl_tplg_bind_sinks
This patch fixes the below warning form smatch and makes the skl_tplg_bind_sinks take the next sink as argument which is true when the current sink is valid
sound/soc/intel/skylake/skl-topology.c:453 skl_tplg_bind_sinks() error: we previously assumed 'sink' could be null (see line 452)
sound/soc/intel/skylake/skl-topology.c 451 452 if (!sink) ^^^^ New check. Reversed?
453 return skl_tplg_bind_sinks(sink, skl, src_mconfig); ^^^^ This is dereferenced inside the function.
454 455 return 0;
Reported-by: Dan Carpenter dan.carpenter@oracle.com Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl-topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 2b6ee22b5ea2..0937ea2129c1 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -408,7 +408,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, struct skl_module_cfg *src_mconfig) { struct snd_soc_dapm_path *p; - struct snd_soc_dapm_widget *sink = NULL; + struct snd_soc_dapm_widget *sink = NULL, *next_sink = NULL; struct skl_module_cfg *sink_mconfig; struct skl_sst *ctx = skl->skl_sst; int ret; @@ -420,7 +420,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, dev_dbg(ctx->dev, "%s: src widget=%s\n", __func__, w->name); dev_dbg(ctx->dev, "%s: sink widget=%s\n", __func__, p->sink->name);
- sink = p->sink; + next_sink = p->sink; /* * here we will check widgets in sink pipelines, so that * can be any widgets type and we are only interested if @@ -450,7 +450,7 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, }
if (!sink) - return skl_tplg_bind_sinks(sink, skl, src_mconfig); + return skl_tplg_bind_sinks(next_sink, skl, src_mconfig);
return 0; }
In ref configuration for Skylake, we support only 16bit, 48KHz, stereo audio, so specify these as constrains for the devices
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/boards/skl_rt286.c | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c index e6af48491229..9c67e05a24b3 100644 --- a/sound/soc/intel/boards/skl_rt286.c +++ b/sound/soc/intel/boards/skl_rt286.c @@ -104,6 +104,53 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) return 0; }
+static unsigned int rates[] = { + 48000, +}; + +static struct snd_pcm_hw_constraint_list constraints_rates = { + .count = ARRAY_SIZE(rates), + .list = rates, + .mask = 0, +}; + +static unsigned int channels[] = { + 2, +}; + +static struct snd_pcm_hw_constraint_list constraints_channels = { + .count = ARRAY_SIZE(channels), + .list = channels, + .mask = 0, +}; + +static int skl_fe_startup(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + + /* + * on this platform for PCM device we support, + * 48Khz + * stereo + * 16 bit audio + */ + + runtime->hw.channels_max = 2; + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + &constraints_channels); + + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16); + + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); + + return 0; +} + +static const struct snd_soc_ops skylake_rt286_fe_ops = { + .startup = skl_fe_startup, +};
static int skylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) @@ -160,6 +207,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { SND_SOC_DPCM_TRIGGER_POST }, .dpcm_playback = 1, + .ops = &skylake_rt286_fe_ops, }, { .name = "Skl Audio Capture Port", @@ -175,6 +223,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { SND_SOC_DPCM_TRIGGER_POST }, .dpcm_capture = 1, + .ops = &skylake_rt286_fe_ops, }, { .name = "Skl Audio Reference cap",
The patch
ASoC: Intel: Skylake: Constrain the audio devices
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 5eab6ab9c7882f63d7dd544b736293a9d2b8106c Mon Sep 17 00:00:00 2001
From: Vinod Koul vinod.koul@intel.com Date: Fri, 13 Nov 2015 19:22:12 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Constrain the audio devices
In ref configuration for Skylake, we support only 16bit, 48KHz, stereo audio, so specify these as constrains for the devices
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/boards/skl_rt286.c | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c index e6af48491229..9c67e05a24b3 100644 --- a/sound/soc/intel/boards/skl_rt286.c +++ b/sound/soc/intel/boards/skl_rt286.c @@ -104,6 +104,53 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) return 0; }
+static unsigned int rates[] = { + 48000, +}; + +static struct snd_pcm_hw_constraint_list constraints_rates = { + .count = ARRAY_SIZE(rates), + .list = rates, + .mask = 0, +}; + +static unsigned int channels[] = { + 2, +}; + +static struct snd_pcm_hw_constraint_list constraints_channels = { + .count = ARRAY_SIZE(channels), + .list = channels, + .mask = 0, +}; + +static int skl_fe_startup(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + + /* + * on this platform for PCM device we support, + * 48Khz + * stereo + * 16 bit audio + */ + + runtime->hw.channels_max = 2; + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + &constraints_channels); + + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16); + + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); + + return 0; +} + +static const struct snd_soc_ops skylake_rt286_fe_ops = { + .startup = skl_fe_startup, +};
static int skylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) @@ -160,6 +207,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { SND_SOC_DPCM_TRIGGER_POST }, .dpcm_playback = 1, + .ops = &skylake_rt286_fe_ops, }, { .name = "Skl Audio Capture Port", @@ -175,6 +223,7 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { SND_SOC_DPCM_TRIGGER_POST }, .dpcm_capture = 1, + .ops = &skylake_rt286_fe_ops, }, { .name = "Skl Audio Reference cap",
From: Jeeja KP jeeja.kp@intel.com
The PM ops are required so that DAPM will suspend and resume the DSP pipelines properly
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/boards/skl_rt286.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c index 9c67e05a24b3..57333a476136 100644 --- a/sound/soc/intel/boards/skl_rt286.c +++ b/sound/soc/intel/boards/skl_rt286.c @@ -299,6 +299,7 @@ static struct platform_driver skylake_audio = { .probe = skylake_audio_probe, .driver = { .name = "skl_alc286s_i2s", + .pm = &snd_soc_pm_ops, }, };
The patch
ASoC: Intel: Skylake: Add pm ops for skl_rt286 machine
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 314038e40a62c7cdfc07aad0fe14dcd4383bc34d Mon Sep 17 00:00:00 2001
From: Jeeja KP jeeja.kp@intel.com Date: Fri, 13 Nov 2015 19:22:13 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Add pm ops for skl_rt286 machine
The PM ops are required so that DAPM will suspend and resume the DSP pipelines properly
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/boards/skl_rt286.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c index 9c67e05a24b3..57333a476136 100644 --- a/sound/soc/intel/boards/skl_rt286.c +++ b/sound/soc/intel/boards/skl_rt286.c @@ -299,6 +299,7 @@ static struct platform_driver skylake_audio = { .probe = skylake_audio_probe, .driver = { .name = "skl_alc286s_i2s", + .pm = &snd_soc_pm_ops, }, };
participants (2)
-
Mark Brown
-
Vinod Koul