Merge remote-tracking branches 'asoc/topic/cs47l24', 'asoc/topic/cx20442', 'asoc...
[sfrench/cifs-2.6.git] / sound / soc / soc-core.c
index 6a13fbcba23f398683d0e1b24cbec69601e20708..01fd7c472ea4584e1d8c7cab327c16f31577a892 100644 (file)
@@ -213,7 +213,7 @@ static umode_t soc_dev_attr_is_visible(struct kobject *kobj,
 
        if (attr == &dev_attr_pmdown_time.attr)
                return attr->mode; /* always visible */
-       return rtd->codec ? attr->mode : 0; /* enabled only with codec */
+       return rtd->num_codecs ? attr->mode : 0; /* enabled only with codec */
 }
 
 static const struct attribute_group soc_dapm_dev_group = {
@@ -590,14 +590,23 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
 {
        struct snd_soc_rtdcom_list *rtdcom;
 
+       if (!driver_name)
+               return NULL;
+
        for_each_rtdcom(rtd, rtdcom) {
-               if ((rtdcom->component->driver->name == driver_name) ||
-                   strcmp(rtdcom->component->driver->name, driver_name) == 0)
+               const char *component_name = rtdcom->component->driver->name;
+
+               if (!component_name)
+                       continue;
+
+               if ((component_name == driver_name) ||
+                   strcmp(component_name, driver_name) == 0)
                        return rtdcom->component;
        }
 
        return NULL;
 }
+EXPORT_SYMBOL_GPL(snd_soc_rtdcom_lookup);
 
 struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
                const char *dai_link, int stream)
@@ -1392,6 +1401,16 @@ static int soc_init_dai_link(struct snd_soc_card *card,
        return 0;
 }
 
+void snd_soc_disconnect_sync(struct device *dev)
+{
+       struct snd_soc_component *component = snd_soc_lookup_component(dev, NULL);
+
+       if (!component || !component->card)
+               return;
+
+       snd_card_disconnect_sync(component->card->snd_card);
+}
+
 /**
  * snd_soc_add_dai_link - Add a DAI link dynamically
  * @card: The ASoC card to which the DAI link is added
@@ -1945,7 +1964,9 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
        }
 
        /* Flip the polarity for the "CPU" end of a CODEC<->CODEC link */
-       if (cpu_dai->codec) {
+       /* the component which has non_legacy_dai_naming is Codec */
+       if (cpu_dai->codec ||
+           cpu_dai->component->driver->non_legacy_dai_naming) {
                unsigned int inv_dai_fmt;
 
                inv_dai_fmt = dai_fmt & ~SND_SOC_DAIFMT_MASTER_MASK;