From: jeeja.kp@intel.com
To: alsa-devel@alsa-project.org
Cc: Dharageswari R <dharageswari.r@intel.com>,
tiwai@suse.de, "Kranthikumar,
GudishaX" <gudishax.kranthikumar@intel.com>,
patches.audio@intel.com, broonie@kernel.org,
liam.r.girdwood@intel.com, Jeeja KP <jeeja.kp@intel.com>
Subject: [PATCH 10/10] ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module
Date: Tue, 7 Mar 2017 23:44:06 +0530 [thread overview]
Message-ID: <1488910446-26415-11-git-send-email-jeeja.kp@intel.com> (raw)
In-Reply-To: <1488910446-26415-1-git-send-email-jeeja.kp@intel.com>
From: Dharageswari R <dharageswari.r@intel.com>
KPB module default parameter were overwritten by the dynamic instance
id once use case is executed. This will cause module crash from
subsequent execution of use case as the updated parameters are used.
So instead of over writing the default parameter, make a copy and
update the module parameter and use this in IPC message.
Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Kranthikumar, GudishaX <gudishax.kranthikumar@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
sound/soc/intel/skylake/skl-topology.c | 47 +++++++++++++++++++++-------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index d46b6c3..53c9d63 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -690,26 +690,29 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
return 0;
}
-static int skl_fill_sink_instance_id(struct skl_sst *ctx,
- struct skl_algo_data *alg_data)
+static int skl_fill_sink_instance_id(struct skl_sst *ctx, u32 *params,
+ int size, struct skl_module_cfg *mcfg)
{
- struct skl_kpb_params *params = (struct skl_kpb_params *)alg_data->params;
- struct skl_mod_inst_map *inst;
int i, pvt_id;
- inst = params->map;
+ if (mcfg->m_type == SKL_MODULE_TYPE_KPB) {
+ struct skl_kpb_params *kpb_params =
+ (struct skl_kpb_params *)params;
+ struct skl_mod_inst_map *inst = kpb_params->map;
- for (i = 0; i < params->num_modules; i++) {
- pvt_id = skl_get_pvt_instance_id_map(ctx,
- inst->mod_id, inst->inst_id);
- if (pvt_id < 0)
- return -EINVAL;
- inst->inst_id = pvt_id;
- inst++;
+ for (i = 0; i < kpb_params->num_modules; i++) {
+ pvt_id = skl_get_pvt_instance_id_map(ctx, inst->mod_id,
+ inst->inst_id);
+ if (pvt_id < 0)
+ return -EINVAL;
+
+ inst->inst_id = pvt_id;
+ inst++;
+ }
}
+
return 0;
}
-
/*
* Some modules require params to be set after the module is bound to
* all pins connected.
@@ -726,6 +729,7 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
struct soc_bytes_ext *sb;
struct skl_algo_data *bc;
struct skl_specific_cfg *sp_cfg;
+ u32 *params;
/*
* check all out/in pins are in bind state.
@@ -758,11 +762,18 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
bc = (struct skl_algo_data *)sb->dobj.private;
if (bc->set_params == SKL_PARAM_BIND) {
- if (mconfig->m_type == SKL_MODULE_TYPE_KPB)
- skl_fill_sink_instance_id(ctx, bc);
- ret = skl_set_module_params(ctx,
- (u32 *)bc->params, bc->max,
- bc->param_id, mconfig);
+ params = kzalloc(bc->max, GFP_KERNEL);
+ if (!params)
+ return -ENOMEM;
+
+ memcpy(params, bc->params, bc->max);
+ skl_fill_sink_instance_id(ctx, params, bc->max,
+ mconfig);
+
+ ret = skl_set_module_params(ctx, params,
+ bc->max, bc->param_id, mconfig);
+ kfree(params);
+
if (ret < 0)
return ret;
}
--
2.5.0
next prev parent reply other threads:[~2017-03-07 18:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 18:13 [PATCH 00/10] ASoC: Intel: Skylake: Driver updates jeeja.kp
2017-03-07 18:13 ` [PATCH 01/10] ASoC: Intel: Skylake: Fix to delete DSP pipe after stopping pipe jeeja.kp
2017-03-09 6:17 ` Vinod Koul
2017-03-07 18:13 ` [PATCH 02/10] ASoC: Intel: Skylake: Fix not to stop src pipe in pre pmd event handler jeeja.kp
2017-03-15 18:13 ` Applied "ASoC: Intel: Skylake: Fix not to stop src pipe in pre pmd event handler" to the asoc tree Mark Brown
2017-03-07 18:13 ` [PATCH 03/10] ASoC: Intel: bxtn: Disable interrupt when DSP is in D3 jeeja.kp
2017-03-15 18:13 ` Applied "ASoC: Intel: bxtn: Disable interrupt when DSP is in D3" to the asoc tree Mark Brown
2017-03-07 18:14 ` [PATCH 04/10] ASoC: Intel: bxtn: Update DSP core state in D0 jeeja.kp
2017-03-15 18:13 ` Applied "ASoC: Intel: bxtn: Update DSP core state in D0" to the asoc tree Mark Brown
2017-03-07 18:14 ` [PATCH 05/10] ASoC: Intel: bxtn: Reload the firmware in case of D3 failure jeeja.kp
2017-03-15 18:13 ` Applied "ASoC: Intel: bxtn: Reload the firmware in case of D3 failure" to the asoc tree Mark Brown
2017-03-07 18:14 ` [PATCH 06/10] ASoC: Intel: Skylake: Remove BE prepare ops jeeja.kp
2017-03-15 18:13 ` Applied "ASoC: Intel: Skylake: Remove BE prepare ops" to the asoc tree Mark Brown
2017-03-07 18:14 ` [PATCH 07/10] ASoC: Intel: Skylake: Disable notifications at boot after DSP FW init jeeja.kp
2017-03-09 6:17 ` Vinod Koul
2017-03-15 18:13 ` Applied "ASoC: Intel: Skylake: Disable notifications at boot after DSP FW init" to the asoc tree Mark Brown
2017-03-07 18:14 ` [PATCH 08/10] ASoC: Intel: Skylake: Remove get dsp_ops in cleanup routine jeeja.kp
2017-03-10 4:40 ` kbuild test robot
2017-03-07 18:14 ` [PATCH 09/10] ASoC: Intel: Skylake: Fix module load when module size > DMA buffer size jeeja.kp
2017-03-07 18:14 ` jeeja.kp [this message]
2017-03-15 18:13 ` Applied "ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1488910446-26415-11-git-send-email-jeeja.kp@intel.com \
--to=jeeja.kp@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dharageswari.r@intel.com \
--cc=gudishax.kranthikumar@intel.com \
--cc=liam.r.girdwood@intel.com \
--cc=patches.audio@intel.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).