]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Merge remote-tracking branch 'asoc/topic/intel' into asoc-next
authorMark Brown <broonie@kernel.org>
Fri, 10 Nov 2017 21:30:53 +0000 (21:30 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 10 Nov 2017 21:30:53 +0000 (21:30 +0000)
1  2 
include/sound/soc.h
sound/soc/Makefile
sound/soc/intel/Makefile
sound/soc/intel/boards/cht_bsw_max98090_ti.c
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
sound/soc/intel/common/Makefile
sound/soc/intel/skylake/skl-messages.c
sound/soc/intel/skylake/skl-pcm.c
sound/soc/intel/skylake/skl-topology.c
sound/soc/intel/skylake/skl-topology.h

diff --combined include/sound/soc.h
index 0668cbd9f0b525b3b7654775621a14b7e83a916d,deacbafbae1709f400ffb1e47d7a3834d8b82614..1a7323238c495d7d51313f6ccd8780291ff3e9e5
@@@ -468,11 -468,6 +468,11 @@@ int snd_soc_register_codec(struct devic
                const struct snd_soc_codec_driver *codec_drv,
                struct snd_soc_dai_driver *dai_drv, int num_dai);
  void snd_soc_unregister_codec(struct device *dev);
 +int snd_soc_add_component(struct device *dev,
 +              struct snd_soc_component *component,
 +              const struct snd_soc_component_driver *component_driver,
 +              struct snd_soc_dai_driver *dai_drv,
 +              int num_dai);
  int snd_soc_register_component(struct device *dev,
                         const struct snd_soc_component_driver *component_driver,
                         struct snd_soc_dai_driver *dai_drv, int num_dai);
@@@ -480,8 -475,6 +480,8 @@@ int devm_snd_soc_register_component(str
                         const struct snd_soc_component_driver *component_driver,
                         struct snd_soc_dai_driver *dai_drv, int num_dai);
  void snd_soc_unregister_component(struct device *dev);
 +struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
 +                                                 const char *driver_name);
  int snd_soc_cache_init(struct snd_soc_codec *codec);
  int snd_soc_cache_exit(struct snd_soc_codec *codec);
  
@@@ -802,10 -795,6 +802,10 @@@ struct snd_soc_component_driver 
        int (*suspend)(struct snd_soc_component *);
        int (*resume)(struct snd_soc_component *);
  
 +      /* pcm creation and destruction */
 +      int (*pcm_new)(struct snd_soc_pcm_runtime *);
 +      void (*pcm_free)(struct snd_pcm *);
 +
        /* component wide operations */
        int (*set_sysclk)(struct snd_soc_component *component,
                          int clk_id, int source, unsigned int freq, int dir);
        void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
                int subseq);
        int (*stream_event)(struct snd_soc_component *, int event);
 +      int (*set_bias_level)(struct snd_soc_component *component,
 +                            enum snd_soc_bias_level level);
 +
 +      const struct snd_pcm_ops *ops;
 +      const struct snd_compr_ops *compr_ops;
  
        /* probe ordering - for components with runtime dependencies */
        int probe_order;
        int remove_order;
 +
 +      /* bits */
 +      unsigned int idle_bias_on:1;
 +      unsigned int suspend_bias_off:1;
 +      unsigned int pmdown_time:1; /* care pmdown_time at stop */
 +      unsigned int endianness:1;
 +      unsigned int non_legacy_dai_naming:1;
  };
  
  struct snd_soc_component {
        void (*remove)(struct snd_soc_component *);
        int (*suspend)(struct snd_soc_component *);
        int (*resume)(struct snd_soc_component *);
 +      int (*pcm_new)(struct snd_soc_component *, struct snd_soc_pcm_runtime *);
 +      void (*pcm_free)(struct snd_soc_component *, struct snd_pcm *);
  
        int (*set_sysclk)(struct snd_soc_component *component,
                          int clk_id, int source, unsigned int freq, int dir);
                       int source, unsigned int freq_in, unsigned int freq_out);
        int (*set_jack)(struct snd_soc_component *component,
                        struct snd_soc_jack *jack,  void *data);
 +      int (*set_bias_level)(struct snd_soc_component *component,
 +                            enum snd_soc_bias_level level);
  
        /* machine specific init */
        int (*init)(struct snd_soc_component *component);
@@@ -1439,21 -1412,6 +1439,21 @@@ static inline void snd_soc_codec_init_b
        snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level);
  }
  
 +/**
 + * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level
 + * @component: The COMPONENT for which to initialize the DAPM bias level
 + * @level: The DAPM level to initialize to
 + *
 + * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level().
 + */
 +static inline void
 +snd_soc_component_init_bias_level(struct snd_soc_component *component,
 +                                enum snd_soc_bias_level level)
 +{
 +      snd_soc_dapm_init_bias_level(
 +              snd_soc_component_get_dapm(component), level);
 +}
 +
  /**
   * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level
   * @codec: The CODEC for which to get the DAPM bias level
@@@ -1466,19 -1424,6 +1466,19 @@@ static inline enum snd_soc_bias_level s
        return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec));
  }
  
 +/**
 + * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level
 + * @component: The COMPONENT for which to get the DAPM bias level
 + *
 + * Returns: The current DAPM bias level of the COMPONENT.
 + */
 +static inline enum snd_soc_bias_level
 +snd_soc_component_get_bias_level(struct snd_soc_component *component)
 +{
 +      return snd_soc_dapm_get_bias_level(
 +              snd_soc_component_get_dapm(component));
 +}
 +
  /**
   * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level
   * @codec: The CODEC for which to set the level
@@@ -1494,23 -1439,6 +1494,23 @@@ static inline int snd_soc_codec_force_b
                level);
  }
  
 +/**
 + * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level
 + * @component: The COMPONENT for which to set the level
 + * @level: The level to set to
 + *
 + * Forces the COMPONENT bias level to a specific state. See
 + * snd_soc_dapm_force_bias_level().
 + */
 +static inline int
 +snd_soc_component_force_bias_level(struct snd_soc_component *component,
 +                                 enum snd_soc_bias_level level)
 +{
 +      return snd_soc_dapm_force_bias_level(
 +              snd_soc_component_get_dapm(component),
 +              level);
 +}
 +
  /**
   * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
   * @kcontrol: The kcontrol
@@@ -1524,19 -1452,6 +1524,19 @@@ static inline struct snd_soc_codec *snd
        return snd_soc_dapm_to_codec(snd_soc_dapm_kcontrol_dapm(kcontrol));
  }
  
 +/**
 + * snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol
 + * @kcontrol: The kcontrol
 + *
 + * This function must only be used on DAPM contexts that are known to be part of
 + * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined.
 + */
 +static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component(
 +      struct snd_kcontrol *kcontrol)
 +{
 +      return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol));
 +}
 +
  /* codec IO */
  unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
  int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
@@@ -1553,23 -1468,9 +1553,23 @@@ static inline int snd_soc_cache_sync(st
        return regcache_sync(codec->component.regmap);
  }
  
 +/**
 + * snd_soc_component_cache_sync() - Sync the register cache with the hardware
 + * @component: COMPONENT to sync
 + *
 + * Note: This function will call regcache_sync()
 + */
 +static inline int snd_soc_component_cache_sync(
 +      struct snd_soc_component *component)
 +{
 +      return regcache_sync(component->regmap);
 +}
 +
  /* component IO */
  int snd_soc_component_read(struct snd_soc_component *component,
        unsigned int reg, unsigned int *val);
 +unsigned int snd_soc_component_read32(struct snd_soc_component *component,
 +                                    unsigned int reg);
  int snd_soc_component_write(struct snd_soc_component *component,
        unsigned int reg, unsigned int val);
  int snd_soc_component_update_bits(struct snd_soc_component *component,
@@@ -1586,8 -1487,6 +1586,8 @@@ int snd_soc_component_set_sysclk(struc
  int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,
                              int source, unsigned int freq_in,
                              unsigned int freq_out);
 +int snd_soc_component_set_jack(struct snd_soc_component *component,
 +                             struct snd_soc_jack *jack, void *data);
  
  #ifdef CONFIG_REGMAP
  
@@@ -1821,6 -1720,20 +1821,20 @@@ struct snd_soc_dai *snd_soc_find_dai
  
  #include <sound/soc-dai.h>
  
+ static inline
+ struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
+                                              const char *dai_name)
+ {
+       struct snd_soc_pcm_runtime *rtd;
+       list_for_each_entry(rtd, &card->rtd_list, list) {
+               if (!strcmp(rtd->codec_dai->name, dai_name))
+                       return rtd->codec_dai;
+       }
+       return NULL;
+ }
  #ifdef CONFIG_DEBUG_FS
  extern struct dentry *snd_soc_debugfs_root;
  #endif
diff --combined sound/soc/Makefile
index bf8c1e2ce0bfd9c294a8f622da99dcdc49cf1e8d,95f2a73f9aed116f22273fde97e4f69d5e3b7cb2..5327f4d6c668b6e6180849cd60e5d7de969089e1
@@@ -1,4 -1,3 +1,4 @@@
 +# SPDX-License-Identifier: GPL-2.0
  snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o
  snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o
  snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
@@@ -15,6 -14,12 +15,12 @@@ ifneq ($(CONFIG_SND_SOC_AC97_BUS),
  snd-soc-core-objs += soc-ac97.o
  endif
  
+ ifneq ($(CONFIG_SND_SOC_ACPI),)
+ snd-soc-acpi-objs := soc-acpi.o
+ endif
+ obj-$(CONFIG_SND_SOC_ACPI) += snd-soc-acpi.o
  obj-$(CONFIG_SND_SOC) += snd-soc-core.o
  obj-$(CONFIG_SND_SOC) += codecs/
  obj-$(CONFIG_SND_SOC) += generic/
diff --combined sound/soc/intel/Makefile
index 62f37ffffdf00c95ad4f92f584ed85239abae4d0,9105594436f0c4b53a8d3f436565ee49ee3b6985..b973d457e834a7719ed47fd737d5b216ab4285dd
@@@ -1,6 -1,5 +1,6 @@@
 +# SPDX-License-Identifier: GPL-2.0
  # Core support
- obj-$(CONFIG_SND_SOC_INTEL_SST) += common/
+ obj-$(CONFIG_SND_SOC_INTEL_COMMON) += common/
  
  # Platform Support
  obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += haswell/
index 455a55af7ad2d1949edebd4191a6cfa90f59900d,14dd68edfce4a0a13508e8d53da18cca335cdef9..d3e1c7e12004dded46fd24ac9345758cea556233
@@@ -23,6 -23,7 +23,7 @@@
  #include <linux/platform_device.h>
  #include <linux/slab.h>
  #include <linux/acpi.h>
+ #include <linux/clk.h>
  #include <sound/pcm.h>
  #include <sound/pcm_params.h>
  #include <sound/soc.h>
  #define CHT_CODEC_DAI "HiFi"
  
  struct cht_mc_private {
+       struct clk *mclk;
        struct snd_soc_jack jack;
        bool ts3a227e_present;
  };
  
+ static int platform_clock_control(struct snd_soc_dapm_widget *w,
+                                         struct snd_kcontrol *k, int  event)
+ {
+       struct snd_soc_dapm_context *dapm = w->dapm;
+       struct snd_soc_card *card = dapm->card;
+       struct snd_soc_dai *codec_dai;
+       struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
+       int ret;
+       codec_dai = snd_soc_card_get_codec_dai(card, CHT_CODEC_DAI);
+       if (!codec_dai) {
+               dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n");
+               return -EIO;
+       }
+       if (SND_SOC_DAPM_EVENT_ON(event)) {
+               ret = clk_prepare_enable(ctx->mclk);
+               if (ret < 0) {
+                       dev_err(card->dev,
+                               "could not configure MCLK state");
+                       return ret;
+               }
+       } else {
+               clk_disable_unprepare(ctx->mclk);
+       }
+       return 0;
+ }
  static const struct snd_soc_dapm_widget cht_dapm_widgets[] = {
        SND_SOC_DAPM_HP("Headphone", NULL),
        SND_SOC_DAPM_MIC("Headset Mic", NULL),
        SND_SOC_DAPM_MIC("Int Mic", NULL),
        SND_SOC_DAPM_SPK("Ext Spk", NULL),
+       SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
+                           platform_clock_control, SND_SOC_DAPM_PRE_PMU |
+                           SND_SOC_DAPM_POST_PMD),
  };
  
  static const struct snd_soc_dapm_route cht_audio_map[] = {
        {"codec_in0", NULL, "ssp2 Rx" },
        {"codec_in1", NULL, "ssp2 Rx" },
        {"ssp2 Rx", NULL, "HiFi Capture"},
+       {"Headphone", NULL, "Platform Clock"},
+       {"Headset Mic", NULL, "Platform Clock"},
+       {"Int Mic", NULL, "Platform Clock"},
+       {"Ext Spk", NULL, "Platform Clock"},
  };
  
  static const struct snd_kcontrol_new cht_mc_controls[] = {
@@@ -109,6 -147,40 +147,40 @@@ static struct notifier_block cht_jack_n
        .notifier_call = cht_ti_jack_event,
  };
  
+ static struct snd_soc_jack_pin hs_jack_pins[] = {
+       {
+               .pin    = "Headphone",
+               .mask   = SND_JACK_HEADPHONE,
+       },
+       {
+               .pin    = "Headset Mic",
+               .mask   = SND_JACK_MICROPHONE,
+       },
+ };
+ static struct snd_soc_jack_gpio hs_jack_gpios[] = {
+       {
+               .name           = "hp",
+               .report         = SND_JACK_HEADPHONE | SND_JACK_LINEOUT,
+               .debounce_time  = 200,
+       },
+       {
+               .name           = "mic",
+               .invert         = 1,
+               .report         = SND_JACK_MICROPHONE,
+               .debounce_time  = 200,
+       },
+ };
+ static const struct acpi_gpio_params hp_gpios = { 0, 0, false };
+ static const struct acpi_gpio_params mic_gpios = { 1, 0, false };
+ static const struct acpi_gpio_mapping acpi_max98090_gpios[] = {
+       { "hp-gpios", &hp_gpios, 1 },
+       { "mic-gpios", &mic_gpios, 1 },
+       {},
+ };
  static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
  {
        int ret;
        struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
        struct snd_soc_jack *jack = &ctx->jack;
  
-       /**
-       * TI supports 4 butons headset detection
-       * KEY_MEDIA
-       * KEY_VOICECOMMAND
-       * KEY_VOLUMEUP
-       * KEY_VOLUMEDOWN
-       */
-       if (ctx->ts3a227e_present)
-               jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
-                                       SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-                                       SND_JACK_BTN_2 | SND_JACK_BTN_3;
-       else
-               jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
+       if (ctx->ts3a227e_present) {
+               /*
+                * The jack has already been created in the
+                * cht_max98090_headset_init() function.
+                */
+               snd_soc_jack_notifier_register(jack, &cht_jack_nb);
+               return 0;
+       }
  
-       ret = snd_soc_card_jack_new(runtime->card, "Headset Jack",
-                                       jack_type, jack, NULL, 0);
+       jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
  
+       ret = snd_soc_card_jack_new(runtime->card, "Headset Jack",
+                                   jack_type, jack,
+                                   hs_jack_pins, ARRAY_SIZE(hs_jack_pins));
        if (ret) {
                dev_err(runtime->dev, "Headset Jack creation failed %d\n", ret);
                return ret;
        }
  
-       if (ctx->ts3a227e_present)
-               snd_soc_jack_notifier_register(jack, &cht_jack_nb);
+       ret = snd_soc_jack_add_gpiods(runtime->card->dev->parent, jack,
+                                     ARRAY_SIZE(hs_jack_gpios),
+                                     hs_jack_gpios);
+       if (ret) {
+               /*
+                * flag error but don't bail if jack detect is broken
+                * due to platform issues or bad BIOS/configuration
+                */
+               dev_err(runtime->dev,
+                       "jack detection gpios not added, error %d\n", ret);
+       }
+       /*
+        * The firmware might enable the clock at
+        * boot (this information may or may not
+        * be reflected in the enable clock register).
+        * To change the rate we must disable the clock
+        * first to cover these cases. Due to common
+        * clock framework restrictions that do not allow
+        * to disable a clock that has not been enabled,
+        * we need to enable the clock first.
+        */
+       ret = clk_prepare_enable(ctx->mclk);
+       if (!ret)
+               clk_disable_unprepare(ctx->mclk);
+       ret = clk_set_rate(ctx->mclk, CHT_PLAT_CLK_3_HZ);
+       if (ret)
+               dev_err(runtime->dev, "unable to set MCLK rate\n");
  
        return ret;
  }
@@@ -160,7 -257,7 +257,7 @@@ static int cht_codec_fixup(struct snd_s
                return ret;
        }
  
 -      fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF
 +      fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
                                | SND_SOC_DAIFMT_CBS_CFS;
  
        ret = snd_soc_dai_set_fmt(rtd->cpu_dai, fmt);
        rate->min = rate->max = 48000;
        channels->min = channels->max = 2;
  
 -      /* set SSP2 to 24-bit */
 -      params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
 +      /* set SSP2 to 16-bit */
 +      params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
        return 0;
  }
  
@@@ -188,8 -285,29 +285,29 @@@ static int cht_max98090_headset_init(st
  {
        struct snd_soc_card *card = component->card;
        struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
+       struct snd_soc_jack *jack = &ctx->jack;
+       int jack_type;
+       int ret;
  
-       return ts3a227e_enable_jack_detect(component, &ctx->jack);
+       /*
+        * TI supports 4 butons headset detection
+        * KEY_MEDIA
+        * KEY_VOICECOMMAND
+        * KEY_VOLUMEUP
+        * KEY_VOLUMEDOWN
+        */
+       jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
+                   SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+                   SND_JACK_BTN_2 | SND_JACK_BTN_3;
+       ret = snd_soc_card_jack_new(card, "Headset Jack", jack_type,
+                                   jack, NULL, 0);
+       if (ret) {
+               dev_err(card->dev, "Headset Jack creation failed %d\n", ret);
+               return ret;
+       }
+       return ts3a227e_enable_jack_detect(component, jack);
  }
  
  static const struct snd_soc_ops cht_aif1_ops = {
@@@ -232,18 -350,10 +350,10 @@@ static struct snd_soc_dai_link cht_dail
                .dpcm_playback = 1,
                .ops = &cht_aif1_ops,
        },
-       [MERR_DPCM_COMPR] = {
-               .name = "Compressed Port",
-               .stream_name = "Compress",
-               .cpu_dai_name = "compress-cpu-dai",
-               .codec_dai_name = "snd-soc-dummy-dai",
-               .codec_name = "snd-soc-dummy",
-               .platform_name = "sst-mfld-platform",
-       },
        /* back ends */
        {
                .name = "SSP2-Codec",
-               .id = 1,
+               .id = 0,
                .cpu_dai_name = "ssp2-port",
                .platform_name = "sst-mfld-platform",
                .no_pcm = 1,
@@@ -277,6 -387,7 +387,7 @@@ static struct snd_soc_card snd_soc_card
  
  static int snd_cht_mc_probe(struct platform_device *pdev)
  {
+       struct device *dev = &pdev->dev;
        int ret_val = 0;
        struct cht_mc_private *drv;
  
                /* no need probe TI jack detection chip */
                snd_soc_card_cht.aux_dev = NULL;
                snd_soc_card_cht.num_aux_devs = 0;
+               ret_val = devm_acpi_dev_add_driver_gpios(dev->parent,
+                                                        acpi_max98090_gpios);
+               if (ret_val)
+                       dev_dbg(dev, "Unable to add GPIO mapping table\n");
        }
  
        /* register the soc card */
        snd_soc_card_cht.dev = &pdev->dev;
        snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
+       drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+       if (IS_ERR(drv->mclk)) {
+               dev_err(&pdev->dev,
+                       "Failed to get MCLK from pmc_plt_clk_3: %ld\n",
+                       PTR_ERR(drv->mclk));
+               return PTR_ERR(drv->mclk);
+       }
        ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
        if (ret_val) {
                dev_err(&pdev->dev,
index 69ab559564921c4a5670bb519a4c9d80058d418b,e7672831bc4990c6bb63d5d302f22310b1095109..6072164f2d43db7c7f8f50000892f6e61e80d79c
@@@ -302,6 -302,7 +302,7 @@@ static int kabylake_ssp_fixup(struct sn
         * The ADSP will convert the FE rate to 48k, stereo, 24 bit
         */
        if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
+           !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") ||
            !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
                rate->min = rate->max = 48000;
                channels->min = channels->max = 2;
@@@ -604,8 -605,6 +605,8 @@@ static int kabylake_card_late_probe(str
  
        list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
                codec = pcm->codec_dai->codec;
 +              snprintf(jack_name, sizeof(jack_name),
 +                      "HDMI/DP,pcm=%d Jack", pcm->device);
                err = snd_soc_card_jack_new(card, jack_name,
                                SND_JACK_AVOUT, &ctx->kabylake_hdmi[i],
                                NULL, 0);
index 0e029f354f6bcfe72fbf7f9c627a2a7b3d842425,cb29653319d91224ffb988c6ed654031ec908e66..7379d8830c391e422ec89d0c15f0e0d1fcc94ff4
@@@ -1,11 -1,10 +1,11 @@@
 +# SPDX-License-Identifier: GPL-2.0
  snd-soc-sst-dsp-objs := sst-dsp.o
  snd-soc-sst-acpi-objs := sst-acpi.o
- snd-soc-sst-match-objs := sst-match-acpi.o
  snd-soc-sst-ipc-objs := sst-ipc.o
  snd-soc-sst-firmware-objs := sst-firmware.o
+ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-match.o soc-acpi-intel-hsw-bdw-match.o
  
  obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
  obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o
- obj-$(CONFIG_SND_SOC_INTEL_SST_MATCH) += snd-soc-sst-match.o
  obj-$(CONFIG_SND_SOC_INTEL_SST_FIRMWARE) += snd-soc-sst-firmware.o
+ obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
index b9c205c8bb735e6311f53515bf038d3b1f9630f9,f637829833e67d52281514911e4593be3bf807d9..61b5bfa79d1325b5a42e69119ccb1e39c20c0b6c
@@@ -613,8 -613,10 +613,10 @@@ skip_buf_size_calc
  }
  
  #define DMA_CONTROL_ID 5
+ #define DMA_I2S_BLOB_SIZE 21
  
- int skl_dsp_set_dma_control(struct skl_sst *ctx, struct skl_module_cfg *mconfig)
+ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
+                               u32 caps_size, u32 node_id)
  {
        struct skl_dma_control *dma_ctrl;
        struct skl_ipc_large_config_msg msg = {0};
        /*
         * if blob size zero, then return
         */
-       if (mconfig->formats_config.caps_size == 0)
+       if (caps_size == 0)
                return 0;
  
        msg.large_param_id = DMA_CONTROL_ID;
-       msg.param_data_size = sizeof(struct skl_dma_control) +
-                               mconfig->formats_config.caps_size;
+       msg.param_data_size = sizeof(struct skl_dma_control) + caps_size;
  
        dma_ctrl = kzalloc(msg.param_data_size, GFP_KERNEL);
        if (dma_ctrl == NULL)
                return -ENOMEM;
  
-       dma_ctrl->node_id = skl_get_node_id(ctx, mconfig);
+       dma_ctrl->node_id = node_id;
  
-       /* size in dwords */
-       dma_ctrl->config_length = mconfig->formats_config.caps_size / 4;
+       /*
+        * NHLT blob may contain additional configs along with i2s blob.
+        * firmware expects only the i2s blob size as the config_length.
+        * So fix to i2s blob size.
+        * size in dwords.
+        */
+       dma_ctrl->config_length = DMA_I2S_BLOB_SIZE;
  
-       memcpy(dma_ctrl->config_data, mconfig->formats_config.caps,
-                               mconfig->formats_config.caps_size);
+       memcpy(dma_ctrl->config_data, caps, caps_size);
  
        err = skl_ipc_set_large_config(&ctx->ipc, &msg, (u32 *)dma_ctrl);
  
@@@ -702,11 -707,18 +707,11 @@@ static void skl_set_updown_mixer_format
        struct skl_module *module = mconfig->module;
        struct skl_module_iface *iface = &module->formats[mconfig->fmt_idx];
        struct skl_module_fmt *fmt = &iface->outputs[0].fmt;
 -      int i = 0;
  
        skl_set_base_module_format(ctx, mconfig,
                (struct skl_base_cfg *)mixer_mconfig);
        mixer_mconfig->out_ch_cfg = fmt->ch_cfg;
 -
 -      /* Select F/W default coefficient */
 -      mixer_mconfig->coeff_sel = 0x0;
 -
 -      /* User coeff, don't care since we are selecting F/W defaults */
 -      for (i = 0; i < UP_DOWN_MIXER_MAX_COEFF; i++)
 -              mixer_mconfig->coeff[i] = 0xDEADBEEF;
 +      mixer_mconfig->ch_map = fmt->ch_map;
  }
  
  /*
index a3cb204e9640fa36052bb2caf685ac465e051262,4380e40c6af085d6f05c833707e64dfe6d7ed7e3..1dd97479e0c014bf1f814f16dd419268529454e0
@@@ -355,8 -355,7 +355,8 @@@ static void skl_pcm_close(struct snd_pc
        }
  
        mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
 -      skl_tplg_d0i3_put(skl, mconfig->d0i3_caps);
 +      if (mconfig)
 +              skl_tplg_d0i3_put(skl, mconfig->d0i3_caps);
  
        kfree(dma_params);
  }
@@@ -653,7 -652,7 +653,7 @@@ static const struct snd_soc_dai_ops skl
        .trigger = skl_link_pcm_trigger,
  };
  
- static struct snd_soc_dai_driver skl_platform_dai[] = {
+ static struct snd_soc_dai_driver skl_fe_dai[] = {
  {
        .name = "System Pin",
        .ops = &skl_pcm_dai_ops,
                .sig_bits = 32,
        },
  },
+ };
  
  /* BE CPU  Dais */
+ static struct snd_soc_dai_driver skl_platform_dai[] = {
  {
        .name = "SSP0 Pin",
        .ops = &skl_be_ssp_dai_ops,
  },
  };
  
+ int skl_dai_load(struct snd_soc_component *cmp,
+                struct snd_soc_dai_driver *pcm_dai)
+ {
+       pcm_dai->ops = &skl_pcm_dai_ops;
+       return 0;
+ }
  static int skl_platform_open(struct snd_pcm_substream *substream)
  {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@@ -1363,6 -1372,8 +1373,8 @@@ int skl_platform_register(struct devic
        int ret;
        struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
        struct skl *skl = ebus_to_skl(ebus);
+       struct snd_soc_dai_driver *dais;
+       int num_dais = ARRAY_SIZE(skl_platform_dai);
  
        INIT_LIST_HEAD(&skl->ppl_list);
        INIT_LIST_HEAD(&skl->bind_list);
                dev_err(dev, "soc platform registration failed %d\n", ret);
                return ret;
        }
+       skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai),
+                           GFP_KERNEL);
+       if (!skl->dais) {
+               ret = -ENOMEM;
+               goto err;
+       }
+       if (!skl->use_tplg_pcm) {
+               dais = krealloc(skl->dais, sizeof(skl_fe_dai) +
+                               sizeof(skl_platform_dai), GFP_KERNEL);
+               if (!dais) {
+                       ret = -ENOMEM;
+                       goto err;
+               }
+               skl->dais = dais;
+               memcpy(&skl->dais[ARRAY_SIZE(skl_platform_dai)], skl_fe_dai,
+                      sizeof(skl_fe_dai));
+               num_dais += ARRAY_SIZE(skl_fe_dai);
+       }
        ret = snd_soc_register_component(dev, &skl_component,
-                               skl_platform_dai,
-                               ARRAY_SIZE(skl_platform_dai));
+                                        skl->dais, num_dais);
        if (ret) {
                dev_err(dev, "soc component registration failed %d\n", ret);
-               snd_soc_unregister_platform(dev);
+               goto err;
        }
  
+       return 0;
+ err:
+       snd_soc_unregister_platform(dev);
        return ret;
  
  }
@@@ -1399,5 -1434,7 +1435,7 @@@ int skl_platform_unregister(struct devi
  
        snd_soc_unregister_component(dev);
        snd_soc_unregister_platform(dev);
+       kfree(skl->dais);
        return 0;
  }
index 27bcb62568fbc70c6291c34f377c48c9fe36f448,b590742c5a7a673bc43b827a198086199c3ced9c..a072bcf209d2aa4c9c72503466e027e6867cd9bb
@@@ -2036,21 -2036,45 +2036,45 @@@ static int skl_tplg_add_pipe(struct dev
        return 0;
  }
  
- static int skl_tplg_fill_pin(struct device *dev, u32 tkn,
+ static int skl_tplg_get_uuid(struct device *dev, u8 *guid,
+             struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn)
+ {
+       if (uuid_tkn->token == SKL_TKN_UUID) {
+               memcpy(guid, &uuid_tkn->uuid, 16);
+               return 0;
+       }
+       dev_err(dev, "Not an UUID token %d\n", uuid_tkn->token);
+       return -EINVAL;
+ }
+ static int skl_tplg_fill_pin(struct device *dev,
+                       struct snd_soc_tplg_vendor_value_elem *tkn_elem,
                        struct skl_module_pin *m_pin,
-                       int pin_index, u32 value)
+                       int pin_index)
  {
-       switch (tkn) {
+       int ret;
+       switch (tkn_elem->token) {
        case SKL_TKN_U32_PIN_MOD_ID:
-               m_pin[pin_index].id.module_id = value;
+               m_pin[pin_index].id.module_id = tkn_elem->value;
                break;
  
        case SKL_TKN_U32_PIN_INST_ID:
-               m_pin[pin_index].id.instance_id = value;
+               m_pin[pin_index].id.instance_id = tkn_elem->value;
+               break;
+       case SKL_TKN_UUID:
+               ret = skl_tplg_get_uuid(dev, m_pin[pin_index].id.mod_uuid.b,
+                       (struct snd_soc_tplg_vendor_uuid_elem *)tkn_elem);
+               if (ret < 0)
+                       return ret;
                break;
  
        default:
-               dev_err(dev, "%d Not a pin token\n", value);
+               dev_err(dev, "%d Not a pin token\n", tkn_elem->token);
                return -EINVAL;
        }
  
@@@ -2083,9 -2107,7 +2107,7 @@@ static int skl_tplg_fill_pins_info(stru
                return -EINVAL;
        }
  
-       ret = skl_tplg_fill_pin(dev, tkn_elem->token,
-                       m_pin, pin_count, tkn_elem->value);
+       ret = skl_tplg_fill_pin(dev, tkn_elem, m_pin, pin_count);
        if (ret < 0)
                return ret;
  
@@@ -2170,19 -2192,6 +2192,6 @@@ static int skl_tplg_widget_fill_fmt(str
        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)
- {
-       if (uuid_tkn->token == SKL_TKN_UUID)
-               memcpy(&mconfig->guid, &uuid_tkn->uuid, 16);
-       else {
-               dev_err(dev, "Not an UUID token tkn %d\n", uuid_tkn->token);
-               return -EINVAL;
-       }
-       return 0;
- }
  static void skl_tplg_fill_pin_dynamic_val(
                struct skl_module_pin *mpin, u32 pin_count, u32 value)
  {
@@@ -2382,7 -2391,7 +2391,7 @@@ static int skl_tplg_get_token(struct de
        case SKL_TKN_U32_MAX_MCPS:
        case SKL_TKN_U32_OBS:
        case SKL_TKN_U32_IBS:
 -              ret = skl_tplg_fill_res_tkn(dev, tkn_elem, res, dir, pin_index);
 +              ret = skl_tplg_fill_res_tkn(dev, tkn_elem, res, pin_index, dir);
                if (ret < 0)
                        return ret;
  
  
        case SKL_TKN_U32_PIN_MOD_ID:
        case SKL_TKN_U32_PIN_INST_ID:
+       case SKL_TKN_UUID:
                ret = skl_tplg_fill_pins_info(dev,
                                mconfig, tkn_elem, dir,
                                pin_index);
@@@ -2550,6 -2560,7 +2560,7 @@@ static int skl_tplg_get_tokens(struct d
        struct snd_soc_tplg_vendor_value_elem *tkn_elem;
        int tkn_count = 0, ret;
        int off = 0, tuple_size = 0;
+       bool is_module_guid = true;
  
        if (block_size <= 0)
                return -EINVAL;
                        continue;
  
                case SND_SOC_TPLG_TUPLE_TYPE_UUID:
-                       ret = skl_tplg_get_uuid(dev, mconfig, array->uuid);
+                       if (is_module_guid) {
+                               ret = skl_tplg_get_uuid(dev, mconfig->guid,
+                                                       array->uuid);
+                               is_module_guid = false;
+                       } else {
+                               ret = skl_tplg_get_token(dev, array->value, skl,
+                                                        mconfig);
+                       }
                        if (ret < 0)
                                return ret;
  
@@@ -3331,6 -3350,7 +3350,7 @@@ static struct snd_soc_tplg_ops skl_tplg
        .io_ops = skl_tplg_kcontrol_ops,
        .io_ops_count = ARRAY_SIZE(skl_tplg_kcontrol_ops),
        .manifest = skl_manifest_load,
+       .dai_load = skl_dai_load,
  };
  
  /*
@@@ -3404,7 -3424,7 +3424,7 @@@ int skl_tplg_init(struct snd_soc_platfo
  
        ret = request_firmware(&fw, skl->tplg_name, bus->dev);
        if (ret < 0) {
-               dev_err(bus->dev, "tplg fw %s load failed with %d\n",
+               dev_info(bus->dev, "tplg fw %s load failed with %d, falling back to dfw_sst.bin",
                                skl->tplg_name, ret);
                ret = request_firmware(&fw, "dfw_sst.bin", bus->dev);
                if (ret < 0) {
index bc3c29161ed0062b55a83598de4159c2de499fd2,d116599bfdd705369c634f0d0c1c2a88b065d140..b6496513fe555d476c6796f9cc5e40f2e29f4caf
@@@ -34,7 -34,7 +34,7 @@@
  #define MAX_FIXED_DMIC_PARAMS_SIZE 727
  
  /* Maximum number of coefficients up down mixer module */
 -#define UP_DOWN_MIXER_MAX_COEFF               6
 +#define UP_DOWN_MIXER_MAX_COEFF               8
  
  #define MODULE_MAX_IN_PINS    8
  #define MODULE_MAX_OUT_PINS   8
@@@ -161,7 -161,6 +161,7 @@@ struct skl_up_down_mixer_cfg 
        u32 coeff_sel;
        /* Pass the user coeff in this array */
        s32 coeff[UP_DOWN_MIXER_MAX_COEFF];
 +      u32 ch_map;
  } __packed;
  
  struct skl_algo_cfg {
@@@ -456,8 -455,8 +456,8 @@@ static inline struct skl *get_skl_ctx(s
  
  int skl_tplg_be_update_params(struct snd_soc_dai *dai,
        struct skl_pipe_params *params);
- int skl_dsp_set_dma_control(struct skl_sst *ctx,
-               struct skl_module_cfg *mconfig);
+ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
+                       u32 caps_size, u32 node_id);
  void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
        struct skl_pipe_params *params, int stream);
  int skl_tplg_init(struct snd_soc_platform *platform,
@@@ -502,4 -501,7 +502,7 @@@ int skl_pcm_host_dma_prepare(struct dev
                        struct skl_pipe_params *params);
  int skl_pcm_link_dma_prepare(struct device *dev,
                        struct skl_pipe_params *params);
+ int skl_dai_load(struct snd_soc_component *cmp,
+                struct snd_soc_dai_driver *pcm_dai);
  #endif