]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[ALSA] hda-codec - Assign audio PCMS first
authorTakashi Iwai <tiwai@suse.de>
Wed, 7 Sep 2005 11:29:22 +0000 (13:29 +0200)
committerJaroslav Kysela <perex@suse.cz>
Mon, 12 Sep 2005 08:42:17 +0000 (10:42 +0200)
HDA Codec driver,HDA Intel driver,HDA generic driver
Assign audio PCMs first before modem PCMs.
The modem stream is assigned up to device #6, to be consistent over
different models.

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

index 63a29a8a2860e34e092f852f92e86b81511abc65..bb53bcf76742ed1ccc77078e2efb4c2cdc275a40 100644 (file)
@@ -505,6 +505,7 @@ struct hda_pcm_stream {
 struct hda_pcm {
        char *name;
        struct hda_pcm_stream stream[2];
+       unsigned int is_modem;  /* modem codec? */
 };
 
 /* codec information */
index 96f9e8729192ad74aa2bf548ea46ac6519c83e73..2098de7c567913bdd6fabee78eb23945fe66c137 100644 (file)
@@ -164,7 +164,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 /* max buffer size - no h/w limit, you can increase as you like */
 #define AZX_MAX_BUF_SIZE       (1024*1024*1024)
 /* max number of PCM devics per card */
-#define AZX_MAX_PCMS           8
+#define AZX_MAX_AUDIO_PCMS     6
+#define AZX_MAX_MODEM_PCMS     2
+#define AZX_MAX_PCMS           (AZX_MAX_AUDIO_PCMS + AZX_MAX_MODEM_PCMS)
 
 /* RIRB int mask: overrun[2], response[0] */
 #define RIRB_INT_RESPONSE      0x01
@@ -1225,12 +1227,33 @@ static int __devinit azx_pcm_create(azx_t *chip)
        if ((err = snd_hda_build_pcms(chip->bus)) < 0)
                return err;
 
+       /* create audio PCMs */
        pcm_dev = 0;
        list_for_each(p, &chip->bus->codec_list) {
                codec = list_entry(p, struct hda_codec, list);
                for (c = 0; c < codec->num_pcms; c++) {
-                       if (pcm_dev >= AZX_MAX_PCMS) {
-                               snd_printk(KERN_ERR SFX "Too many PCMs\n");
+                       if (codec->pcm_info[c].is_modem)
+                               continue; /* create later */
+                       if (pcm_dev >= AZX_MAX_AUDIO_PCMS) {
+                               snd_printk(KERN_ERR SFX "Too many audio PCMs\n");
+                               return -EINVAL;
+                       }
+                       err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev);
+                       if (err < 0)
+                               return err;
+                       pcm_dev++;
+               }
+       }
+
+       /* create modem PCMs */
+       pcm_dev = AZX_MAX_AUDIO_PCMS;
+       list_for_each(p, &chip->bus->codec_list) {
+               codec = list_entry(p, struct hda_codec, list);
+               for (c = 0; c < codec->num_pcms; c++) {
+                       if (! codec->pcm_info[c].is_modem)
+                               continue; /* already created */
+                       if (pcm_dev >= AZX_MAX_MODEM_PCMS) {
+                               snd_printk(KERN_ERR SFX "Too many modem PCMs\n");
                                return -EINVAL;
                        }
                        err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev);
index de1217bd8e68288733f59fcdab0f4ea6441c33e2..08f6a6efc5e6b75212c2a9c62a2c6a9e735c742d 100644 (file)
@@ -207,6 +207,8 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
        snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id);
        snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id);
        snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);
+       if (! codec->afg)
+               return;
        snd_iprintf(buffer, "Default PCM: ");
        print_pcm_caps(buffer, codec, codec->afg);
        snd_iprintf(buffer, "Default Amp-In caps: ");
index b0270d1b64cea38957c04eea9cdd862889a57990..c41fb9acdce49389c52fe1f16f8837aee32d7410 100644 (file)
@@ -214,6 +214,7 @@ static int si3054_build_pcms(struct hda_codec *codec)
        info->name = "Si3054 Modem";
        info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm;
        info->stream[SNDRV_PCM_STREAM_CAPTURE]  = si3054_pcm;
+       info->is_modem = 1;
        return 0;
 }