Skip to content

Commit 4ac587f

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: Skylake: Introduce single place for pipe-config selection
Provide a single location for pipe config selection where all fields that have to be updated whenever ->pipe_config_idx changes can be updated accordingly. 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 75ab3c0 commit 4ac587f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,12 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl,
582582
return ret;
583583
}
584584

585+
static void skl_tplg_set_pipe_config_idx(struct skl_pipe *pipe, int idx)
586+
{
587+
pipe->cur_config_idx = idx;
588+
pipe->memory_pages = pipe->configs[idx].mem_pages;
589+
}
590+
585591
/*
586592
* Here, we select pipe format based on the pipe type and pipe
587593
* direction to determine the current config index for the pipeline.
@@ -600,16 +606,14 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig)
600606
int i;
601607

602608
if (pipe->nr_cfgs == 0) {
603-
pipe->cur_config_idx = 0;
609+
skl_tplg_set_pipe_config_idx(pipe, 0);
604610
return 0;
605611
}
606612

607613
if (pipe->conn_type == SKL_PIPE_CONN_TYPE_NONE || pipe->nr_cfgs == 1) {
608614
dev_dbg(skl->dev, "No conn_type or just 1 pathcfg, taking 0th for %d\n",
609615
pipe->ppl_id);
610-
pipe->cur_config_idx = 0;
611-
pipe->memory_pages = pconfig->mem_pages;
612-
616+
skl_tplg_set_pipe_config_idx(pipe, 0);
613617
return 0;
614618
}
615619

@@ -628,10 +632,8 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig)
628632

629633
if (CHECK_HW_PARAMS(params->ch, params->s_freq, params->s_fmt,
630634
fmt->channels, fmt->freq, fmt->bps)) {
631-
pipe->cur_config_idx = i;
632-
pipe->memory_pages = pconfig->mem_pages;
635+
skl_tplg_set_pipe_config_idx(pipe, i);
633636
dev_dbg(skl->dev, "Using pipe config: %d\n", i);
634-
635637
return 0;
636638
}
637639
}
@@ -1351,7 +1353,7 @@ static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol,
13511353
return -EIO;
13521354

13531355
if (is_set)
1354-
pipe->cur_config_idx = ucontrol->value.enumerated.item[0];
1356+
skl_tplg_set_pipe_config_idx(pipe, ucontrol->value.enumerated.item[0]);
13551357
else
13561358
ucontrol->value.enumerated.item[0] = pipe->cur_config_idx;
13571359

0 commit comments

Comments
 (0)