ASoC: Fix WM835x Out4 capture enumeration
[pandora-kernel.git] / sound / soc / codecs / wm8350.c
index f6bb599..3ff0373 100644 (file)
@@ -63,6 +63,8 @@ struct wm8350_data {
        struct wm8350_jack_data hpl;
        struct wm8350_jack_data hpr;
        struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
+       int fll_freq_out;
+       int fll_freq_in;
 };
 
 static unsigned int wm8350_codec_cache_read(struct snd_soc_codec *codec,
@@ -610,7 +612,7 @@ SOC_DAPM_SINGLE("Switch", WM8350_BEEP_VOLUME, 15, 1, 1);
 
 /* Out4 Capture Mux */
 static const struct snd_kcontrol_new wm8350_out4_capture_controls =
-SOC_DAPM_ENUM("Route", wm8350_enum[8]);
+SOC_DAPM_ENUM("Route", wm8350_enum[7]);
 
 static const struct snd_soc_dapm_widget wm8350_dapm_widgets[] = {
 
@@ -1104,10 +1106,14 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
 {
        struct snd_soc_codec *codec = codec_dai->codec;
        struct wm8350 *wm8350 = codec->control_data;
+       struct wm8350_data *priv = codec->private_data;
        struct _fll_div fll_div;
        int ret = 0;
        u16 fll_1, fll_4;
 
+       if (freq_in == priv->fll_freq_in && freq_out == priv->fll_freq_out)
+               return 0;
+
        /* power down FLL - we need to do this for reconfiguration */
        wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_4,
                          WM8350_FLL_ENA | WM8350_FLL_OSC_ENA);
@@ -1142,6 +1148,9 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
        wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_FLL_OSC_ENA);
        wm8350_set_bits(wm8350, WM8350_POWER_MGMT_4, WM8350_FLL_ENA);
 
+       priv->fll_freq_out = freq_out;
+       priv->fll_freq_in = freq_in;
+
        return 0;
 }
 
@@ -1671,6 +1680,21 @@ static int __devexit wm8350_codec_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+static int wm8350_codec_suspend(struct platform_device *pdev, pm_message_t m)
+{
+       return snd_soc_suspend_device(&pdev->dev);
+}
+
+static int wm8350_codec_resume(struct platform_device *pdev)
+{
+       return snd_soc_resume_device(&pdev->dev);
+}
+#else
+#define wm8350_codec_suspend NULL
+#define wm8350_codec_resume NULL
+#endif
+
 static struct platform_driver wm8350_codec_driver = {
        .driver = {
                   .name = "wm8350-codec",
@@ -1678,6 +1702,8 @@ static struct platform_driver wm8350_codec_driver = {
                   },
        .probe = wm8350_codec_probe,
        .remove = __devexit_p(wm8350_codec_remove),
+       .suspend = wm8350_codec_suspend,
+       .resume = wm8350_codec_resume,
 };
 
 static __init int wm8350_init(void)