Merge remote-tracking branches 'asoc/fix/mtk', 'asoc/fix/psc', 'asoc/fix/pxa', 'asoc...
authorMark Brown <broonie@kernel.org>
Wed, 23 Sep 2015 18:01:08 +0000 (11:01 -0700)
committerMark Brown <broonie@kernel.org>
Wed, 23 Sep 2015 18:01:08 +0000 (11:01 -0700)
sound/arm/Kconfig
sound/soc/au1x/psc-i2s.c
sound/soc/codecs/wm0010.c
sound/soc/mediatek/mtk-afe-pcm.c
sound/soc/pxa/Kconfig
sound/soc/pxa/pxa2xx-ac97.c
sound/soc/spear/Kconfig
sound/soc/sti/uniperif_player.c
sound/soc/sti/uniperif_reader.c

index 885683a..e040621 100644 (file)
@@ -9,6 +9,14 @@ menuconfig SND_ARM
          Drivers that are implemented on ASoC can be found in
          "ALSA for SoC audio support" section.
 
+config SND_PXA2XX_LIB
+       tristate
+       select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
+       select SND_DMAENGINE_PCM
+
+config SND_PXA2XX_LIB_AC97
+       bool
+
 if SND_ARM
 
 config SND_ARMAACI
@@ -21,13 +29,6 @@ config SND_PXA2XX_PCM
        tristate
        select SND_PCM
 
-config SND_PXA2XX_LIB
-       tristate
-       select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97
-
-config SND_PXA2XX_LIB_AC97
-       bool
-
 config SND_PXA2XX_AC97
        tristate "AC97 driver for the Intel PXA2xx chip"
        depends on ARCH_PXA
index 38e853a..0bf9d62 100644 (file)
@@ -296,7 +296,6 @@ static int au1xpsc_i2s_drvprobe(struct platform_device *pdev)
 {
        struct resource *iores, *dmares;
        unsigned long sel;
-       int ret;
        struct au1xpsc_audio_data *wd;
 
        wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data),
index f2c6ad4..581ec15 100644 (file)
@@ -577,7 +577,6 @@ static int wm0010_boot(struct snd_soc_codec *codec)
        struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
        unsigned long flags;
        int ret;
-       const struct firmware *fw;
        struct spi_message m;
        struct spi_transfer t;
        struct dfw_pllrec pll_rec;
@@ -623,14 +622,6 @@ static int wm0010_boot(struct snd_soc_codec *codec)
        wm0010->state = WM0010_OUT_OF_RESET;
        spin_unlock_irqrestore(&wm0010->irq_lock, flags);
 
-       /* First the bootloader */
-       ret = request_firmware(&fw, "wm0010_stage2.bin", codec->dev);
-       if (ret != 0) {
-               dev_err(codec->dev, "Failed to request stage2 loader: %d\n",
-                       ret);
-               goto abort;
-       }
-
        if (!wait_for_completion_timeout(&wm0010->boot_completion,
                                         msecs_to_jiffies(20)))
                dev_err(codec->dev, "Failed to get interrupt from DSP\n");
@@ -673,7 +664,7 @@ static int wm0010_boot(struct snd_soc_codec *codec)
 
                img_swap = kzalloc(len, GFP_KERNEL | GFP_DMA);
                if (!img_swap)
-                       goto abort;
+                       goto abort_out;
 
                /* We need to re-order for 0010 */
                byte_swap_64((u64 *)&pll_rec, img_swap, len);
@@ -688,16 +679,16 @@ static int wm0010_boot(struct snd_soc_codec *codec)
                spi_message_add_tail(&t, &m);
 
                ret = spi_sync(spi, &m);
-               if (ret != 0) {
+               if (ret) {
                        dev_err(codec->dev, "First PLL write failed: %d\n", ret);
-                       goto abort;
+                       goto abort_swap;
                }
 
                /* Use a second send of the message to get the return status */
                ret = spi_sync(spi, &m);
-               if (ret != 0) {
+               if (ret) {
                        dev_err(codec->dev, "Second PLL write failed: %d\n", ret);
-                       goto abort;
+                       goto abort_swap;
                }
 
                p = (u32 *)out;
@@ -730,6 +721,10 @@ static int wm0010_boot(struct snd_soc_codec *codec)
 
        return 0;
 
+abort_swap:
+       kfree(img_swap);
+abort_out:
+       kfree(out);
 abort:
        /* Put the chip back into reset */
        wm0010_halt(codec);
index d190fe0..f5baf3c 100644 (file)
@@ -549,6 +549,23 @@ static int mtk_afe_dais_startup(struct snd_pcm_substream *substream,
        memif->substream = substream;
 
        snd_soc_set_runtime_hwparams(substream, &mtk_afe_hardware);
+
+       /*
+        * Capture cannot use ping-pong buffer since hw_ptr at IRQ may be
+        * smaller than period_size due to AFE's internal buffer.
+        * This easily leads to overrun when avail_min is period_size.
+        * One more period can hold the possible unread buffer.
+        */
+       if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
+               ret = snd_pcm_hw_constraint_minmax(runtime,
+                                                  SNDRV_PCM_HW_PARAM_PERIODS,
+                                                  3,
+                                                  mtk_afe_hardware.periods_max);
+               if (ret < 0) {
+                       dev_err(afe->dev, "hw_constraint_minmax failed\n");
+                       return ret;
+               }
+       }
        ret = snd_pcm_hw_constraint_integer(runtime,
                                            SNDRV_PCM_HW_PARAM_PERIODS);
        if (ret < 0)
index 39cea80..f2bf866 100644 (file)
@@ -1,7 +1,6 @@
 config SND_PXA2XX_SOC
        tristate "SoC Audio for the Intel PXA2xx chip"
        depends on ARCH_PXA
-       select SND_ARM
        select SND_PXA2XX_LIB
        help
          Say Y or M if you want to add support for codecs attached to
@@ -25,7 +24,6 @@ config SND_PXA2XX_AC97
 config SND_PXA2XX_SOC_AC97
        tristate
        select AC97_BUS
-       select SND_ARM
        select SND_PXA2XX_LIB_AC97
        select SND_SOC_AC97_BUS
 
index 1f60546..9e4b04e 100644 (file)
@@ -49,7 +49,7 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
        .reset  = pxa2xx_ac97_cold_reset,
 };
 
-static unsigned long pxa2xx_ac97_pcm_stereo_in_req = 12;
+static unsigned long pxa2xx_ac97_pcm_stereo_in_req = 11;
 static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = {
        .addr           = __PREG(PCDR),
        .addr_width     = DMA_SLAVE_BUSWIDTH_4_BYTES,
@@ -57,7 +57,7 @@ static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = {
        .filter_data    = &pxa2xx_ac97_pcm_stereo_in_req,
 };
 
-static unsigned long pxa2xx_ac97_pcm_stereo_out_req = 11;
+static unsigned long pxa2xx_ac97_pcm_stereo_out_req = 12;
 static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_out = {
        .addr           = __PREG(PCDR),
        .addr_width     = DMA_SLAVE_BUSWIDTH_4_BYTES,
index 0a53053..4fb9141 100644 (file)
@@ -1,6 +1,6 @@
 config SND_SPEAR_SOC
        tristate
-       select SND_DMAENGINE_PCM
+       select SND_SOC_GENERIC_DMAENGINE_PCM
 
 config SND_SPEAR_SPDIF_OUT
        tristate
index f6eefe1..843f037 100644 (file)
@@ -989,8 +989,8 @@ static int uni_player_parse_dt(struct platform_device *pdev,
        if (!info)
                return -ENOMEM;
 
-       of_property_read_u32(pnode, "version", &player->ver);
-       if (player->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) {
+       if (of_property_read_u32(pnode, "version", &player->ver) ||
+           player->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) {
                dev_err(dev, "Unknown uniperipheral version ");
                return -EINVAL;
        }
@@ -998,10 +998,16 @@ static int uni_player_parse_dt(struct platform_device *pdev,
        if (player->ver >= SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
                info->underflow_enabled = 1;
 
-       of_property_read_u32(pnode, "uniperiph-id", &info->id);
+       if (of_property_read_u32(pnode, "uniperiph-id", &info->id)) {
+               dev_err(dev, "uniperipheral id not defined");
+               return -EINVAL;
+       }
 
        /* Read the device mode property */
-       of_property_read_string(pnode, "mode", &mode);
+       if (of_property_read_string(pnode, "mode", &mode)) {
+               dev_err(dev, "uniperipheral mode not defined");
+               return -EINVAL;
+       }
 
        if (strcasecmp(mode, "hdmi") == 0)
                info->player_type = SND_ST_UNIPERIF_PLAYER_TYPE_HDMI;
index c502626..f791239 100644 (file)
@@ -316,7 +316,11 @@ static int uni_reader_parse_dt(struct platform_device *pdev,
        if (!info)
                return -ENOMEM;
 
-       of_property_read_u32(node, "version", &reader->ver);
+       if (of_property_read_u32(node, "version", &reader->ver) ||
+           reader->ver == SND_ST_UNIPERIF_VERSION_UNKNOWN) {
+               dev_err(&pdev->dev, "Unknown uniperipheral version ");
+               return -EINVAL;
+       }
 
        /* Save the info structure */
        reader->info = info;