]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/hda/hda_proc.c
[ALSA] hda: STAC927x VREF fix
[linux-2.6-omap-h63xx.git] / sound / pci / hda / hda_proc.c
index ac15066fd300e7c62b706a48493930cc206c8893..7df1d16d146934ad81f02182c283065b37882d66 100644 (file)
@@ -58,7 +58,8 @@ static void print_amp_caps(struct snd_info_buffer *buffer,
                snd_iprintf(buffer, "N/A\n");
                return;
        }
-       snd_iprintf(buffer, "ofs=0x%02x, nsteps=0x%02x, stepsize=0x%02x, mute=%x\n",
+       snd_iprintf(buffer, "ofs=0x%02x, nsteps=0x%02x, stepsize=0x%02x, "
+                   "mute=%x\n",
                    caps & AC_AMPCAP_OFFSET,
                    (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT,
                    (caps & AC_AMPCAP_STEP_SIZE) >> AC_AMPCAP_STEP_SIZE_SHIFT,
@@ -76,11 +77,13 @@ static void print_amp_vals(struct snd_info_buffer *buffer,
        for (i = 0; i < indices; i++) {
                snd_iprintf(buffer, " [");
                if (stereo) {
-                       val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE,
+                       val = snd_hda_codec_read(codec, nid, 0,
+                                                AC_VERB_GET_AMP_GAIN_MUTE,
                                                 AC_AMP_GET_LEFT | dir | i);
                        snd_iprintf(buffer, "0x%02x ", val);
                }
-               val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE,
+               val = snd_hda_codec_read(codec, nid, 0,
+                                        AC_VERB_GET_AMP_GAIN_MUTE,
                                         AC_AMP_GET_RIGHT | dir | i);
                snd_iprintf(buffer, "0x%02x]", val);
        }
@@ -210,7 +213,7 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
                "SPDIF In", "Digitial In", "Reserved", "Other"
        };
        static char *jack_locations[4] = { "Ext", "Int", "Sep", "Oth" };
-       unsigned int caps;
+       unsigned int caps, val;
 
        caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
        snd_iprintf(buffer, "  Pincap 0x08%x:", caps);
@@ -234,10 +237,16 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
        snd_iprintf(buffer, "    Conn = %s, Color = %s\n",
                    get_jack_connection(caps),
                    get_jack_color(caps));
+       if (caps & AC_PINCAP_EAPD) {
+               val = snd_hda_codec_read(codec, nid, 0,
+                                        AC_VERB_GET_EAPD_BTLENABLE, 0);
+               snd_iprintf(buffer, "  EAPD: 0x%x\n", val);
+       }
 }
 
 
-static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
+static void print_codec_info(struct snd_info_entry *entry,
+                            struct snd_info_buffer *buffer)
 {
        struct hda_codec *codec = entry->private_data;
        char buf[32];
@@ -258,6 +267,7 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
 
        if (! codec->afg)
                return;
+       snd_hda_power_up(codec);
        snd_iprintf(buffer, "Default PCM:\n");
        print_pcm_caps(buffer, codec, codec->afg);
        snd_iprintf(buffer, "Default Amp-In caps: ");
@@ -268,14 +278,18 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
        nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid);
        if (! nid || nodes < 0) {
                snd_iprintf(buffer, "Invalid AFG subtree\n");
+               snd_hda_power_down(codec);
                return;
        }
        for (i = 0; i < nodes; i++, nid++) {
-               unsigned int wid_caps = snd_hda_param_read(codec, nid,
-                                                          AC_PAR_AUDIO_WIDGET_CAP);
-               unsigned int wid_type = (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
+               unsigned int wid_caps =
+                       snd_hda_param_read(codec, nid,
+                                          AC_PAR_AUDIO_WIDGET_CAP);
+               unsigned int wid_type =
+                       (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
                int conn_len = 0; 
                hda_nid_t conn[HDA_MAX_CONNECTIONS];
+               unsigned int pinctls;
 
                snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid,
                            get_wid_type_name(wid_type), wid_caps);
@@ -291,6 +305,12 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
                        snd_iprintf(buffer, " Amp-Out");
                snd_iprintf(buffer, "\n");
 
+               /* volume knob is a special widget that always have connection
+                * list
+                */
+               if (wid_type == AC_WID_VOL_KNB)
+                       wid_caps |= AC_WCAP_CONN_LIST;
+
                if (wid_caps & AC_WCAP_CONN_LIST)
                        conn_len = snd_hda_get_connections(codec, nid, conn,
                                                           HDA_MAX_CONNECTIONS);
@@ -310,10 +330,12 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
                                       wid_caps & AC_WCAP_STEREO, 1);
                }
 
-               if (wid_type == AC_WID_PIN) {
-                       unsigned int pinctls;
+               switch (wid_type) {
+               case AC_WID_PIN:
                        print_pin_caps(buffer, codec, nid);
-                       pinctls = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+                       pinctls = snd_hda_codec_read(codec, nid, 0,
+                                            AC_VERB_GET_PIN_WIDGET_CONTROL,
+                                                    0);
                        snd_iprintf(buffer, "  Pin-ctls: 0x%02x:", pinctls);
                        if (pinctls & AC_PINCTL_IN_EN)
                                snd_iprintf(buffer, " IN");
@@ -322,18 +344,32 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
                        if (pinctls & AC_PINCTL_HP_EN)
                                snd_iprintf(buffer, " HP");
                        snd_iprintf(buffer, "\n");
-               }
-
-               if ((wid_type == AC_WID_AUD_OUT || wid_type == AC_WID_AUD_IN) &&
-                   (wid_caps & AC_WCAP_FORMAT_OVRD)) {
-                       snd_iprintf(buffer, "  PCM:\n");
-                       print_pcm_caps(buffer, codec, nid);
+                       break;
+               case AC_WID_VOL_KNB:
+                       pinctls = snd_hda_param_read(codec, nid,
+                                                    AC_PAR_VOL_KNB_CAP);
+                       snd_iprintf(buffer, "  Volume-Knob: delta=%d, "
+                                   "steps=%d, ",
+                                   (pinctls >> 7) & 1, pinctls & 0x7f);
+                       pinctls = snd_hda_codec_read(codec, nid, 0,
+                                       AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
+                       snd_iprintf(buffer, "direct=%d, val=%d\n",
+                                   (pinctls >> 7) & 1, pinctls & 0x7f);
+                       break;
+               case AC_WID_AUD_OUT:
+               case AC_WID_AUD_IN:
+                       if (wid_caps & AC_WCAP_FORMAT_OVRD) {
+                               snd_iprintf(buffer, "  PCM:\n");
+                               print_pcm_caps(buffer, codec, nid);
+                       }
+                       break;
                }
 
                if (wid_caps & AC_WCAP_POWER)
                        snd_iprintf(buffer, "  Power: 0x%x\n",
                                    snd_hda_codec_read(codec, nid, 0,
-                                                      AC_VERB_GET_POWER_STATE, 0));
+                                                      AC_VERB_GET_POWER_STATE,
+                                                      0));
 
                if (wid_caps & AC_WCAP_CONN_LIST) {
                        int c, curr = -1;
@@ -341,15 +377,18 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
                                curr = snd_hda_codec_read(codec, nid, 0,
                                        AC_VERB_GET_CONNECT_SEL, 0);
                        snd_iprintf(buffer, "  Connection: %d\n", conn_len);
-                       snd_iprintf(buffer, "    ");
-                       for (c = 0; c < conn_len; c++) {
-                               snd_iprintf(buffer, " 0x%02x", conn[c]);
-                               if (c == curr)
-                                       snd_iprintf(buffer, "*");
+                       if (conn_len > 0) {
+                               snd_iprintf(buffer, "    ");
+                               for (c = 0; c < conn_len; c++) {
+                                       snd_iprintf(buffer, " 0x%02x", conn[c]);
+                                       if (c == curr)
+                                               snd_iprintf(buffer, "*");
+                               }
+                               snd_iprintf(buffer, "\n");
                        }
-                       snd_iprintf(buffer, "\n");
                }
        }
+       snd_hda_power_down(codec);
 }
 
 /*