aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeeja KP <jeeja.kp@intel.com>2016-02-05 01:49:08 -0500
committerMark Brown <broonie@kernel.org>2016-02-08 11:44:17 -0500
commitcc6a4044bdeeb7a7769b7aedf9afe9e1464aadf0 (patch)
tree57194f5823e0d7f1850c6dfa918b265fb6488cc3
parentc115fa5ec06a647c5aeff95d73e56d488145ec2e (diff)
ASoC: Intel: Skylake: Allow module parameter set after bind
Some modules require params to be set after the module is bound to all the pins connected. The module provider initializes set_param flag for such modules and we send params after binding. This is done by the function skl_tplg_set_module_bind_params() 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>
-rw-r--r--sound/soc/intel/skylake/skl-topology.c72
-rw-r--r--sound/soc/intel/skylake/skl-tplg-interface.h3
2 files changed, 74 insertions, 1 deletions
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 5c8661450349..a7be03665dd4 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -545,6 +545,66 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
545 return 0; 545 return 0;
546} 546}
547 547
548/*
549 * Some modules require params to be set after the module is bound to
550 * all pins connected.
551 *
552 * The module provider initializes set_param flag for such modules and we
553 * send params after binding
554 */
555static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
556 struct skl_module_cfg *mcfg, struct skl_sst *ctx)
557{
558 int i, ret;
559 struct skl_module_cfg *mconfig = w->priv;
560 const struct snd_kcontrol_new *k;
561 struct soc_bytes_ext *sb;
562 struct skl_algo_data *bc;
563 struct skl_specific_cfg *sp_cfg;
564
565 /*
566 * check all out/in pins are in bind state.
567 * if so set the module param
568 */
569 for (i = 0; i < mcfg->max_out_queue; i++) {
570 if (mcfg->m_out_pin[i].pin_state != SKL_PIN_BIND_DONE)
571 return 0;
572 }
573
574 for (i = 0; i < mcfg->max_in_queue; i++) {
575 if (mcfg->m_in_pin[i].pin_state != SKL_PIN_BIND_DONE)
576 return 0;
577 }
578
579 if (mconfig->formats_config.caps_size > 0 &&
580 mconfig->formats_config.set_params == SKL_PARAM_BIND) {
581 sp_cfg = &mconfig->formats_config;
582 ret = skl_set_module_params(ctx, sp_cfg->caps,
583 sp_cfg->caps_size,
584 sp_cfg->param_id, mconfig);
585 if (ret < 0)
586 return ret;
587 }
588
589 for (i = 0; i < w->num_kcontrols; i++) {
590 k = &w->kcontrol_news[i];
591 if (k->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
592 sb = (void *) k->private_value;
593 bc = (struct skl_algo_data *)sb->dobj.private;
594
595 if (bc->set_params == SKL_PARAM_BIND) {
596 ret = skl_set_module_params(ctx,
597 (u32 *)bc->params, bc->max,
598 bc->param_id, mconfig);
599 if (ret < 0)
600 return ret;
601 }
602 }
603 }
604
605 return 0;
606}
607
548static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w, 608static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w,
549 struct skl *skl, 609 struct skl *skl,
550 struct snd_soc_dapm_widget *src_w, 610 struct snd_soc_dapm_widget *src_w,
@@ -579,11 +639,19 @@ static int skl_tplg_bind_sinks(struct snd_soc_dapm_widget *w,
579 sink = p->sink; 639 sink = p->sink;
580 sink_mconfig = sink->priv; 640 sink_mconfig = sink->priv;
581 641
642 if (src_mconfig->m_state == SKL_MODULE_UNINIT ||
643 sink_mconfig->m_state == SKL_MODULE_UNINIT)
644 continue;
645
582 /* Bind source to sink, mixin is always source */ 646 /* Bind source to sink, mixin is always source */
583 ret = skl_bind_modules(ctx, src_mconfig, sink_mconfig); 647 ret = skl_bind_modules(ctx, src_mconfig, sink_mconfig);
584 if (ret) 648 if (ret)
585 return ret; 649 return ret;
586 650
651 /* set module params after bind */
652 skl_tplg_set_module_bind_params(src_w, src_mconfig, ctx);
653 skl_tplg_set_module_bind_params(sink, sink_mconfig, ctx);
654
587 /* Start sinks pipe first */ 655 /* Start sinks pipe first */
588 if (sink_mconfig->pipe->state != SKL_PIPE_STARTED) { 656 if (sink_mconfig->pipe->state != SKL_PIPE_STARTED) {
589 if (sink_mconfig->pipe->conn_type != 657 if (sink_mconfig->pipe->conn_type !=
@@ -714,6 +782,10 @@ static int skl_tplg_mixer_dapm_post_pmu_event(struct snd_soc_dapm_widget *w,
714 if (ret) 782 if (ret)
715 return ret; 783 return ret;
716 784
785 /* set module params after bind */
786 skl_tplg_set_module_bind_params(source, src_mconfig, ctx);
787 skl_tplg_set_module_bind_params(sink, sink_mconfig, ctx);
788
717 if (sink_mconfig->pipe->conn_type != SKL_PIPE_CONN_TYPE_FE) 789 if (sink_mconfig->pipe->conn_type != SKL_PIPE_CONN_TYPE_FE)
718 ret = skl_run_pipe(ctx, sink_mconfig->pipe); 790 ret = skl_run_pipe(ctx, sink_mconfig->pipe);
719 } 791 }
diff --git a/sound/soc/intel/skylake/skl-tplg-interface.h b/sound/soc/intel/skylake/skl-tplg-interface.h
index c9ae010b3cc8..1db88a63ac17 100644
--- a/sound/soc/intel/skylake/skl-tplg-interface.h
+++ b/sound/soc/intel/skylake/skl-tplg-interface.h
@@ -144,7 +144,8 @@ enum module_pin_type {
144enum skl_module_param_type { 144enum skl_module_param_type {
145 SKL_PARAM_DEFAULT = 0, 145 SKL_PARAM_DEFAULT = 0,
146 SKL_PARAM_INIT, 146 SKL_PARAM_INIT,
147 SKL_PARAM_SET 147 SKL_PARAM_SET,
148 SKL_PARAM_BIND
148}; 149};
149 150
150struct skl_dfw_module_pin { 151struct skl_dfw_module_pin {