aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDharageswari R <dharageswari.r@intel.com>2017-03-13 12:41:32 -0400
committerMark Brown <broonie@kernel.org>2017-03-15 13:28:22 -0400
commitbf3e5ef5d549f650c13bef2b2192057cfef33d38 (patch)
treece26b89f13ced2a92efe26d30df3c5e7f8e8a4bc
parentb7d0254c51f3ce79a8931690e8a2f035208f6b55 (diff)
ASoC: Intel: Skylake: Fix parameter overwrite for KPB Module
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> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/skylake/skl-topology.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index d4058d2a8023..c6bd4bb49ec0 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -678,26 +678,29 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
678 return 0; 678 return 0;
679} 679}
680 680
681static int skl_fill_sink_instance_id(struct skl_sst *ctx, 681static int skl_fill_sink_instance_id(struct skl_sst *ctx, u32 *params,
682 struct skl_algo_data *alg_data) 682 int size, struct skl_module_cfg *mcfg)
683{ 683{
684 struct skl_kpb_params *params = (struct skl_kpb_params *)alg_data->params;
685 struct skl_mod_inst_map *inst;
686 int i, pvt_id; 684 int i, pvt_id;
687 685
688 inst = params->map; 686 if (mcfg->m_type == SKL_MODULE_TYPE_KPB) {
687 struct skl_kpb_params *kpb_params =
688 (struct skl_kpb_params *)params;
689 struct skl_mod_inst_map *inst = kpb_params->map;
689 690
690 for (i = 0; i < params->num_modules; i++) { 691 for (i = 0; i < kpb_params->num_modules; i++) {
691 pvt_id = skl_get_pvt_instance_id_map(ctx, 692 pvt_id = skl_get_pvt_instance_id_map(ctx, inst->mod_id,
692 inst->mod_id, inst->inst_id); 693 inst->inst_id);
693 if (pvt_id < 0) 694 if (pvt_id < 0)
694 return -EINVAL; 695 return -EINVAL;
695 inst->inst_id = pvt_id; 696
696 inst++; 697 inst->inst_id = pvt_id;
698 inst++;
699 }
697 } 700 }
701
698 return 0; 702 return 0;
699} 703}
700
701/* 704/*
702 * Some modules require params to be set after the module is bound to 705 * Some modules require params to be set after the module is bound to
703 * all pins connected. 706 * all pins connected.
@@ -714,6 +717,7 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
714 struct soc_bytes_ext *sb; 717 struct soc_bytes_ext *sb;
715 struct skl_algo_data *bc; 718 struct skl_algo_data *bc;
716 struct skl_specific_cfg *sp_cfg; 719 struct skl_specific_cfg *sp_cfg;
720 u32 *params;
717 721
718 /* 722 /*
719 * check all out/in pins are in bind state. 723 * check all out/in pins are in bind state.
@@ -746,11 +750,18 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
746 bc = (struct skl_algo_data *)sb->dobj.private; 750 bc = (struct skl_algo_data *)sb->dobj.private;
747 751
748 if (bc->set_params == SKL_PARAM_BIND) { 752 if (bc->set_params == SKL_PARAM_BIND) {
749 if (mconfig->m_type == SKL_MODULE_TYPE_KPB) 753 params = kzalloc(bc->max, GFP_KERNEL);
750 skl_fill_sink_instance_id(ctx, bc); 754 if (!params)
751 ret = skl_set_module_params(ctx, 755 return -ENOMEM;
752 (u32 *)bc->params, bc->max, 756
753 bc->param_id, mconfig); 757 memcpy(params, bc->params, bc->max);
758 skl_fill_sink_instance_id(ctx, params, bc->max,
759 mconfig);
760
761 ret = skl_set_module_params(ctx, params,
762 bc->max, bc->param_id, mconfig);
763 kfree(params);
764
754 if (ret < 0) 765 if (ret < 0)
755 return ret; 766 return ret;
756 } 767 }