Skip to content

Commit e8b374b

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: Skylake: Fix module resource and format selection
Module configuration may differ between its instances depending on resources required and input and output audio format. Available parameters to select from are stored in module resource and interface (format) lists. These come from topology, together with description of each of pipe's modules. Ignoring index value provided by topology and relying always on 0th entry leads to unexpected module behavior due to under/overbudged resources assigned or impropper format selection. Fix by taking entry at index specified by topology. Fixes: f6fa56e ("ASoC: Intel: Skylake: Parse and update module config structure") Signed-off-by: Cezary Rojewski <[email protected]> Tested-by: Lukasz Majczak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 87b2652 commit e8b374b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

sound/soc/intel/skylake/skl-topology.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static int is_skl_dsp_widget_type(struct snd_soc_dapm_widget *w,
113113

114114
static void skl_dump_mconfig(struct skl_dev *skl, struct skl_module_cfg *mcfg)
115115
{
116-
struct skl_module_iface *iface = &mcfg->module->formats[0];
116+
struct skl_module_iface *iface = &mcfg->module->formats[mcfg->fmt_idx];
117117

118118
dev_dbg(skl->dev, "Dumping config\n");
119119
dev_dbg(skl->dev, "Input Format:\n");
@@ -195,8 +195,8 @@ static void skl_tplg_update_params_fixup(struct skl_module_cfg *m_cfg,
195195
struct skl_module_fmt *in_fmt, *out_fmt;
196196

197197
/* Fixups will be applied to pin 0 only */
198-
in_fmt = &m_cfg->module->formats[0].inputs[0].fmt;
199-
out_fmt = &m_cfg->module->formats[0].outputs[0].fmt;
198+
in_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].inputs[0].fmt;
199+
out_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].outputs[0].fmt;
200200

201201
if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) {
202202
if (is_fe) {
@@ -239,9 +239,9 @@ static void skl_tplg_update_buffer_size(struct skl_dev *skl,
239239
/* Since fixups is applied to pin 0 only, ibs, obs needs
240240
* change for pin 0 only
241241
*/
242-
res = &mcfg->module->resources[0];
243-
in_fmt = &mcfg->module->formats[0].inputs[0].fmt;
244-
out_fmt = &mcfg->module->formats[0].outputs[0].fmt;
242+
res = &mcfg->module->resources[mcfg->res_idx];
243+
in_fmt = &mcfg->module->formats[mcfg->fmt_idx].inputs[0].fmt;
244+
out_fmt = &mcfg->module->formats[mcfg->fmt_idx].outputs[0].fmt;
245245

246246
if (mcfg->m_type == SKL_MODULE_TYPE_SRCINT)
247247
multiplier = 5;
@@ -1631,11 +1631,12 @@ int skl_tplg_update_pipe_params(struct device *dev,
16311631
struct skl_module_cfg *mconfig,
16321632
struct skl_pipe_params *params)
16331633
{
1634-
struct skl_module_res *res = &mconfig->module->resources[0];
1634+
struct skl_module_res *res;
16351635
struct skl_dev *skl = get_skl_ctx(dev);
16361636
struct skl_module_fmt *format = NULL;
16371637
u8 cfg_idx = mconfig->pipe->cur_config_idx;
16381638

1639+
res = &mconfig->module->resources[mconfig->res_idx];
16391640
skl_tplg_fill_dma_id(mconfig, params);
16401641
mconfig->fmt_idx = mconfig->mod_cfg[cfg_idx].fmt_idx;
16411642
mconfig->res_idx = mconfig->mod_cfg[cfg_idx].res_idx;
@@ -1644,9 +1645,9 @@ int skl_tplg_update_pipe_params(struct device *dev,
16441645
return 0;
16451646

16461647
if (params->stream == SNDRV_PCM_STREAM_PLAYBACK)
1647-
format = &mconfig->module->formats[0].inputs[0].fmt;
1648+
format = &mconfig->module->formats[mconfig->fmt_idx].inputs[0].fmt;
16481649
else
1649-
format = &mconfig->module->formats[0].outputs[0].fmt;
1650+
format = &mconfig->module->formats[mconfig->fmt_idx].outputs[0].fmt;
16501651

16511652
/* set the hw_params */
16521653
format->s_freq = params->s_freq;

0 commit comments

Comments
 (0)