mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
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 <cezary.rojewski@intel.com> Tested-by: Lukasz Majczak <lma@semihlaf.com> Link: https://lore.kernel.org/r/20221205085330.857665-5-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
75ab3c0076
commit
4ac587f357
1 changed files with 10 additions and 8 deletions
|
@ -582,6 +582,12 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void skl_tplg_set_pipe_config_idx(struct skl_pipe *pipe, int idx)
|
||||||
|
{
|
||||||
|
pipe->cur_config_idx = idx;
|
||||||
|
pipe->memory_pages = pipe->configs[idx].mem_pages;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here, we select pipe format based on the pipe type and pipe
|
* Here, we select pipe format based on the pipe type and pipe
|
||||||
* direction to determine the current config index for the pipeline.
|
* 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)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (pipe->nr_cfgs == 0) {
|
if (pipe->nr_cfgs == 0) {
|
||||||
pipe->cur_config_idx = 0;
|
skl_tplg_set_pipe_config_idx(pipe, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipe->conn_type == SKL_PIPE_CONN_TYPE_NONE || pipe->nr_cfgs == 1) {
|
if (pipe->conn_type == SKL_PIPE_CONN_TYPE_NONE || pipe->nr_cfgs == 1) {
|
||||||
dev_dbg(skl->dev, "No conn_type or just 1 pathcfg, taking 0th for %d\n",
|
dev_dbg(skl->dev, "No conn_type or just 1 pathcfg, taking 0th for %d\n",
|
||||||
pipe->ppl_id);
|
pipe->ppl_id);
|
||||||
pipe->cur_config_idx = 0;
|
skl_tplg_set_pipe_config_idx(pipe, 0);
|
||||||
pipe->memory_pages = pconfig->mem_pages;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,10 +632,8 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig)
|
||||||
|
|
||||||
if (CHECK_HW_PARAMS(params->ch, params->s_freq, params->s_fmt,
|
if (CHECK_HW_PARAMS(params->ch, params->s_freq, params->s_fmt,
|
||||||
fmt->channels, fmt->freq, fmt->bps)) {
|
fmt->channels, fmt->freq, fmt->bps)) {
|
||||||
pipe->cur_config_idx = i;
|
skl_tplg_set_pipe_config_idx(pipe, i);
|
||||||
pipe->memory_pages = pconfig->mem_pages;
|
|
||||||
dev_dbg(skl->dev, "Using pipe config: %d\n", i);
|
dev_dbg(skl->dev, "Using pipe config: %d\n", i);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1351,7 +1353,7 @@ static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (is_set)
|
if (is_set)
|
||||||
pipe->cur_config_idx = ucontrol->value.enumerated.item[0];
|
skl_tplg_set_pipe_config_idx(pipe, ucontrol->value.enumerated.item[0]);
|
||||||
else
|
else
|
||||||
ucontrol->value.enumerated.item[0] = pipe->cur_config_idx;
|
ucontrol->value.enumerated.item[0] = pipe->cur_config_idx;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue