Merge branch 'fix/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 20 Aug 2009 17:19:39 +0000 (10:19 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 20 Aug 2009 17:19:39 +0000 (10:19 -0700)
* 'fix/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: hda - Fix probe of Toshiba laptops with ALC268 codec
  ALSA: hda: add model for Intel DG45ID/DG45FC boards
  ALSA: hda: enable speaker output for Compaq 6530s/6531s

1  2 
sound/pci/hda/patch_analog.c

@@@ -72,7 -72,6 +72,7 @@@ struct ad198x_spec 
        hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
  
        unsigned int jack_present :1;
 +      unsigned int inv_jack_detect:1;
  
  #ifdef CONFIG_SND_HDA_POWER_SAVE
        struct hda_loopback_check loopback;
@@@ -670,13 -669,39 +670,13 @@@ static struct hda_input_mux ad1986a_aut
        },
  };
  
 -static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
 +static struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
        HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
        HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
 -      HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
 -      {
 -              .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 -              .name = "Capture Source",
 -              .info = ad198x_mux_enum_info,
 -              .get = ad198x_mux_enum_get,
 -              .put = ad198x_mux_enum_put,
 -      },
 -      {
 -              .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 -              .name = "External Amplifier",
 -              .info = ad198x_eapd_info,
 -              .get = ad198x_eapd_get,
 -              .put = ad198x_eapd_put,
 -              .private_value = 0x1b | (1 << 8), /* port-D, inversed */
 -      },
        { } /* end */
  };
  
 -static struct snd_kcontrol_new ad1986a_samsung_mixers[] = {
 -      HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
 -      HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
 +static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
        HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
        { } /* end */
  };
  
 +static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
 +      HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
 +      HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
 +      { } /* end */
 +};
 +
  /* re-connect the mic boost input according to the jack sensing */
  static void ad1986a_automic(struct hda_codec *codec)
  {
@@@ -757,9 -776,8 +757,9 @@@ static void ad1986a_hp_automute(struct 
        unsigned int present;
  
        present = snd_hda_codec_read(codec, 0x1a, 0, AC_VERB_GET_PIN_SENSE, 0);
 -      /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
 -      spec->jack_present = !(present & 0x80000000);
 +      spec->jack_present = !!(present & 0x80000000);
 +      if (spec->inv_jack_detect)
 +              spec->jack_present = !spec->jack_present;
        ad1986a_update_hp(codec);
  }
  
@@@ -798,7 -816,7 +798,7 @@@ static int ad1986a_hp_master_sw_put(str
        return change;
  }
  
 -static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = {
 +static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
        HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .put = ad1986a_hp_master_sw_put,
                .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
        },
 -      HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
 -      HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
 -      {
 -              .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 -              .name = "Capture Source",
 -              .info = ad198x_mux_enum_info,
 -              .get = ad198x_mux_enum_get,
 -              .put = ad198x_mux_enum_put,
 -      },
 -      {
 -              .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 -              .name = "External Amplifier",
 -              .info = ad198x_eapd_info,
 -              .get = ad198x_eapd_get,
 -              .put = ad198x_eapd_put,
 -              .private_value = 0x1b | (1 << 8), /* port-D, inversed */
 -      },
        { } /* end */
  };
  
 +
  /*
   * initialization verbs
   */
@@@ -940,27 -981,6 +940,27 @@@ static struct hda_verb ad1986a_hp_init_
        {}
  };
  
 +static void ad1986a_samsung_p50_unsol_event(struct hda_codec *codec,
 +                                          unsigned int res)
 +{
 +      switch (res >> 26) {
 +      case AD1986A_HP_EVENT:
 +              ad1986a_hp_automute(codec);
 +              break;
 +      case AD1986A_MIC_EVENT:
 +              ad1986a_automic(codec);
 +              break;
 +      }
 +}
 +
 +static int ad1986a_samsung_p50_init(struct hda_codec *codec)
 +{
 +      ad198x_init(codec);
 +      ad1986a_hp_automute(codec);
 +      ad1986a_automic(codec);
 +      return 0;
 +}
 +
  
  /* models */
  enum {
        AD1986A_LAPTOP_AUTOMUTE,
        AD1986A_ULTRA,
        AD1986A_SAMSUNG,
 +      AD1986A_SAMSUNG_P50,
        AD1986A_MODELS
  };
  
@@@ -983,7 -1002,6 +983,7 @@@ static const char *ad1986a_models[AD198
        [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute",
        [AD1986A_ULTRA]         = "ultra",
        [AD1986A_SAMSUNG]       = "samsung",
 +      [AD1986A_SAMSUNG_P50]   = "samsung-p50",
  };
  
  static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
        SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD),
        SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK),
        SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP),
 +      SND_PCI_QUIRK(0x144d, 0xc024, "Samsung P50", AD1986A_SAMSUNG_P50),
        SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA),
        SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG),
        SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK),
@@@ -1094,10 -1111,7 +1094,10 @@@ static int patch_ad1986a(struct hda_cod
                spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
                break;
        case AD1986A_LAPTOP_EAPD:
 -              spec->mixers[0] = ad1986a_laptop_eapd_mixers;
 +              spec->num_mixers = 3;
 +              spec->mixers[0] = ad1986a_laptop_master_mixers;
 +              spec->mixers[1] = ad1986a_laptop_eapd_mixers;
 +              spec->mixers[2] = ad1986a_laptop_intmic_mixers;
                spec->num_init_verbs = 2;
                spec->init_verbs[1] = ad1986a_eapd_init_verbs;
                spec->multiout.max_channels = 2;
                spec->input_mux = &ad1986a_laptop_eapd_capture_source;
                break;
        case AD1986A_SAMSUNG:
 -              spec->mixers[0] = ad1986a_samsung_mixers;
 +              spec->num_mixers = 2;
 +              spec->mixers[0] = ad1986a_laptop_master_mixers;
 +              spec->mixers[1] = ad1986a_laptop_eapd_mixers;
                spec->num_init_verbs = 3;
                spec->init_verbs[1] = ad1986a_eapd_init_verbs;
                spec->init_verbs[2] = ad1986a_automic_verbs;
                codec->patch_ops.unsol_event = ad1986a_automic_unsol_event;
                codec->patch_ops.init = ad1986a_automic_init;
                break;
 +      case AD1986A_SAMSUNG_P50:
 +              spec->num_mixers = 2;
 +              spec->mixers[0] = ad1986a_automute_master_mixers;
 +              spec->mixers[1] = ad1986a_laptop_eapd_mixers;
 +              spec->num_init_verbs = 4;
 +              spec->init_verbs[1] = ad1986a_eapd_init_verbs;
 +              spec->init_verbs[2] = ad1986a_automic_verbs;
 +              spec->init_verbs[3] = ad1986a_hp_init_verbs;
 +              spec->multiout.max_channels = 2;
 +              spec->multiout.num_dacs = 1;
 +              spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
 +              if (!is_jack_available(codec, 0x25))
 +                      spec->multiout.dig_out_nid = 0;
 +              spec->input_mux = &ad1986a_automic_capture_source;
 +              codec->patch_ops.unsol_event = ad1986a_samsung_p50_unsol_event;
 +              codec->patch_ops.init = ad1986a_samsung_p50_init;
 +              break;
        case AD1986A_LAPTOP_AUTOMUTE:
 -              spec->mixers[0] = ad1986a_laptop_automute_mixers;
 +              spec->num_mixers = 3;
 +              spec->mixers[0] = ad1986a_automute_master_mixers;
 +              spec->mixers[1] = ad1986a_laptop_eapd_mixers;
 +              spec->mixers[2] = ad1986a_laptop_intmic_mixers;
                spec->num_init_verbs = 3;
                spec->init_verbs[1] = ad1986a_eapd_init_verbs;
                spec->init_verbs[2] = ad1986a_hp_init_verbs;
                spec->input_mux = &ad1986a_laptop_eapd_capture_source;
                codec->patch_ops.unsol_event = ad1986a_hp_unsol_event;
                codec->patch_ops.init = ad1986a_hp_init;
 +              /* Lenovo N100 seems to report the reversed bit
 +               * for HP jack-sensing
 +               */
 +              spec->inv_jack_detect = 1;
                break;
        case AD1986A_ULTRA:
                spec->mixers[0] = ad1986a_laptop_eapd_mixers;
@@@ -3835,9 -3823,11 +3835,11 @@@ static struct hda_verb ad1884a_laptop_v
        /* Port-F (int speaker) mixer - route only from analog mixer */
        {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
        {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
-       /* Port-F pin */
-       {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
+       /* Port-F (int speaker) pin */
+       {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
+       /* required for compaq 6530s/6531s speaker output */
+       {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
        /* Port-C pin - internal mic-in */
        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */