Commit 87b26526 authored by Piotr Maziarz's avatar Piotr Maziarz Committed by Mark Brown

ASoC: Intel: Skylake: Select proper format for NHLT blob

Use actual pipeline format, not PCM format for blob selection. Otherwise
selected blobs are not correct in pipelines with format conversion
e.g.: SRC module.
Signed-off-by: default avatarPiotr Maziarz <piotrx.maziarz@linux.intel.com>
Signed-off-by: default avatarLewandowski, Gustaw <gustaw.lewandowski@linux.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-4-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 126b3422
...@@ -1821,7 +1821,7 @@ static u8 skl_tplg_be_link_type(int dev_type) ...@@ -1821,7 +1821,7 @@ static u8 skl_tplg_be_link_type(int dev_type)
* Fill the BE gateway parameters * Fill the BE gateway parameters
* The BE gateway expects a blob of parameters which are kept in the ACPI * The BE gateway expects a blob of parameters which are kept in the ACPI
* NHLT blob, so query the blob for interface type (i2s/pdm) and instance. * NHLT blob, so query the blob for interface type (i2s/pdm) and instance.
* The port can have multiple settings so pick based on the PCM * The port can have multiple settings so pick based on the pipeline
* parameters * parameters
*/ */
static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai, static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai,
...@@ -1829,6 +1829,8 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai, ...@@ -1829,6 +1829,8 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai,
struct skl_pipe_params *params) struct skl_pipe_params *params)
{ {
struct nhlt_specific_cfg *cfg; struct nhlt_specific_cfg *cfg;
struct skl_pipe *pipe = mconfig->pipe;
struct skl_pipe_fmt *pipe_fmt;
struct skl_dev *skl = get_skl_ctx(dai->dev); struct skl_dev *skl = get_skl_ctx(dai->dev);
int link_type = skl_tplg_be_link_type(mconfig->dev_type); int link_type = skl_tplg_be_link_type(mconfig->dev_type);
u8 dev_type = skl_tplg_be_dev_type(mconfig->dev_type); u8 dev_type = skl_tplg_be_dev_type(mconfig->dev_type);
...@@ -1838,20 +1840,23 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai, ...@@ -1838,20 +1840,23 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai,
if (link_type == NHLT_LINK_HDA) if (link_type == NHLT_LINK_HDA)
return 0; return 0;
if (pipe->direction == SNDRV_PCM_STREAM_PLAYBACK)
pipe_fmt = &pipe->configs[pipe->pipe_config_idx].out_fmt;
else
pipe_fmt = &pipe->configs[pipe->pipe_config_idx].in_fmt;
/* update the blob based on virtual bus_id*/ /* update the blob based on virtual bus_id*/
cfg = skl_get_ep_blob(skl, mconfig->vbus_id, link_type, cfg = skl_get_ep_blob(skl, mconfig->vbus_id, link_type,
params->s_fmt, params->ch, pipe_fmt->bps, pipe_fmt->channels,
params->s_freq, params->stream, pipe_fmt->freq, pipe->direction,
dev_type); dev_type);
if (cfg) { if (cfg) {
mconfig->formats_config.caps_size = cfg->size; mconfig->formats_config.caps_size = cfg->size;
mconfig->formats_config.caps = (u32 *) &cfg->caps; mconfig->formats_config.caps = (u32 *) &cfg->caps;
} else { } else {
dev_err(dai->dev, "Blob NULL for id %x type %d dirn %d\n", dev_err(dai->dev, "Blob NULL for id:%d type:%d dirn:%d ch:%d, freq:%d, fmt:%d\n",
mconfig->vbus_id, link_type, mconfig->vbus_id, link_type, params->stream,
params->stream); params->ch, params->s_freq, params->s_fmt);
dev_err(dai->dev, "PCM: ch %d, freq %d, fmt %d\n",
params->ch, params->s_freq, params->s_fmt);
return -EINVAL; return -EINVAL;
} }
......
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