Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[pandora-kernel.git] / sound / soc / codecs / wm8400.c
index 502eefa..b9ef4d9 100644 (file)
@@ -1022,10 +1022,15 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
        if (freq_in == wm8400->fll_in && freq_out == wm8400->fll_out)
                return 0;
 
-       if (freq_out != 0) {
+       if (freq_out) {
                ret = fll_factors(wm8400, &factors, freq_in, freq_out);
                if (ret != 0)
                        return ret;
+       } else {
+               /* Bodge GCC 4.4.0 uninitialised variable warning - it
+                * doesn't seem capable of working out that we exit if
+                * freq_out is 0 before any of the uses. */
+               memset(&factors, 0, sizeof(factors));
        }
 
        wm8400->fll_out = freq_out;
@@ -1040,7 +1045,7 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
        reg &= ~WM8400_FLL_OSC_ENA;
        wm8400_write(codec, WM8400_FLL_CONTROL_1, reg);
 
-       if (freq_out == 0)
+       if (!freq_out)
                return 0;
 
        reg &= ~(WM8400_FLL_REF_FREQ | WM8400_FLL_FRATIO_MASK);
@@ -1553,6 +1558,21 @@ static int __exit wm8400_codec_remove(struct platform_device *dev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+static int wm8400_pdev_suspend(struct platform_device *pdev, pm_message_t msg)
+{
+       return snd_soc_suspend_device(&pdev->dev);
+}
+
+static int wm8400_pdev_resume(struct platform_device *pdev)
+{
+       return snd_soc_resume_device(&pdev->dev);
+}
+#else
+#define wm8400_pdev_suspend NULL
+#define wm8400_pdev_resume NULL
+#endif
+
 static struct platform_driver wm8400_codec_driver = {
        .driver = {
                .name = "wm8400-codec",
@@ -1560,6 +1580,8 @@ static struct platform_driver wm8400_codec_driver = {
        },
        .probe = wm8400_codec_probe,
        .remove = __exit_p(wm8400_codec_remove),
+       .suspend = wm8400_pdev_suspend,
+       .resume = wm8400_pdev_resume,
 };
 
 static int __init wm8400_codec_init(void)