Merge branch 'asoc-4.17' into asoc-4.18 for compress dependencies
[muen/linux.git] / sound / soc / soc-topology.c
index 986b8b2f90fba577cce10462e75ad9966258b49f..f25ea9aab235a8e65bfad4885940aaa6ffda37f2 100644 (file)
@@ -1754,6 +1754,9 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
                set_stream_info(stream, caps);
        }
 
+       if (pcm->compress)
+               dai_drv->compress_new = snd_soc_new_compress;
+
        /* pass control to component driver for optional further init */
        ret = soc_tplg_dai_load(tplg, dai_drv);
        if (ret < 0) {
@@ -2006,6 +2009,21 @@ static void set_link_hw_format(struct snd_soc_dai_link *link,
 
                link->dai_fmt = hw_config->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
 
+               /* clock gating */
+               switch (hw_config->clock_gated) {
+               case SND_SOC_TPLG_DAI_CLK_GATE_GATED:
+                       link->dai_fmt |= SND_SOC_DAIFMT_GATED;
+                       break;
+
+               case SND_SOC_TPLG_DAI_CLK_GATE_CONT:
+                       link->dai_fmt |= SND_SOC_DAIFMT_CONT;
+                       break;
+
+               default:
+                       /* ignore the value */
+                       break;
+               }
+
                /* clock signal polarity */
                invert_bclk = hw_config->invert_bclk;
                invert_fsync = hw_config->invert_fsync;
@@ -2019,13 +2037,15 @@ static void set_link_hw_format(struct snd_soc_dai_link *link,
                        link->dai_fmt |= SND_SOC_DAIFMT_IB_IF;
 
                /* clock masters */
-               bclk_master = hw_config->bclk_master;
-               fsync_master = hw_config->fsync_master;
-               if (!bclk_master && !fsync_master)
+               bclk_master = (hw_config->bclk_master ==
+                              SND_SOC_TPLG_BCLK_CM);
+               fsync_master = (hw_config->fsync_master ==
+                               SND_SOC_TPLG_FSYNC_CM);
+               if (bclk_master && fsync_master)
                        link->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
-               else if (bclk_master && !fsync_master)
-                       link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
                else if (!bclk_master && fsync_master)
+                       link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFM;
+               else if (bclk_master && !fsync_master)
                        link->dai_fmt |= SND_SOC_DAIFMT_CBM_CFS;
                else
                        link->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;