Commit 5b27a71c authored by Pawel Harlozinski's avatar Pawel Harlozinski Committed by Mark Brown

ASoC: Intel: Skylake: Properly configure modules with generic extension

Make use of struct skl_base_cfg_ext and its format setter to configure
modules which are described with said structure.
Signed-off-by: default avatarGustaw Lewandowski <gustaw.lewandowski@linux.intel.com>
Signed-off-by: default avatarPawel Harlozinski <pawel.harlozinski@linux.intel.com>
Signed-off-by: default avatarSzymon Mielczarek <szymonx.mielczarek@intel.com>
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Tested-by: default avatarLukasz Majczak <lma@semihalf.com>
Link: https://lore.kernel.org/r/20210818075742.1515155-11-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent db5a3f83
...@@ -806,27 +806,6 @@ static void skl_set_copier_format(struct skl_dev *skl, ...@@ -806,27 +806,6 @@ static void skl_set_copier_format(struct skl_dev *skl,
skl_setup_cpr_gateway_cfg(skl, mconfig, cpr_mconfig); skl_setup_cpr_gateway_cfg(skl, mconfig, cpr_mconfig);
} }
/*
* Algo module are DSP pre processing modules. Algo module take base module
* configuration and params
*/
static void skl_set_algo_format(struct skl_dev *skl,
struct skl_module_cfg *mconfig,
struct skl_algo_cfg *algo_mcfg)
{
struct skl_base_cfg *base_cfg = (struct skl_base_cfg *)algo_mcfg;
skl_set_base_module_format(skl, mconfig, base_cfg);
if (mconfig->formats_config[SKL_PARAM_INIT].caps_size == 0)
return;
memcpy(algo_mcfg->params,
mconfig->formats_config[SKL_PARAM_INIT].caps,
mconfig->formats_config[SKL_PARAM_INIT].caps_size);
}
/* /*
* Mic select module allows selecting one or many input channels, thus * Mic select module allows selecting one or many input channels, thus
* acting as a demux. * acting as a demux.
...@@ -849,6 +828,8 @@ static void skl_set_base_outfmt_format(struct skl_dev *skl, ...@@ -849,6 +828,8 @@ static void skl_set_base_outfmt_format(struct skl_dev *skl,
static u16 skl_get_module_param_size(struct skl_dev *skl, static u16 skl_get_module_param_size(struct skl_dev *skl,
struct skl_module_cfg *mconfig) struct skl_module_cfg *mconfig)
{ {
struct skl_module_res *res;
struct skl_module *module = mconfig->module;
u16 param_size; u16 param_size;
switch (mconfig->m_type) { switch (mconfig->m_type) {
...@@ -863,11 +844,6 @@ static u16 skl_get_module_param_size(struct skl_dev *skl, ...@@ -863,11 +844,6 @@ static u16 skl_get_module_param_size(struct skl_dev *skl,
case SKL_MODULE_TYPE_UPDWMIX: case SKL_MODULE_TYPE_UPDWMIX:
return sizeof(struct skl_up_down_mixer_cfg); return sizeof(struct skl_up_down_mixer_cfg);
case SKL_MODULE_TYPE_ALGO:
param_size = sizeof(struct skl_base_cfg);
param_size += mconfig->formats_config[SKL_PARAM_INIT].caps_size;
return param_size;
case SKL_MODULE_TYPE_BASE_OUTFMT: case SKL_MODULE_TYPE_BASE_OUTFMT:
case SKL_MODULE_TYPE_MIC_SELECT: case SKL_MODULE_TYPE_MIC_SELECT:
return sizeof(struct skl_base_outfmt_cfg); return sizeof(struct skl_base_outfmt_cfg);
...@@ -876,12 +852,16 @@ static u16 skl_get_module_param_size(struct skl_dev *skl, ...@@ -876,12 +852,16 @@ static u16 skl_get_module_param_size(struct skl_dev *skl,
case SKL_MODULE_TYPE_KPB: case SKL_MODULE_TYPE_KPB:
return sizeof(struct skl_base_cfg); return sizeof(struct skl_base_cfg);
case SKL_MODULE_TYPE_ALGO:
default: default:
/* res = &module->resources[mconfig->res_idx];
* return only base cfg when no specific module type is
* specified param_size = sizeof(struct skl_base_cfg) + sizeof(struct skl_base_cfg_ext);
*/ param_size += (res->nr_input_pins + res->nr_output_pins) *
return sizeof(struct skl_base_cfg); sizeof(struct skl_pin_format);
param_size += mconfig->formats_config[SKL_PARAM_INIT].caps_size;
return param_size;
} }
return 0; return 0;
...@@ -922,10 +902,6 @@ static int skl_set_module_format(struct skl_dev *skl, ...@@ -922,10 +902,6 @@ static int skl_set_module_format(struct skl_dev *skl,
skl_set_updown_mixer_format(skl, module_config, *param_data); skl_set_updown_mixer_format(skl, module_config, *param_data);
break; break;
case SKL_MODULE_TYPE_ALGO:
skl_set_algo_format(skl, module_config, *param_data);
break;
case SKL_MODULE_TYPE_BASE_OUTFMT: case SKL_MODULE_TYPE_BASE_OUTFMT:
case SKL_MODULE_TYPE_MIC_SELECT: case SKL_MODULE_TYPE_MIC_SELECT:
skl_set_base_outfmt_format(skl, module_config, *param_data); skl_set_base_outfmt_format(skl, module_config, *param_data);
...@@ -936,10 +912,13 @@ static int skl_set_module_format(struct skl_dev *skl, ...@@ -936,10 +912,13 @@ static int skl_set_module_format(struct skl_dev *skl,
skl_set_base_module_format(skl, module_config, *param_data); skl_set_base_module_format(skl, module_config, *param_data);
break; break;
case SKL_MODULE_TYPE_ALGO:
default: default:
skl_set_base_module_format(skl, module_config, *param_data); skl_set_base_module_format(skl, module_config, *param_data);
skl_set_base_ext_module_format(skl, module_config,
*param_data +
sizeof(struct skl_base_cfg));
break; break;
} }
dev_dbg(skl->dev, "Module type=%d id=%d config size: %d bytes\n", dev_dbg(skl->dev, "Module type=%d id=%d config size: %d bytes\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment