]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - sound/soc/codecs/88pm860x-codec.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / sound / soc / codecs / 88pm860x-codec.c
index 01d19e9f53f933ed4761c4c3dcdd5e1f68db43c1..06b6981b8d6d6e87aa8519113d936946412246e4 100644 (file)
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
-#include <sound/soc-dapm.h>
 #include <sound/tlv.h>
 #include <sound/initval.h>
 #include <sound/jack.h>
+#include <trace/events/asoc.h>
 
 #include "88pm860x-codec.h"
 
@@ -146,7 +146,6 @@ struct pm860x_priv {
 
        int                     irq[4];
        unsigned char           name[4][MAX_NAME_LEN];
-       unsigned char           reg_cache[REG_CACHE_SIZE];
 };
 
 /* -9450dB to 0dB in 150dB steps ( mute instead of -9450dB) */
@@ -1172,7 +1171,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
                break;
 
        case SND_SOC_BIAS_STANDBY:
-               if (codec->bias_level == SND_SOC_BIAS_OFF) {
+               if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
                        /* Enable Audio PLL & Audio section */
                        data = AUDIO_PLL | AUDIO_SECTION_RESET
                                | AUDIO_SECTION_ON;
@@ -1185,7 +1184,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
                pm860x_set_bits(codec->control_data, REG_MISC2, data, 0);
                break;
        }
-       codec->bias_level = level;
+       codec->dapm.bias_level = level;
        return 0;
 }
 
@@ -1263,6 +1262,12 @@ static irqreturn_t pm860x_codec_handler(int irq, void *data)
        mask = pm860x->det.hs_shrt | pm860x->det.hook_det | pm860x->det.lo_shrt
                | pm860x->det.hp_det;
 
+#ifndef CONFIG_SND_SOC_88PM860X_MODULE
+       if (status & (HEADSET_STATUS | MIC_STATUS | SHORT_HS1 | SHORT_HS2 |
+                     SHORT_LO1 | SHORT_LO2))
+               trace_snd_soc_jack_irq(dev_name(pm860x->codec->dev));
+#endif
+
        if ((pm860x->det.hp_det & SND_JACK_HEADPHONE)
                && (status & HEADSET_STATUS))
                report |= SND_JACK_HEADPHONE;
@@ -1346,6 +1351,7 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect);
 static int pm860x_probe(struct snd_soc_codec *codec)
 {
        struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
+       struct snd_soc_dapm_context *dapm = &codec->dapm;
        int i, ret;
 
        pm860x->codec = codec;
@@ -1358,7 +1364,7 @@ static int pm860x_probe(struct snd_soc_codec *codec)
                                           pm860x->name[i], pm860x);
                if (ret < 0) {
                        dev_err(codec->dev, "Failed to request IRQ!\n");
-                       goto out_irq;
+                       goto out;
                }
        }
 
@@ -1369,22 +1375,20 @@ static int pm860x_probe(struct snd_soc_codec *codec)
        if (ret < 0) {
                dev_err(codec->dev, "Failed to fill register cache: %d\n",
                        ret);
-               goto out_codec;
+               goto out;
        }
 
        snd_soc_add_controls(codec, pm860x_snd_controls,
                             ARRAY_SIZE(pm860x_snd_controls));
-       snd_soc_dapm_new_controls(codec, pm860x_dapm_widgets,
+       snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets,
                                  ARRAY_SIZE(pm860x_dapm_widgets));
-       snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
+       snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
        return 0;
 
-out_codec:
-       i = 3;
-out_irq:
-       for (; i >= 0; i--)
+out:
+       while (--i >= 0)
                free_irq(pm860x->irq[i], pm860x);
-       return -EINVAL;
+       return ret;
 }
 
 static int pm860x_remove(struct snd_soc_codec *codec)