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_CLASSES("{sound}");
34 MODULE_DEVICES("{{Apple,PowerMac}}");
35 MODULE_LICENSE("GPL");
37 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
38 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
39 /* static int enable = 1; */
40 #ifdef PMAC_SUPPORT_PCM_BEEP
41 static int enable_beep = 1;
44 module_param(index, int, 0444);
45 MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip.");
46 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
47 module_param(id, charp, 0444);
48 MODULE_PARM_DESC(id, "ID string for " CHIP_NAME " soundchip.");
49 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
50 /* module_param(enable, bool, 0444);
51 MODULE_PARM_DESC(enable, "Enable this soundchip.");
52 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC); */
53 #ifdef PMAC_SUPPORT_PCM_BEEP
54 module_param(enable_beep, bool, 0444);
55 MODULE_PARM_DESC(enable_beep, "Enable beep using PCM.");
56 MODULE_PARM_SYNTAX(enable_beep, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
64 static snd_card_t *snd_pmac_card = NULL;
69 static int __init snd_pmac_probe(void)
76 card = snd_card_new(index, id, THIS_MODULE, 0);
80 if ((err = snd_pmac_new(card, &chip)) < 0)
83 switch (chip->model) {
85 strcpy(card->driver, "PMac Burgundy");
86 strcpy(card->shortname, "PowerMac Burgundy");
87 sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
88 card->shortname, chip->device_id, chip->subframe);
89 if ((err = snd_pmac_burgundy_init(chip)) < 0)
93 strcpy(card->driver, "PMac DACA");
94 strcpy(card->shortname, "PowerMac DACA");
95 sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
96 card->shortname, chip->device_id, chip->subframe);
97 if ((err = snd_pmac_daca_init(chip)) < 0)
102 name_ext = chip->model == PMAC_TUMBLER ? "Tumbler" : "Snapper";
103 sprintf(card->driver, "PMac %s", name_ext);
104 sprintf(card->shortname, "PowerMac %s", name_ext);
105 sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
106 card->shortname, chip->device_id, chip->subframe);
107 if ( snd_pmac_tumbler_init(chip) < 0 || snd_pmac_tumbler_post_init() < 0)
112 name_ext = chip->model == PMAC_SCREAMER ? "Screamer" : "AWACS";
113 sprintf(card->driver, "PMac %s", name_ext);
114 sprintf(card->shortname, "PowerMac %s", name_ext);
115 if (chip->is_pbook_3400)
116 name_ext = " [PB3400]";
117 else if (chip->is_pbook_G3)
118 name_ext = " [PBG3]";
121 sprintf(card->longname, "%s%s Rev %d",
122 card->shortname, name_ext, chip->revision);
123 if ((err = snd_pmac_awacs_init(chip)) < 0)
127 snd_printk("unsupported hardware %d\n", chip->model);
132 if ((err = snd_pmac_pcm_new(chip)) < 0)
135 chip->initialized = 1;
136 #ifdef PMAC_SUPPORT_PCM_BEEP
138 snd_pmac_attach_beep(chip);
141 if ((err = snd_card_register(card)) < 0)
144 snd_pmac_card = card;
157 static int __init alsa_card_pmac_init(void)
160 if ((err = snd_pmac_probe()) < 0) {
162 printk(KERN_ERR "no PMac soundchip found\n");
170 static void __exit alsa_card_pmac_exit(void)
173 snd_card_free(snd_pmac_card);
176 module_init(alsa_card_pmac_init)
177 module_exit(alsa_card_pmac_exit)