aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDharageswari.R <dharageswari.r@intel.com>2016-02-05 01:49:06 -0500
committerMark Brown <broonie@kernel.org>2016-02-08 11:44:17 -0500
commit718a42b5eaddb3180e2589590732d61e047858fb (patch)
tree18ac6a901a9104b4e6124534105386c429561a22
parent4fdf810fc5c82f57aa7c54ac9384f1201087724a (diff)
ASoC: Intel: Skylake: Add skl_tplg_be_get_cpr_module() helper
An I2S port can be connected to multiple BE pipes, get module config only for the active BE pipe. This helpers helps to do that and is used in subsequent patches Signed-off-by: Dharageswari R <dharageswari.r@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.c60
-rw-r--r--sound/soc/intel/skylake/skl-topology.h2
2 files changed, 62 insertions, 0 deletions
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index a294fee431f0..5c8661450349 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1091,6 +1091,66 @@ skl_tplg_fe_get_cpr_module(struct snd_soc_dai *dai, int stream)
1091 return NULL; 1091 return NULL;
1092} 1092}
1093 1093
1094static struct skl_module_cfg *skl_get_mconfig_pb_cpr(
1095 struct snd_soc_dai *dai, struct snd_soc_dapm_widget *w)
1096{
1097 struct snd_soc_dapm_path *p;
1098 struct skl_module_cfg *mconfig = NULL;
1099
1100 snd_soc_dapm_widget_for_each_source_path(w, p) {
1101 if (w->endpoints[SND_SOC_DAPM_DIR_OUT] > 0) {
1102 if (p->connect &&
1103 (p->sink->id == snd_soc_dapm_aif_out) &&
1104 p->source->priv) {
1105 mconfig = p->source->priv;
1106 return mconfig;
1107 }
1108 mconfig = skl_get_mconfig_pb_cpr(dai, p->source);
1109 if (mconfig)
1110 return mconfig;
1111 }
1112 }
1113 return mconfig;
1114}
1115
1116static struct skl_module_cfg *skl_get_mconfig_cap_cpr(
1117 struct snd_soc_dai *dai, struct snd_soc_dapm_widget *w)
1118{
1119 struct snd_soc_dapm_path *p;
1120 struct skl_module_cfg *mconfig = NULL;
1121
1122 snd_soc_dapm_widget_for_each_sink_path(w, p) {
1123 if (w->endpoints[SND_SOC_DAPM_DIR_IN] > 0) {
1124 if (p->connect &&
1125 (p->source->id == snd_soc_dapm_aif_in) &&
1126 p->sink->priv) {
1127 mconfig = p->sink->priv;
1128 return mconfig;
1129 }
1130 mconfig = skl_get_mconfig_cap_cpr(dai, p->sink);
1131 if (mconfig)
1132 return mconfig;
1133 }
1134 }
1135 return mconfig;
1136}
1137
1138struct skl_module_cfg *
1139skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai, int stream)
1140{
1141 struct snd_soc_dapm_widget *w;
1142 struct skl_module_cfg *mconfig;
1143
1144 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
1145 w = dai->playback_widget;
1146 mconfig = skl_get_mconfig_pb_cpr(dai, w);
1147 } else {
1148 w = dai->capture_widget;
1149 mconfig = skl_get_mconfig_cap_cpr(dai, w);
1150 }
1151 return mconfig;
1152}
1153
1094static u8 skl_tplg_be_link_type(int dev_type) 1154static u8 skl_tplg_be_link_type(int dev_type)
1095{ 1155{
1096 int ret; 1156 int ret;
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
index 9aa2a2b6598a..5f0707cf1f54 100644
--- a/sound/soc/intel/skylake/skl-topology.h
+++ b/sound/soc/intel/skylake/skl-topology.h
@@ -345,5 +345,7 @@ int skl_set_module_params(struct skl_sst *ctx, u32 *params, int size,
345int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size, 345int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size,
346 u32 param_id, struct skl_module_cfg *mcfg); 346 u32 param_id, struct skl_module_cfg *mcfg);
347 347
348struct skl_module_cfg *skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai,
349 int stream);
348enum skl_bitdepth skl_get_bit_depth(int params); 350enum skl_bitdepth skl_get_bit_depth(int params);
349#endif 351#endif