OSDN Git Service

ASoC: Intel: Skylake: Select proper format for NHLT blob
authorPiotr Maziarz <piotrx.maziarz@linux.intel.com>
Wed, 18 Aug 2021 07:57:34 +0000 (09:57 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 23 Aug 2021 15:39:57 +0000 (16:39 +0100)
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: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
Signed-off-by: Lewandowski, Gustaw <gustaw.lewandowski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Tested-by: Lukasz Majczak <lma@semihalf.com>
Link: https://lore.kernel.org/r/20210818075742.1515155-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/skl-topology.c

index 45b1521..054c080 100644 (file)
@@ -1821,7 +1821,7 @@ static u8 skl_tplg_be_link_type(int dev_type)
  * Fill the BE gateway parameters
  * 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.
- * 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
  */
 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 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);
        int link_type = skl_tplg_be_link_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,
        if (link_type == NHLT_LINK_HDA)
                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*/
        cfg = skl_get_ep_blob(skl, mconfig->vbus_id, link_type,
-                                       params->s_fmt, params->ch,
-                                       params->s_freq, params->stream,
+                                       pipe_fmt->bps, pipe_fmt->channels,
+                                       pipe_fmt->freq, pipe->direction,
                                        dev_type);
        if (cfg) {
                mconfig->formats_config.caps_size = cfg->size;
                mconfig->formats_config.caps = (u32 *) &cfg->caps;
        } else {
-               dev_err(dai->dev, "Blob NULL for id %x type %d dirn %d\n",
-                                       mconfig->vbus_id, link_type,
-                                       params->stream);
-               dev_err(dai->dev, "PCM: ch %d, freq %d, fmt %d\n",
-                                params->ch, params->s_freq, params->s_fmt);
+               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, params->stream,
+                       params->ch, params->s_freq, params->s_fmt);
                return -EINVAL;
        }