2 * Driver for PowerMac AWACS
3 * Copyright (c) 2001 by Takashi Iwai <tiwai@suse.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <sound/driver.h>
22 #include <linux/init.h>
23 #include <linux/moduleparam.h>
24 #include <sound/core.h>
25 #include <sound/initval.h>
30 #define CHIP_NAME "PMac"
32 MODULE_DESCRIPTION("PowerMac");
33 MODULE_SUPPORTED_DEVICE("{{Apple,PowerMac}}");
34 MODULE_LICENSE("GPL");
36 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
37 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
38 static int enable_beep = 1;
40 module_param(index, int, 0444);
41 MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip.");
42 module_param(id, charp, 0444);
43 MODULE_PARM_DESC(id, "ID string for " CHIP_NAME " soundchip.");
44 module_param(enable_beep, bool, 0444);
45 MODULE_PARM_DESC(enable_beep, "Enable beep using PCM.");
52 static snd_card_t *snd_pmac_card = NULL;
57 static int __init snd_pmac_probe(void)
64 card = snd_card_new(index, id, THIS_MODULE, 0);
68 if ((err = snd_pmac_new(card, &chip)) < 0)
71 switch (chip->model) {
73 strcpy(card->driver, "PMac Burgundy");
74 strcpy(card->shortname, "PowerMac Burgundy");
75 sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
76 card->shortname, chip->device_id, chip->subframe);
77 if ((err = snd_pmac_burgundy_init(chip)) < 0)
81 strcpy(card->driver, "PMac DACA");
82 strcpy(card->shortname, "PowerMac DACA");
83 sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
84 card->shortname, chip->device_id, chip->subframe);
85 if ((err = snd_pmac_daca_init(chip)) < 0)
90 name_ext = chip->model == PMAC_TUMBLER ? "Tumbler" : "Snapper";
91 sprintf(card->driver, "PMac %s", name_ext);
92 sprintf(card->shortname, "PowerMac %s", name_ext);
93 sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
94 card->shortname, chip->device_id, chip->subframe);
95 if ( snd_pmac_tumbler_init(chip) < 0 || snd_pmac_tumbler_post_init() < 0)
99 strcpy(card->driver, "PMac Toonie");
100 strcpy(card->shortname, "PowerMac Toonie");
101 strcpy(card->longname, card->shortname);
102 if ((err = snd_pmac_toonie_init(chip)) < 0)
107 name_ext = chip->model == PMAC_SCREAMER ? "Screamer" : "AWACS";
108 sprintf(card->driver, "PMac %s", name_ext);
109 sprintf(card->shortname, "PowerMac %s", name_ext);
110 if (chip->is_pbook_3400)
111 name_ext = " [PB3400]";
112 else if (chip->is_pbook_G3)
113 name_ext = " [PBG3]";
116 sprintf(card->longname, "%s%s Rev %d",
117 card->shortname, name_ext, chip->revision);
118 if ((err = snd_pmac_awacs_init(chip)) < 0)
122 snd_printk("unsupported hardware %d\n", chip->model);
127 if ((err = snd_pmac_pcm_new(chip)) < 0)
130 chip->initialized = 1;
132 snd_pmac_attach_beep(chip);
134 if ((err = snd_card_set_generic_dev(card)) < 0)
137 if ((err = snd_card_register(card)) < 0)
140 snd_pmac_card = card;
153 static int __init alsa_card_pmac_init(void)
156 if ((err = snd_pmac_probe()) < 0)
162 static void __exit alsa_card_pmac_exit(void)
165 snd_card_free(snd_pmac_card);
168 module_init(alsa_card_pmac_init)
169 module_exit(alsa_card_pmac_exit)