Merge branch 'asoc-5.2' into asoc-5.3
authorMark Brown <broonie@kernel.org>
Thu, 6 Jun 2019 21:44:24 +0000 (22:44 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 6 Jun 2019 21:44:24 +0000 (22:44 +0100)
sound/hda/ext/hdac_ext_bus.c
sound/soc/codecs/max98090.c
sound/soc/codecs/rt274.c
sound/soc/intel/boards/bytcht_es8316.c
sound/soc/intel/boards/cht_bsw_max98090_ti.c
sound/soc/intel/boards/cht_bsw_nau8824.c
sound/soc/intel/boards/cht_bsw_rt5672.c
sound/soc/mediatek/Kconfig
sound/soc/soc-core.c
sound/soc/sof/intel/hda.c
sound/soc/sunxi/sun4i-i2s.c

index c203af7..f33ba58 100644 (file)
@@ -170,7 +170,6 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_init);
 void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev)
 {
        snd_hdac_device_exit(hdev);
-       kfree(hdev);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);
 
index 7619ea3..ada8c25 100644 (file)
@@ -1909,6 +1909,21 @@ static int max98090_configure_dmic(struct max98090_priv *max98090,
        return 0;
 }
 
+static int max98090_dai_startup(struct snd_pcm_substream *substream,
+                               struct snd_soc_dai *dai)
+{
+       struct snd_soc_component *component = dai->component;
+       struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component);
+       unsigned int fmt = max98090->dai_fmt;
+
+       /* Remove 24-bit format support if it is not in right justified mode. */
+       if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_RIGHT_J) {
+               substream->runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+               snd_pcm_hw_constraint_msbits(substream->runtime, 0, 16, 16);
+       }
+       return 0;
+}
+
 static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
                                   struct snd_pcm_hw_params *params,
                                   struct snd_soc_dai *dai)
@@ -2316,6 +2331,7 @@ EXPORT_SYMBOL_GPL(max98090_mic_detect);
 #define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
 static const struct snd_soc_dai_ops max98090_dai_ops = {
+       .startup = max98090_dai_startup,
        .set_sysclk = max98090_dai_set_sysclk,
        .set_fmt = max98090_dai_set_fmt,
        .set_tdm_slot = max98090_set_tdm_slot,
index adf5903..cdd312d 100644 (file)
@@ -405,6 +405,8 @@ static int rt274_mic_detect(struct snd_soc_component *component,
 {
        struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component);
 
+       rt274->jack = jack;
+
        if (jack == NULL) {
                /* Disable jack detection */
                regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
@@ -412,7 +414,6 @@ static int rt274_mic_detect(struct snd_soc_component *component,
 
                return 0;
        }
-       rt274->jack = jack;
 
        regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL,
                                RT274_IRQ_EN, RT274_IRQ_EN);
index b56f923..43cea6f 100644 (file)
@@ -496,6 +496,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
        }
 
        /* override plaform name, if required */
+       byt_cht_es8316_card.dev = dev;
        platform_name = mach->mach_params.platform;
 
        ret = snd_soc_fixup_dai_links_platform_name(&byt_cht_es8316_card,
@@ -576,7 +577,6 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
                 (quirk & BYT_CHT_ES8316_MONO_SPEAKER) ? "mono" : "stereo",
                 mic_name[BYT_CHT_ES8316_MAP(quirk)]);
        byt_cht_es8316_card.long_name = long_name;
-       byt_cht_es8316_card.dev = dev;
        snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
 
        ret = devm_snd_soc_register_card(dev, &byt_cht_es8316_card);
index fb775ed..4157c64 100644 (file)
@@ -462,6 +462,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
        }
 
        /* override plaform name, if required */
+       snd_soc_card_cht.dev = &pdev->dev;
        mach = (&pdev->dev)->platform_data;
        platform_name = mach->mach_params.platform;
 
@@ -471,7 +472,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
                return ret_val;
 
        /* register the soc card */
-       snd_soc_card_cht.dev = &pdev->dev;
        snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
 
        if (drv->quirks & QUIRK_PMC_PLT_CLK_0)
index 5165e5d..80b1807 100644 (file)
@@ -266,6 +266,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
        snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
 
        /* override plaform name, if required */
+       snd_soc_card_cht.dev = &pdev->dev;
        mach = (&pdev->dev)->platform_data;
        platform_name = mach->mach_params.platform;
 
@@ -275,7 +276,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
                return ret_val;
 
        /* register the soc card */
-       snd_soc_card_cht.dev = &pdev->dev;
        ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
        if (ret_val) {
                dev_err(&pdev->dev,
index 270d570..e03d52f 100644 (file)
@@ -435,6 +435,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
        }
 
        /* override plaform name, if required */
+       snd_soc_card_cht.dev = &pdev->dev;
        platform_name = mach->mach_params.platform;
 
        ret_val = snd_soc_fixup_dai_links_platform_name(&snd_soc_card_cht,
@@ -452,7 +453,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
        snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
 
        /* register the soc card */
-       snd_soc_card_cht.dev = &pdev->dev;
        ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
        if (ret_val) {
                dev_err(&pdev->dev,
index f70b710..59980df 100644 (file)
@@ -132,7 +132,7 @@ config SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A
 
 config SND_SOC_MT8183_DA7219_MAX98357A
        tristate "ASoC Audio driver for MT8183 with DA7219 MAX98357A codec"
-       depends on SND_SOC_MT8183
+       depends on SND_SOC_MT8183 && I2C
        select SND_SOC_MT6358
        select SND_SOC_MAX98357A
        select SND_SOC_DA7219
index f8426c8..94a36ee 100644 (file)
@@ -1983,6 +1983,16 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
        int ret, i, order;
 
        mutex_lock(&client_mutex);
+       for_each_card_prelinks(card, i, dai_link) {
+               ret = soc_init_dai_link(card, dai_link);
+               if (ret) {
+                       soc_cleanup_card_resources(card);
+                       dev_err(card->dev, "ASoC: failed to init link %s: %d\n",
+                               dai_link->name, ret);
+                       mutex_unlock(&client_mutex);
+                       return ret;
+               }
+       }
        mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
 
        card->dapm.bias_level = SND_SOC_BIAS_OFF;
@@ -2707,25 +2717,9 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
  */
 int snd_soc_register_card(struct snd_soc_card *card)
 {
-       int i, ret;
-       struct snd_soc_dai_link *link;
-
        if (!card->name || !card->dev)
                return -EINVAL;
 
-       mutex_lock(&client_mutex);
-       for_each_card_prelinks(card, i, link) {
-
-               ret = soc_init_dai_link(card, link);
-               if (ret) {
-                       dev_err(card->dev, "ASoC: failed to init link %s\n",
-                               link->name);
-                       mutex_unlock(&client_mutex);
-                       return ret;
-               }
-       }
-       mutex_unlock(&client_mutex);
-
        dev_set_drvdata(card->dev, card);
 
        snd_soc_initialize_card_lists(card);
index bb5f02f..47b5084 100644 (file)
@@ -227,7 +227,9 @@ static int hda_init(struct snd_sof_dev *sdev)
 
        /* initialise hdac bus */
        bus->addr = pci_resource_start(pci, 0);
+#if IS_ENABLED(CONFIG_PCI)
        bus->remap_addr = pci_ioremap_bar(pci, 0);
+#endif
        if (!bus->remap_addr) {
                dev_err(bus->dev, "error: ioremap error\n");
                return -ENXIO;
@@ -454,7 +456,9 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
                goto hdac_bus_unmap;
 
        /* DSP base */
+#if IS_ENABLED(CONFIG_PCI)
        sdev->bar[HDA_DSP_BAR] = pci_ioremap_bar(pci, HDA_DSP_BAR);
+#endif
        if (!sdev->bar[HDA_DSP_BAR]) {
                dev_err(sdev->dev, "error: ioremap error\n");
                ret = -ENXIO;
index 03696f8..f3ff5a0 100644 (file)
 
 #define SUN8I_I2S_TX_CHAN_MAP_REG      0x44
 #define SUN8I_I2S_TX_CHAN_SEL_REG      0x34
-#define SUN8I_I2S_TX_CHAN_OFFSET_MASK          GENMASK(13, 11)
+#define SUN8I_I2S_TX_CHAN_OFFSET_MASK          GENMASK(13, 12)
 #define SUN8I_I2S_TX_CHAN_OFFSET(offset)       (offset << 12)
 #define SUN8I_I2S_TX_CHAN_EN_MASK              GENMASK(11, 4)
 #define SUN8I_I2S_TX_CHAN_EN(num_chan)         (((1 << num_chan) - 1) << 4)
@@ -490,6 +490,10 @@ static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
                regmap_update_bits(i2s->regmap, SUN8I_I2S_TX_CHAN_SEL_REG,
                                   SUN8I_I2S_TX_CHAN_OFFSET_MASK,
                                   SUN8I_I2S_TX_CHAN_OFFSET(offset));
+
+               regmap_update_bits(i2s->regmap, SUN8I_I2S_RX_CHAN_SEL_REG,
+                                  SUN8I_I2S_TX_CHAN_OFFSET_MASK,
+                                  SUN8I_I2S_TX_CHAN_OFFSET(offset));
        }
 
        regmap_field_write(i2s->field_fmt_mode, val);