Merge remote-tracking branch 'regulator/topic/arizona' into regulator-next
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 19 Feb 2013 12:42:30 +0000 (12:42 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 19 Feb 2013 12:42:30 +0000 (12:42 +0000)
1  2 
sound/soc/codecs/wm5102.c
sound/soc/codecs/wm5110.c

index 1440b3f9b7bbe1e04afdfd3d6857808f52972fa9,808608a053c2be7086b7a2cbfa940b976a55f6bd..988e817dca05fc15849391c968958eaf836de9a7
@@@ -36,9 -36,6 +36,9 @@@
  struct wm5102_priv {
        struct arizona_priv core;
        struct arizona_fll fll[2];
 +
 +      unsigned int spk_ena:2;
 +      unsigned int spk_ena_pending:1;
  };
  
  static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
@@@ -790,47 -787,6 +790,47 @@@ ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZO
  ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
  };
  
 +static int wm5102_spk_ev(struct snd_soc_dapm_widget *w,
 +                       struct snd_kcontrol *kcontrol,
 +                       int event)
 +{
 +      struct snd_soc_codec *codec = w->codec;
 +      struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
 +      struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec);
 +
 +      if (arizona->rev < 1)
 +              return 0;
 +
 +      switch (event) {
 +      case SND_SOC_DAPM_PRE_PMU:
 +              if (!wm5102->spk_ena) {
 +                      snd_soc_write(codec, 0x4f5, 0x25a);
 +                      wm5102->spk_ena_pending = true;
 +              }
 +              break;
 +      case SND_SOC_DAPM_POST_PMU:
 +              if (wm5102->spk_ena_pending) {
 +                      msleep(75);
 +                      snd_soc_write(codec, 0x4f5, 0xda);
 +                      wm5102->spk_ena_pending = false;
 +                      wm5102->spk_ena++;
 +              }
 +              break;
 +      case SND_SOC_DAPM_PRE_PMD:
 +              wm5102->spk_ena--;
 +              if (!wm5102->spk_ena)
 +                      snd_soc_write(codec, 0x4f5, 0x25a);
 +              break;
 +      case SND_SOC_DAPM_POST_PMD:
 +              if (!wm5102->spk_ena)
 +                      snd_soc_write(codec, 0x4f5, 0x0da);
 +              break;
 +      }
 +
 +      return 0;
 +}
 +
 +
  ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
  ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
  ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
@@@ -896,7 -852,8 +896,7 @@@ static const unsigned int wm5102_aec_lo
  
  static const struct soc_enum wm5102_aec_loopback =
        SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
 -                            ARIZONA_AEC_LOOPBACK_SRC_SHIFT,
 -                            ARIZONA_AEC_LOOPBACK_SRC_MASK,
 +                            ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
                              ARRAY_SIZE(wm5102_aec_loopback_texts),
                              wm5102_aec_loopback_texts,
                              wm5102_aec_loopback_values);
@@@ -1077,10 -1034,10 +1077,10 @@@ SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUT
                   ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
  SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1,
 -                 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 +                 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
  SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1,
 -                 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 +                 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
  SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
                   ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
@@@ -1152,6 -1109,8 +1152,8 @@@ SND_SOC_DAPM_OUTPUT("SPKOUTRN")
  SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
  SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
  SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
+ SND_SOC_DAPM_OUTPUT("MICSUPP"),
  };
  
  #define ARIZONA_MIXER_INPUT_ROUTES(name)      \
@@@ -1364,6 -1323,8 +1366,8 @@@ static const struct snd_soc_dapm_route 
        { "AEC Loopback", "SPKDAT1R", "OUT5R" },
        { "SPKDAT1L", NULL, "OUT5L" },
        { "SPKDAT1R", NULL, "OUT5R" },
+       { "MICSUPP", NULL, "SYSCLK" },
  };
  
  static int wm5102_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
index 7a090968c4f737bd360f05c2c7a66dc362350d21,c1d46d608e5d27894e9f13ef73b04c941068dce5..0320a32670d30c921836a0932f41d73b66b01c0b
@@@ -344,7 -344,8 +344,7 @@@ static const unsigned int wm5110_aec_lo
  
  static const struct soc_enum wm5110_aec_loopback =
        SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
 -                            ARIZONA_AEC_LOOPBACK_SRC_SHIFT,
 -                            ARIZONA_AEC_LOOPBACK_SRC_MASK,
 +                            ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
                              ARRAY_SIZE(wm5110_aec_loopback_texts),
                              wm5110_aec_loopback_texts,
                              wm5110_aec_loopback_values);
@@@ -624,6 -625,8 +624,8 @@@ SND_SOC_DAPM_OUTPUT("SPKDAT1L")
  SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
  SND_SOC_DAPM_OUTPUT("SPKDAT2L"),
  SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
+ SND_SOC_DAPM_OUTPUT("MICSUPP"),
  };
  
  #define ARIZONA_MIXER_INPUT_ROUTES(name)      \
@@@ -832,6 -835,8 +834,8 @@@ static const struct snd_soc_dapm_route 
  
        { "SPKDAT2L", NULL, "OUT6L" },
        { "SPKDAT2R", NULL, "OUT6R" },
+       { "MICSUPP", NULL, "SYSCLK" },
  };
  
  static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source,