]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Merge remote-tracking branch 'asoc/topic/component' into asoc-next
authorMark Brown <broonie@kernel.org>
Sun, 19 Feb 2017 16:35:41 +0000 (16:35 +0000)
committerMark Brown <broonie@kernel.org>
Sun, 19 Feb 2017 16:35:41 +0000 (16:35 +0000)
1  2 
include/sound/soc.h
sound/soc/soc-core.c
sound/soc/soc-pcm.c

diff --combined include/sound/soc.h
index b86168a21d56c7fff1d59dfacbef93049bde888e,4504920dce72de2ef8e94236eca8d60de65f1a98..5ab2e7e090c8fca6b48bf085e7aab08cba0eecb5
@@@ -507,9 -507,6 +507,6 @@@ int snd_soc_params_to_bclk(struct snd_p
  int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
        const struct snd_pcm_hardware *hw);
  
- int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
-               int cmd, struct snd_soc_platform *platform);
  int soc_dai_hw_params(struct snd_pcm_substream *substream,
                      struct snd_pcm_hw_params *params,
                      struct snd_soc_dai *dai);
@@@ -785,6 -782,10 +782,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 *);
        /* DT */
        int (*of_xlate_dai_name)(struct snd_soc_component *component,
                                 struct of_phandle_args *args,
@@@ -813,7 -814,6 +814,7 @@@ struct snd_soc_component 
        unsigned int suspended:1; /* is in suspend PM state */
  
        struct list_head list;
 +      struct list_head card_aux_list; /* for auxiliary bound components */
        struct list_head card_list;
  
        struct snd_soc_dai_driver *dai_drv;
        void (*remove)(struct snd_soc_component *);
        int (*suspend)(struct snd_soc_component *);
        int (*resume)(struct snd_soc_component *);
+       int (*pcm_new)(struct snd_soc_pcm_runtime *);
+       void (*pcm_free)(struct snd_pcm *);
  
        /* machine specific init */
        int (*init)(struct snd_soc_component *component);
@@@ -941,20 -943,11 +944,11 @@@ struct snd_soc_platform_driver 
        int (*pcm_new)(struct snd_soc_pcm_runtime *);
        void (*pcm_free)(struct snd_pcm *);
  
-       /*
-        * For platform caused delay reporting.
-        * Optional.
-        */
-       snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
-               struct snd_soc_dai *);
        /* platform stream pcm ops */
        const struct snd_pcm_ops *ops;
  
        /* platform stream compress ops */
        const struct snd_compr_ops *compr_ops;
-       int (*bespoke_trigger)(struct snd_pcm_substream *, int);
  };
  
  struct snd_soc_dai_link_component {
@@@ -1153,7 -1146,6 +1147,7 @@@ struct snd_soc_card 
         */
        struct snd_soc_aux_dev *aux_dev;
        int num_aux_devs;
 +      struct list_head aux_comp_list;
  
        const struct snd_kcontrol_new *controls;
        int num_controls;
@@@ -1549,7 -1541,6 +1543,7 @@@ static inline void snd_soc_initialize_c
        INIT_LIST_HEAD(&card->widgets);
        INIT_LIST_HEAD(&card->paths);
        INIT_LIST_HEAD(&card->dapm_list);
 +      INIT_LIST_HEAD(&card->aux_comp_list);
        INIT_LIST_HEAD(&card->component_dev_list);
  }
  
diff --combined sound/soc/soc-core.c
index baa1afa41e3dd57fdc36655b7d3bbd147ade820f,981443e444d168c83ca63601e650744fdb26ac29..4f6f682df046fcb92dc56094b6556a4bfcaba29b
@@@ -1748,7 -1748,6 +1748,7 @@@ static int soc_bind_aux_dev(struct snd_
  
        component->init = aux_dev->init;
        component->auxiliary = 1;
 +      list_add(&component->card_aux_list, &card->aux_comp_list);
  
        return 0;
  
@@@ -1759,14 -1758,16 +1759,14 @@@ err_defer
  
  static int soc_probe_aux_devices(struct snd_soc_card *card)
  {
 -      struct snd_soc_component *comp;
 +      struct snd_soc_component *comp, *tmp;
        int order;
        int ret;
  
        for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST;
                order++) {
 -              list_for_each_entry(comp, &card->component_dev_list, card_list) {
 -                      if (!comp->auxiliary)
 -                              continue;
 -
 +              list_for_each_entry_safe(comp, tmp, &card->aux_comp_list,
 +                                       card_aux_list) {
                        if (comp->driver->probe_order == order) {
                                ret = soc_probe_component(card, comp);
                                if (ret < 0) {
                                                comp->name, ret);
                                        return ret;
                                }
 +                              list_del(&comp->card_aux_list);
                        }
                }
        }
@@@ -2976,6 -2976,8 +2976,8 @@@ static int snd_soc_component_initialize
        component->remove = component->driver->remove;
        component->suspend = component->driver->suspend;
        component->resume = component->driver->resume;
+       component->pcm_new = component->driver->pcm_new;
+       component->pcm_free= component->driver->pcm_free;
  
        dapm = &component->dapm;
        dapm->dev = dev;
@@@ -3158,6 -3160,21 +3160,21 @@@ static void snd_soc_platform_drv_remove
        platform->driver->remove(platform);
  }
  
+ static int snd_soc_platform_drv_pcm_new(struct snd_soc_pcm_runtime *rtd)
+ {
+       struct snd_soc_platform *platform = rtd->platform;
+       return platform->driver->pcm_new(rtd);
+ }
+ static void snd_soc_platform_drv_pcm_free(struct snd_pcm *pcm)
+ {
+       struct snd_soc_pcm_runtime *rtd = pcm->private_data;
+       struct snd_soc_platform *platform = rtd->platform;
+       platform->driver->pcm_free(pcm);
+ }
  /**
   * snd_soc_add_platform - Add a platform to the ASoC core
   * @dev: The parent device for the platform
@@@ -3181,6 -3198,10 +3198,10 @@@ int snd_soc_add_platform(struct device 
                platform->component.probe = snd_soc_platform_drv_probe;
        if (platform_drv->remove)
                platform->component.remove = snd_soc_platform_drv_remove;
+       if (platform_drv->pcm_new)
+               platform->component.pcm_new = snd_soc_platform_drv_pcm_new;
+       if (platform_drv->pcm_free)
+               platform->component.pcm_free = snd_soc_platform_drv_pcm_free;
  
  #ifdef CONFIG_DEBUG_FS
        platform->component.debugfs_prefix = "platform";
diff --combined sound/soc/soc-pcm.c
index 6aba14009c92abc853d72575ed447e934ed5e458,dec0b20d3f3e91c0a82fae8eb6c98b9cda545dd5..efc5831f205dc41670d35013926bd0749d16d4d7
@@@ -1055,7 -1055,6 +1055,6 @@@ static int soc_pcm_bespoke_trigger(stru
                                   int cmd)
  {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_platform *platform = rtd->platform;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
        struct snd_soc_dai *codec_dai;
        int i, ret;
                }
        }
  
-       if (platform->driver->bespoke_trigger) {
-               ret = platform->driver->bespoke_trigger(substream, cmd);
-               if (ret < 0)
-                       return ret;
-       }
        if (cpu_dai->driver->ops && cpu_dai->driver->ops->bespoke_trigger) {
                ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai);
                if (ret < 0)
@@@ -1116,13 -1109,6 +1109,6 @@@ static snd_pcm_uframes_t soc_pcm_pointe
        }
        delay += codec_delay;
  
-       /*
-        * None of the existing platform drivers implement delay(), so
-        * for now the codec_dai of first multicodec entry is used
-        */
-       if (platform->driver->delay)
-               delay += platform->driver->delay(substream, rtd->codec_dais[0]);
        runtime->delay = delay;
  
        return offset;
@@@ -2184,11 -2170,9 +2170,11 @@@ static int dpcm_fe_dai_do_trigger(struc
                break;
        case SNDRV_PCM_TRIGGER_STOP:
        case SNDRV_PCM_TRIGGER_SUSPEND:
 -      case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
                fe->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP;
                break;
 +      case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 +              fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PAUSED;
 +              break;
        }
  
  out:
@@@ -2642,12 -2626,25 +2628,25 @@@ static int dpcm_fe_dai_close(struct snd
        return ret;
  }
  
+ static void soc_pcm_free(struct snd_pcm *pcm)
+ {
+       struct snd_soc_pcm_runtime *rtd = pcm->private_data;
+       struct snd_soc_component *component;
+       list_for_each_entry(component, &rtd->card->component_dev_list,
+                           card_list) {
+               if (component->pcm_free)
+                       component->pcm_free(pcm);
+       }
+ }
  /* create a new pcm */
  int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
  {
        struct snd_soc_platform *platform = rtd->platform;
        struct snd_soc_dai *codec_dai;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+       struct snd_soc_component *component;
        struct snd_pcm *pcm;
        char new_name[64];
        int ret = 0, playback = 0, capture = 0;
        if (capture)
                snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
  
-       if (platform->driver->pcm_new) {
-               ret = platform->driver->pcm_new(rtd);
-               if (ret < 0) {
-                       dev_err(platform->dev,
-                               "ASoC: pcm constructor failed: %d\n",
-                               ret);
-                       return ret;
+       list_for_each_entry(component, &rtd->card->component_dev_list, card_list) {
+               if (component->pcm_new) {
+                       ret = component->pcm_new(rtd);
+                       if (ret < 0) {
+                               dev_err(component->dev,
+                                       "ASoC: pcm constructor failed: %d\n",
+                                       ret);
+                               return ret;
+                       }
                }
        }
-       pcm->private_free = platform->driver->pcm_free;
+       pcm->private_free = soc_pcm_free;
  out:
        dev_info(rtd->card->dev, "%s <-> %s mapping ok\n",
                 (rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name,
@@@ -2874,15 -2872,6 +2874,6 @@@ int snd_soc_dpcm_can_be_params(struct s
  }
  EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params);
  
- int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
-               int cmd, struct snd_soc_platform *platform)
- {
-       if (platform->driver->ops && platform->driver->ops->trigger)
-               return platform->driver->ops->trigger(substream, cmd);
-       return 0;
- }
- EXPORT_SYMBOL_GPL(snd_soc_platform_trigger);
  #ifdef CONFIG_DEBUG_FS
  static const char *dpcm_state_string(enum snd_soc_dpcm_state state)
  {