Merge remote-tracking branch 'asoc/topic/core' into asoc-next
authorMark Brown <broonie@linaro.org>
Wed, 21 May 2014 23:23:41 +0000 (00:23 +0100)
committerMark Brown <broonie@linaro.org>
Wed, 21 May 2014 23:23:41 +0000 (00:23 +0100)
include/sound/soc-dai.h
include/sound/soc.h
sound/soc/atmel/atmel-pcm-pdc.c
sound/soc/soc-compress.c
sound/soc/soc-core.c
sound/soc/soc-pcm.c

index fad76769f153d8cfdec2b796d892d6d0f3783798..688f2ba8009fc0a713d716a0e1fc35b1ceb750f6 100644 (file)
@@ -252,7 +252,6 @@ struct snd_soc_dai {
        unsigned int symmetric_rates:1;
        unsigned int symmetric_channels:1;
        unsigned int symmetric_samplebits:1;
-       struct snd_pcm_runtime *runtime;
        unsigned int active;
        unsigned char probed:1;
 
@@ -277,7 +276,6 @@ struct snd_soc_dai {
        struct snd_soc_card *card;
 
        struct list_head list;
-       struct list_head card_list;
 };
 
 static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
index c0b65fc90783b8fa1998f5252367492d2d3820c2..b9ee2201835252a2a45e6bc369b7cf3304e16d7c 100644 (file)
                {.base = xbase, .num_regs = xregs,            \
                 .mask = xmask }) }
 
+#define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
+{      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
+       .info = snd_soc_bytes_info_ext, \
+       .get = xhandler_get, .put = xhandler_put, \
+       .private_value = (unsigned long)&(struct soc_bytes_ext) \
+               {.max = xcount} }
+
 #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
                xmin, xmax, xinvert) \
 {      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -532,6 +539,8 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
                      struct snd_ctl_elem_value *ucontrol);
 int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
                      struct snd_ctl_elem_value *ucontrol);
+int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_info *ucontrol);
 int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_info *uinfo);
 int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
@@ -692,7 +701,6 @@ struct snd_soc_codec {
        struct snd_soc_card *card;
        struct list_head list;
        struct list_head card_list;
-       int num_dai;
 
        /* runtime */
        struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
@@ -949,7 +957,6 @@ struct snd_soc_card {
        struct snd_card *snd_card;
        struct module *owner;
 
-       struct list_head list;
        struct mutex mutex;
        struct mutex dapm_mutex;
 
@@ -1012,7 +1019,6 @@ struct snd_soc_card {
        /* lists of probed devices belonging to this card */
        struct list_head codec_dev_list;
        struct list_head platform_dev_list;
-       struct list_head dai_dev_list;
 
        struct list_head widgets;
        struct list_head paths;
@@ -1082,6 +1088,10 @@ struct soc_bytes {
        u32 mask;
 };
 
+struct soc_bytes_ext {
+       int max;
+};
+
 /* multi register control */
 struct soc_mreg_control {
        long min, max;
@@ -1194,7 +1204,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
 
 static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
 {
-       INIT_LIST_HEAD(&card->dai_dev_list);
        INIT_LIST_HEAD(&card->codec_dev_list);
        INIT_LIST_HEAD(&card->platform_dev_list);
        INIT_LIST_HEAD(&card->widgets);
index 33ec592ecd75d8f6f27c567effcd86551ec1632b..a366b3503c282cad1cd2c857eafb384b8b8e56bb 100644 (file)
@@ -76,12 +76,6 @@ struct atmel_runtime_data {
        size_t period_size;
 
        dma_addr_t period_ptr;          /* physical address of next period */
-
-       /* PDC register save */
-       u32 pdc_xpr_save;
-       u32 pdc_xcr_save;
-       u32 pdc_xnpr_save;
-       u32 pdc_xncr_save;
 };
 
 /*--------------------------------------------------------------------------*\
@@ -320,67 +314,10 @@ static struct snd_pcm_ops atmel_pcm_ops = {
        .mmap           = atmel_pcm_mmap,
 };
 
-
-/*--------------------------------------------------------------------------*\
- * ASoC platform driver
-\*--------------------------------------------------------------------------*/
-#ifdef CONFIG_PM
-static int atmel_pcm_suspend(struct snd_soc_dai *dai)
-{
-       struct snd_pcm_runtime *runtime = dai->runtime;
-       struct atmel_runtime_data *prtd;
-       struct atmel_pcm_dma_params *params;
-
-       if (!runtime)
-               return 0;
-
-       prtd = runtime->private_data;
-       params = prtd->params;
-
-       /* disable the PDC and save the PDC registers */
-
-       ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable);
-
-       prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
-       prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr);
-       prtd->pdc_xnpr_save = ssc_readx(params->ssc->regs, params->pdc->xnpr);
-       prtd->pdc_xncr_save = ssc_readx(params->ssc->regs, params->pdc->xncr);
-
-       return 0;
-}
-
-static int atmel_pcm_resume(struct snd_soc_dai *dai)
-{
-       struct snd_pcm_runtime *runtime = dai->runtime;
-       struct atmel_runtime_data *prtd;
-       struct atmel_pcm_dma_params *params;
-
-       if (!runtime)
-               return 0;
-
-       prtd = runtime->private_data;
-       params = prtd->params;
-
-       /* restore the PDC registers and enable the PDC */
-       ssc_writex(params->ssc->regs, params->pdc->xpr, prtd->pdc_xpr_save);
-       ssc_writex(params->ssc->regs, params->pdc->xcr, prtd->pdc_xcr_save);
-       ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
-       ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
-
-       ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable);
-       return 0;
-}
-#else
-#define atmel_pcm_suspend      NULL
-#define atmel_pcm_resume       NULL
-#endif
-
 static struct snd_soc_platform_driver atmel_soc_platform = {
        .ops            = &atmel_pcm_ops,
        .pcm_new        = atmel_pcm_new,
        .pcm_free       = atmel_pcm_free,
-       .suspend        = atmel_pcm_suspend,
-       .resume         = atmel_pcm_resume,
 };
 
 int atmel_pcm_pdc_platform_register(struct device *dev)
index 91083e6a6b3814c37112f2bbd6996a68f0adb782..10f7f1da2acaf3e192f0b6b1ed519483c4a60dd0 100644 (file)
@@ -203,7 +203,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
 
        if (platform->driver->compr_ops && platform->driver->compr_ops->free)
                platform->driver->compr_ops->free(cstream);
-       cpu_dai->runtime = NULL;
 
        if (cstream->direction == SND_COMPRESS_PLAYBACK) {
                if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
@@ -317,8 +316,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
                cmd == SND_COMPR_TRIGGER_DRAIN) {
 
                if (platform->driver->compr_ops &&
-                       platform->driver->compr_ops->trigger)
-               return platform->driver->compr_ops->trigger(cstream, cmd);
+                   platform->driver->compr_ops->trigger)
+                       return platform->driver->compr_ops->trigger(cstream,
+                                                                   cmd);
        }
 
        if (cstream->direction == SND_COMPRESS_PLAYBACK)
index 4a381b307b084880540cb7b9e2a9e71befe2a781..a675eec647561f9be7e083308948d96ad763cc87 100644 (file)
@@ -1017,7 +1017,6 @@ static void soc_remove_codec_dai(struct snd_soc_dai *codec_dai, int order)
                                        codec_dai->name, err);
                }
                codec_dai->probed = 0;
-               list_del(&codec_dai->card_list);
        }
 }
 
@@ -1049,7 +1048,6 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
                                        cpu_dai->name, err);
                }
                cpu_dai->probed = 0;
-               list_del(&cpu_dai->card_list);
 
                if (!cpu_dai->codec) {
                        snd_soc_dapm_free(&cpu_dai->dapm);
@@ -1405,7 +1403,6 @@ static int soc_probe_codec_dai(struct snd_soc_card *card,
 
                /* mark codec_dai as probed and add to card dai list */
                codec_dai->probed = 1;
-               list_add(&codec_dai->card_list, &card->dai_dev_list);
        }
 
        return 0;
@@ -1490,8 +1487,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
                        }
                }
                cpu_dai->probed = 1;
-               /* mark cpu_dai as probed and add to card dai list */
-               list_add(&cpu_dai->card_list, &card->dai_dev_list);
        }
 
        /* probe the CODEC DAI */
@@ -3205,6 +3200,18 @@ out:
 }
 EXPORT_SYMBOL_GPL(snd_soc_bytes_put);
 
+int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
+                       struct snd_ctl_elem_info *ucontrol)
+{
+       struct soc_bytes_ext *params = (void *)kcontrol->private_value;
+
+       ucontrol->type = SNDRV_CTL_ELEM_TYPE_BYTES;
+       ucontrol->count = params->max;
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_bytes_info_ext);
+
 /**
  * snd_soc_info_xr_sx - signed multi register info callback
  * @kcontrol: mreg control
@@ -3738,7 +3745,6 @@ int snd_soc_register_card(struct snd_soc_card *card)
        for (i = 0; i < card->num_links; i++)
                card->rtd[i].dai_link = &card->dai_link[i];
 
-       INIT_LIST_HEAD(&card->list);
        INIT_LIST_HEAD(&card->dapm_dirty);
        card->instantiated = 0;
        mutex_init(&card->mutex);
@@ -4271,7 +4277,6 @@ int snd_soc_register_codec(struct device *dev,
        codec->dapm.stream_event = codec_drv->stream_event;
        codec->dev = dev;
        codec->driver = codec_drv;
-       codec->num_dai = num_dai;
        codec->component.val_bytes = codec_drv->reg_word_size;
        mutex_init(&codec->mutex);
 
@@ -4697,7 +4702,7 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
 
                        if (id < 0 || id >= pos->num_dai) {
                                ret = -EINVAL;
-                               break;
+                               continue;
                        }
 
                        ret = 0;
index a391de05803765403fc94e989717ad7dae91db5c..d2b950c99d888ad14fb0fc3c99f269f79c31e05f 100644 (file)
@@ -555,7 +555,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
 
        if (platform->driver->ops && platform->driver->ops->close)
                platform->driver->ops->close(substream);
-       cpu_dai->runtime = NULL;
 
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                if (snd_soc_runtime_ignore_pmdown_time(rtd)) {