ASoC: Decouple DAPM from CODECs
[deliverable/linux.git] / sound / soc / soc-core.c
index 2198936cfb688b80fcf0d40c1e88db1fd57b8131..3c7c884f212c66ef7b4e7c255cc77f7625b82894 100644 (file)
@@ -255,18 +255,18 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
 
        codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644,
                                                     codec->debugfs_codec_root,
-                                                    &codec->pop_time);
+                                                    &codec->dapm.pop_time);
        if (!codec->debugfs_pop_time)
                printk(KERN_WARNING
                       "Failed to create pop time debugfs file\n");
 
-       codec->debugfs_dapm = debugfs_create_dir("dapm",
+       codec->dapm.debugfs_dapm = debugfs_create_dir("dapm",
                                                 codec->debugfs_codec_root);
-       if (!codec->debugfs_dapm)
+       if (!codec->dapm.debugfs_dapm)
                printk(KERN_WARNING
                       "Failed to create DAPM debugfs directory\n");
 
-       snd_soc_dapm_debugfs_init(codec);
+       snd_soc_dapm_debugfs_init(&codec->dapm);
 }
 
 static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
@@ -1017,7 +1017,7 @@ static int soc_suspend(struct device *dev)
        /* close any waiting streams and save state */
        for (i = 0; i < card->num_rtd; i++) {
                run_delayed_work(&card->rtd[i].delayed_work);
-               card->rtd[i].codec->suspend_bias_level = card->rtd[i].codec->bias_level;
+               card->rtd[i].codec->dapm.suspend_bias_level = card->rtd[i].codec->dapm.bias_level;
        }
 
        for (i = 0; i < card->num_rtd; i++) {
@@ -1041,7 +1041,7 @@ static int soc_suspend(struct device *dev)
                /* If there are paths active then the CODEC will be held with
                 * bias _ON and should not be suspended. */
                if (!codec->suspended && codec->driver->suspend) {
-                       switch (codec->bias_level) {
+                       switch (codec->dapm.bias_level) {
                        case SND_SOC_BIAS_STANDBY:
                        case SND_SOC_BIAS_OFF:
                                codec->driver->suspend(codec, PMSG_SUSPEND);
@@ -1110,7 +1110,7 @@ static void soc_resume_deferred(struct work_struct *work)
                 * resume.  Otherwise the suspend was suppressed.
                 */
                if (codec->driver->resume && codec->suspended) {
-                       switch (codec->bias_level) {
+                       switch (codec->dapm.bias_level) {
                        case SND_SOC_BIAS_STANDBY:
                        case SND_SOC_BIAS_OFF:
                                codec->driver->resume(codec);
@@ -1346,7 +1346,7 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num)
                }
 
                /* Make sure all DAPM widgets are freed */
-               snd_soc_dapm_free(codec);
+               snd_soc_dapm_free(&codec->dapm);
 
                soc_cleanup_codec_debugfs(codec);
                device_remove_file(&rtd->dev, &dev_attr_codec_reg);
@@ -1470,8 +1470,8 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)
        }
 
        /* Make sure all DAPM widgets are instantiated */
-       snd_soc_dapm_new_widgets(codec);
-       snd_soc_dapm_sync(codec);
+       snd_soc_dapm_new_widgets(&codec->dapm);
+       snd_soc_dapm_sync(&codec->dapm);
 
        /* register the rtd device */
        rtd->dev.release = rtd_release;
@@ -3238,6 +3238,12 @@ int snd_soc_register_codec(struct device *dev,
                return -ENOMEM;
        }
 
+       INIT_LIST_HEAD(&codec->dapm.widgets);
+       INIT_LIST_HEAD(&codec->dapm.paths);
+       codec->dapm.bias_level = SND_SOC_BIAS_OFF;
+       codec->dapm.dev = dev;
+       codec->dapm.codec = codec;
+
        /* allocate CODEC register cache */
        if (codec_drv->reg_cache_size && codec_drv->reg_word_size) {
 
@@ -3257,11 +3263,8 @@ int snd_soc_register_codec(struct device *dev,
 
        codec->dev = dev;
        codec->driver = codec_drv;
-       codec->bias_level = SND_SOC_BIAS_OFF;
        codec->num_dai = num_dai;
        mutex_init(&codec->mutex);
-       INIT_LIST_HEAD(&codec->dapm_widgets);
-       INIT_LIST_HEAD(&codec->dapm_paths);
 
        for (i = 0; i < num_dai; i++) {
                fixup_codec_formats(&dai_drv[i].playback);
This page took 0.02722 seconds and 5 git commands to generate.