[ALSA] hda-codec - Print all AMP IN values
authorTakashi Iwai <tiwai@suse.de>
Fri, 10 Jun 2005 17:45:09 +0000 (19:45 +0200)
committerJaroslav Kysela <perex@suse.cz>
Wed, 22 Jun 2005 10:28:36 +0000 (12:28 +0200)
HDA generic driver
Print all AMP IN values when multiple nodes are connected.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_proc.c

index 15df7162f17e16b1993280cc897a4c5266e06ffc..de1217bd8e68288733f59fcdab0f4ea6441c33e2 100644 (file)
@@ -68,21 +68,27 @@ static void print_amp_caps(snd_info_buffer_t *buffer,
 
 static void print_amp_vals(snd_info_buffer_t *buffer,
                           struct hda_codec *codec, hda_nid_t nid,
-                          int dir, int stereo)
+                          int dir, int stereo, int indices)
 {
        unsigned int val;
-       if (stereo) {
+       int i;
+
+       if (dir == HDA_OUTPUT)
+               dir = AC_AMP_GET_OUTPUT;
+       else
+               dir = AC_AMP_GET_INPUT;
+       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,
+                                                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,
-                                         AC_AMP_GET_LEFT |
-                                        (dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT :
-                                         AC_AMP_GET_INPUT));
-               snd_iprintf(buffer, "0x%02x ", val);
+                                        AC_AMP_GET_RIGHT | dir | i);
+               snd_iprintf(buffer, "0x%02x]", val);
        }
-       val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_AMP_GAIN_MUTE,
-                                AC_AMP_GET_RIGHT |
-                                (dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT :
-                                 AC_AMP_GET_INPUT));
-       snd_iprintf(buffer, "0x%02x\n", val);
+       snd_iprintf(buffer, "\n");
 }
 
 static void print_pcm_caps(snd_info_buffer_t *buffer,
@@ -217,6 +223,9 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
                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];
+
                snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid,
                            get_wid_type_name(wid_type), wid_caps);
                if (wid_caps & AC_WCAP_STEREO)
@@ -231,19 +240,23 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
                        snd_iprintf(buffer, " Amp-Out");
                snd_iprintf(buffer, "\n");
 
+               if (wid_caps & AC_WCAP_CONN_LIST)
+                       conn_len = snd_hda_get_connections(codec, nid, conn,
+                                                          HDA_MAX_CONNECTIONS);
+
                if (wid_caps & AC_WCAP_IN_AMP) {
                        snd_iprintf(buffer, "  Amp-In caps: ");
                        print_amp_caps(buffer, codec, nid, HDA_INPUT);
                        snd_iprintf(buffer, "  Amp-In vals: ");
                        print_amp_vals(buffer, codec, nid, HDA_INPUT,
-                                      wid_caps & AC_WCAP_STEREO);
+                                      wid_caps & AC_WCAP_STEREO, conn_len);
                }
                if (wid_caps & AC_WCAP_OUT_AMP) {
                        snd_iprintf(buffer, "  Amp-Out caps: ");
                        print_amp_caps(buffer, codec, nid, HDA_OUTPUT);
                        snd_iprintf(buffer, "  Amp-Out vals: ");
                        print_amp_vals(buffer, codec, nid, HDA_OUTPUT,
-                                      wid_caps & AC_WCAP_STEREO);
+                                      wid_caps & AC_WCAP_STEREO, 1);
                }
 
                if (wid_type == AC_WID_PIN) {
@@ -267,10 +280,7 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
                }
 
                if (wid_caps & AC_WCAP_CONN_LIST) {
-                       hda_nid_t conn[HDA_MAX_CONNECTIONS];
-                       int c, conn_len, curr = -1;
-                       conn_len = snd_hda_get_connections(codec, nid, conn,
-                                                          HDA_MAX_CONNECTIONS);
+                       int c, curr = -1;
                        if (conn_len > 1 && wid_type != AC_WID_AUD_MIX)
                                curr = snd_hda_codec_read(codec, nid, 0,
                                        AC_VERB_GET_CONNECT_SEL, 0);