diff options
author | Shreyas NC <shreyas.nc@intel.com> | 2017-08-23 17:03:50 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-08-25 16:53:55 +0300 |
commit | ca312fda690e94c704bcb0e21b73b5d5bd1cf1ff (patch) | |
tree | 075f13567903bf553c1d1d4900c909b57a430684 /sound/soc/intel/skylake/skl-topology.c | |
parent | 3d52a7924172adf651eda8f1c95ff38146059307 (diff) | |
download | linux-ca312fda690e94c704bcb0e21b73b5d5bd1cf1ff.tar.xz |
ASoC: Intel: Skylake: Commonize parsing of format tokens
Format resource tokens can be a part of either the widget or manifest
private data. In the current model, format resources come as a part of
widget private data and they come as a part of topology manifest in the
newly introduced model.
So add a common function that can fill up either of the structures.
Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/skylake/skl-topology.c')
-rw-r--r-- | sound/soc/intel/skylake/skl-topology.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index f14b373f65d7..df808fbf14b5 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -1948,27 +1948,9 @@ static int skl_tplg_fill_pins_info(struct device *dev, * on the direction */ static int skl_tplg_fill_fmt(struct device *dev, - struct skl_module_cfg *mconfig, u32 tkn, - u32 value, u32 dir, u32 pin_count) + struct skl_module_fmt *dst_fmt, + u32 tkn, u32 value) { - struct skl_module_fmt *dst_fmt; - - switch (dir) { - case SKL_DIR_IN: - dst_fmt = mconfig->in_fmt; - dst_fmt += pin_count; - break; - - case SKL_DIR_OUT: - dst_fmt = mconfig->out_fmt; - dst_fmt += pin_count; - break; - - default: - dev_err(dev, "Invalid direction value\n"); - return -EINVAL; - } - switch (tkn) { case SKL_TKN_U32_FMT_CH: dst_fmt->channels = value; @@ -2010,6 +1992,29 @@ static int skl_tplg_fill_fmt(struct device *dev, return 0; } +static int skl_tplg_widget_fill_fmt(struct device *dev, + struct skl_module_cfg *mconfig, + u32 tkn, u32 val, u32 dir, int fmt_idx) +{ + struct skl_module_fmt *dst_fmt; + + switch (dir) { + case SKL_DIR_IN: + dst_fmt = &mconfig->in_fmt[fmt_idx]; + break; + + case SKL_DIR_OUT: + dst_fmt = &mconfig->out_fmt[fmt_idx]; + break; + + default: + dev_err(dev, "Invalid direction: %d\n", dir); + return -EINVAL; + } + + return skl_tplg_fill_fmt(dev, dst_fmt, tkn, val); +} + static int skl_tplg_get_uuid(struct device *dev, struct skl_module_cfg *mconfig, struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn) { @@ -2190,7 +2195,7 @@ static int skl_tplg_get_token(struct device *dev, case SKL_TKN_U32_FMT_INTERLEAVE: case SKL_TKN_U32_FMT_SAMPLE_TYPE: case SKL_TKN_U32_FMT_CH_MAP: - ret = skl_tplg_fill_fmt(dev, mconfig, tkn_elem->token, + ret = skl_tplg_widget_fill_fmt(dev, mconfig, tkn_elem->token, tkn_elem->value, dir, pin_index); if (ret < 0) |