]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
ALSA: hda - proc - show which I/O NID is associated to PCM device
authorJaroslav Kysela <perex@perex.cz>
Tue, 10 Nov 2009 13:53:02 +0000 (14:53 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 10 Nov 2009 15:06:57 +0000 (16:06 +0100)
Output something like:

Node 0x02 [Audio Output] wcaps 0x11: Stereo
  Device: name="ALC888 Analog", type="Audio", device=0, substream=0
  Converter: stream=0, channel=0
  ...

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_proc.c

index 146f95be8737e73d1923bee5af2bcda57d08bbc7..480d1ec49c9918b0972c37a49cf03cdcbd639f0b 100644 (file)
@@ -2877,14 +2877,15 @@ static int set_pcm_default_values(struct hda_codec *codec,
        return 0;
 }
 
+const char *snd_hda_pcm_type_name[HDA_PCM_NTYPES] = {
+       "Audio", "SPDIF", "HDMI", "Modem"
+};
+
 /*
  * get the empty PCM device number to assign
  */
 static int get_empty_pcm_device(struct hda_bus *bus, int type)
 {
-       static const char *dev_name[HDA_PCM_NTYPES] = {
-               "Audio", "SPDIF", "HDMI", "Modem"
-       };
        /* audio device indices; not linear to keep compatibility */
        static int audio_idx[HDA_PCM_NTYPES][5] = {
                [HDA_PCM_TYPE_AUDIO] = { 0, 2, 4, 5, -1 },
@@ -2903,7 +2904,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type)
                if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits))
                        return audio_idx[type][i];
 
-       snd_printk(KERN_WARNING "Too many %s devices\n", dev_name[type]);
+       snd_printk(KERN_WARNING "Too many %s devices\n", snd_hda_pcm_type_name[type]);
        return -EAGAIN;
 }
 
index 624060837653a5e919260f3f94a34494326cc21a..cbf199a98ab2738faeabf9553d86ecaa912f900d 100644 (file)
@@ -894,6 +894,7 @@ int snd_hda_codec_build_controls(struct hda_codec *codec);
 /*
  * PCM
  */
+extern const char *snd_hda_pcm_type_name[];
 int snd_hda_build_pcms(struct hda_bus *bus);
 int snd_hda_codec_build_pcms(struct hda_codec *codec);
 void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
index 95f24e4729f83c5eede0328f26bef18f2021a68c..f5639c2988abd0356d50a1e96aef8662e86eb3f0 100644 (file)
@@ -309,7 +309,21 @@ static void print_audio_io(struct snd_info_buffer *buffer,
                           struct hda_codec *codec, hda_nid_t nid,
                           unsigned int wid_type)
 {
-       int conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
+       int pcm, conv;
+       for (pcm = 0; pcm < codec->num_pcms; pcm++) {
+               int type;
+               struct hda_pcm *cpcm = &codec->pcm_info[pcm];
+               for (type = 0; type < 2; type++) {
+                       if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL)
+                               continue;
+                       snd_iprintf(buffer, "  Device: name=\"%s\", type=\"%s\", device=%i, substream=%i\n",
+                               cpcm->name,
+                               snd_hda_pcm_type_name[cpcm->pcm_type],
+                               cpcm->pcm->device,
+                               cpcm->pcm->streams[type].substream->number);
+               }
+       }
+       conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
        snd_iprintf(buffer,
                    "  Converter: stream=%d, channel=%d\n",
                    (conv & AC_CONV_STREAM) >> AC_CONV_STREAM_SHIFT,