ALSA: hda - Add debug prints for Realtek auto-init
[pandora-kernel.git] / sound / pci / hda / patch_realtek.c
index 965a531..ee92c73 100644 (file)
@@ -770,7 +770,7 @@ static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
 
        if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
                unsigned int pincap;
-               pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
+               pincap = snd_hda_query_pin_caps(codec, nid);
                pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
                if (pincap & AC_PINCAP_VREF_80)
                        val = PIN_VREF80;
@@ -1022,6 +1022,9 @@ static void alc_subsystem_id(struct hda_codec *codec,
        if (codec->vendor_id == 0x10ec0260)
                nid = 0x17;
        ass = snd_hda_codec_get_pincfg(codec, nid);
+       snd_printd("realtek: No valid SSID, "
+                  "checking pincfg 0x%08x for NID 0x%x\n",
+                  nid, ass);
        if (!(ass & 1) && !(ass & 0x100000))
                return;
        if ((ass >> 30) != 1)   /* no physical connection */
@@ -1036,6 +1039,8 @@ static void alc_subsystem_id(struct hda_codec *codec,
        if (((ass >> 16) & 0xf) != tmp)
                return;
 do_sku:
+       snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
+                  ass & 0xffff, codec->vendor_id);
        /*
         * 0 : override
         * 1 :  Swap Jack
@@ -1595,8 +1600,7 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
                                     snd_hda_mixer_amp_switch_put);
 }
 
-#define DEFINE_CAPMIX(num) \
-static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
+#define _DEFINE_CAPMIX(num) \
        { \
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
                .name = "Capture Switch", \
@@ -1617,7 +1621,9 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
                .get = alc_cap_vol_get, \
                .put = alc_cap_vol_put, \
                .tlv = { .c = alc_cap_vol_tlv }, \
-       }, \
+       }
+
+#define _DEFINE_CAPSRC(num) \
        { \
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
                /* .name = "Capture Source", */ \
@@ -1626,15 +1632,28 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
                .info = alc_mux_enum_info, \
                .get = alc_mux_enum_get, \
                .put = alc_mux_enum_put, \
-       }, \
-       { } /* end */ \
+       }
+
+#define DEFINE_CAPMIX(num) \
+static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
+       _DEFINE_CAPMIX(num),                                  \
+       _DEFINE_CAPSRC(num),                                  \
+       { } /* end */                                         \
+}
+
+#define DEFINE_CAPMIX_NOSRC(num) \
+static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
+       _DEFINE_CAPMIX(num),                                        \
+       { } /* end */                                               \
 }
 
 /* up to three ADCs */
 DEFINE_CAPMIX(1);
 DEFINE_CAPMIX(2);
 DEFINE_CAPMIX(3);
-
+DEFINE_CAPMIX_NOSRC(1);
+DEFINE_CAPMIX_NOSRC(2);
+DEFINE_CAPMIX_NOSRC(3);
 
 /*
  * ALC880 5-stack model
@@ -4207,7 +4226,8 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec)
                hda_nid_t nid = spec->autocfg.input_pins[i];
                if (alc880_is_input_pin(nid)) {
                        alc_set_input_pin(codec, nid, i);
-                       if (nid != ALC880_PIN_CD_NID)
+                       if (nid != ALC880_PIN_CD_NID &&
+                           (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
                                snd_hda_codec_write(codec, nid, 0,
                                                    AC_VERB_SET_AMP_GAIN_MUTE,
                                                    AMP_OUT_MUTE);
@@ -4297,13 +4317,22 @@ static void alc880_auto_init(struct hda_codec *codec)
 
 static void set_capture_mixer(struct alc_spec *spec)
 {
-       static struct snd_kcontrol_new *caps[3] = {
-               alc_capture_mixer1,
-               alc_capture_mixer2,
-               alc_capture_mixer3,
+       static struct snd_kcontrol_new *caps[2][3] = {
+               { alc_capture_mixer_nosrc1,
+                 alc_capture_mixer_nosrc2,
+                 alc_capture_mixer_nosrc3 },
+               { alc_capture_mixer1,
+                 alc_capture_mixer2,
+                 alc_capture_mixer3 },
        };
-       if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3)
-               spec->cap_mixer = caps[spec->num_adc_nids - 1];
+       if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
+               int mux;
+               if (spec->input_mux && spec->input_mux->num_items > 1)
+                       mux = 1;
+               else
+                       mux = 0;
+               spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
+       }
 }
 
 #define set_beep_amp(spec, nid, idx, dir) \
@@ -5673,7 +5702,8 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec)
                hda_nid_t nid = spec->autocfg.input_pins[i];
                if (nid >= 0x12) {
                        alc_set_input_pin(codec, nid, i);
-                       if (nid != ALC260_PIN_CD_NID)
+                       if (nid != ALC260_PIN_CD_NID &&
+                           (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
                                snd_hda_codec_write(codec, nid, 0,
                                                    AC_VERB_SET_AMP_GAIN_MUTE,
                                                    AMP_OUT_MUTE);
@@ -8652,6 +8682,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
        SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
        SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
        SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
+       SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
        SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
        SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
        SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
@@ -9153,7 +9184,8 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec)
                hda_nid_t nid = spec->autocfg.input_pins[i];
                if (alc883_is_input_pin(nid)) {
                        alc_set_input_pin(codec, nid, i);
-                       if (nid != ALC883_PIN_CD_NID)
+                       if (nid != ALC883_PIN_CD_NID &&
+                           (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
                                snd_hda_codec_write(codec, nid, 0,
                                                    AC_VERB_SET_AMP_GAIN_MUTE,
                                                    AMP_OUT_MUTE);
@@ -14880,7 +14912,8 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
                hda_nid_t nid = spec->autocfg.input_pins[i];
                if (alc861vd_is_input_pin(nid)) {
                        alc_set_input_pin(codec, nid, i);
-                       if (nid != ALC861VD_PIN_CD_NID)
+                       if (nid != ALC861VD_PIN_CD_NID &&
+                           (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
                                snd_hda_codec_write(codec, nid, 0,
                                                AC_VERB_SET_AMP_GAIN_MUTE,
                                                AMP_OUT_MUTE);
@@ -16746,16 +16779,10 @@ static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
 
 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
 {
-       unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
+       unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
        return (pincap & AC_PINCAP_IN) != 0;
 }
 
-static int alc662_is_output_pin(struct hda_codec *codec, hda_nid_t nid)
-{
-       unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
-       return (pincap & AC_PINCAP_OUT) != 0;
-}
-
 /* create playback/capture controls for input pins */
 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
                                                const struct auto_pin_cfg *cfg)
@@ -16844,7 +16871,7 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec)
                if (alc662_is_input_pin(codec, nid)) {
                        alc_set_input_pin(codec, nid, i);
                        if (nid != ALC662_PIN_CD_NID &&
-                           alc662_is_output_pin(codec, nid))
+                           (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
                                snd_hda_codec_write(codec, nid, 0,
                                                    AC_VERB_SET_AMP_GAIN_MUTE,
                                                    AMP_OUT_MUTE);