pcsp.c (a91605b86a234b01d2f99b38411ac30a40bdf067) pcsp.c (52337310af443278ee84ec4b9adaee0037cc0e30)
1/*
2 * PC-Speaker driver for Linux
3 *
4 * Copyright (C) 1997-2001 David Woodhouse
5 * Copyright (C) 2001-2008 Stas Sergeev
6 */
7
8#include <linux/init.h>

--- 17 unchanged lines hidden (view full) ---

26static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
27static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */
28
29module_param(index, int, 0444);
30MODULE_PARM_DESC(index, "Index value for pcsp soundcard.");
31module_param(id, charp, 0444);
32MODULE_PARM_DESC(id, "ID string for pcsp soundcard.");
33module_param(enable, bool, 0444);
1/*
2 * PC-Speaker driver for Linux
3 *
4 * Copyright (C) 1997-2001 David Woodhouse
5 * Copyright (C) 2001-2008 Stas Sergeev
6 */
7
8#include <linux/init.h>

--- 17 unchanged lines hidden (view full) ---

26static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
27static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */
28
29module_param(index, int, 0444);
30MODULE_PARM_DESC(index, "Index value for pcsp soundcard.");
31module_param(id, charp, 0444);
32MODULE_PARM_DESC(id, "ID string for pcsp soundcard.");
33module_param(enable, bool, 0444);
34MODULE_PARM_DESC(enable, "dummy");
34MODULE_PARM_DESC(enable, "Enable PC-Speaker sound.");
35
36struct snd_pcsp pcsp_chip;
37
38static int __devinit snd_pcsp_create(struct snd_card *card)
39{
40 static struct snd_device_ops ops = { };
41 struct timespec tp;
42 int err;

--- 88 unchanged lines hidden (view full) ---

131 return err;
132 }
133
134 return 0;
135}
136
137static int __devinit alsa_card_pcsp_init(struct device *dev)
138{
35
36struct snd_pcsp pcsp_chip;
37
38static int __devinit snd_pcsp_create(struct snd_card *card)
39{
40 static struct snd_device_ops ops = { };
41 struct timespec tp;
42 int err;

--- 88 unchanged lines hidden (view full) ---

131 return err;
132 }
133
134 return 0;
135}
136
137static int __devinit alsa_card_pcsp_init(struct device *dev)
138{
139 int devnum = 0, cards = 0;
139 int err;
140
140
141 err = snd_card_pcsp_probe(0, dev);
142 if (err) {
143 printk(KERN_ERR "PC-Speaker initialization failed.\n");
144 return err;
145 }
146
141#ifdef CONFIG_DEBUG_PAGEALLOC
142 /* Well, CONFIG_DEBUG_PAGEALLOC makes the sound horrible. Lets alert */
143 printk(KERN_WARNING
144 "PCSP: Warning, CONFIG_DEBUG_PAGEALLOC is enabled!\n"
145 "You have to disable it if you want to use the PC-Speaker "
146 "driver.\n"
147 "Unless it is disabled, enjoy the horrible, distorted "
148 "and crackling noise.\n");
149#endif
150
147#ifdef CONFIG_DEBUG_PAGEALLOC
148 /* Well, CONFIG_DEBUG_PAGEALLOC makes the sound horrible. Lets alert */
149 printk(KERN_WARNING
150 "PCSP: Warning, CONFIG_DEBUG_PAGEALLOC is enabled!\n"
151 "You have to disable it if you want to use the PC-Speaker "
152 "driver.\n"
153 "Unless it is disabled, enjoy the horrible, distorted "
154 "and crackling noise.\n");
155#endif
156
151 if (enable) {
152 if (snd_card_pcsp_probe(devnum, dev) >= 0)
153 cards++;
154 if (!cards) {
155 printk(KERN_ERR "PC-Speaker initialization failed.\n");
156 return -ENODEV;
157 }
158 }
159
160 return 0;
161}
162
163static void __devexit alsa_card_pcsp_exit(struct snd_pcsp *chip)
164{
165 snd_card_free(chip->card);
166}
167
168static int __devinit pcsp_probe(struct platform_device *dev)
169{
170 int err;
157 return 0;
158}
159
160static void __devexit alsa_card_pcsp_exit(struct snd_pcsp *chip)
161{
162 snd_card_free(chip->card);
163}
164
165static int __devinit pcsp_probe(struct platform_device *dev)
166{
167 int err;
168
171 err = pcspkr_input_init(&pcsp_chip.input_dev, &dev->dev);
172 if (err < 0)
173 return err;
174
175 err = alsa_card_pcsp_init(&dev->dev);
176 if (err < 0) {
177 pcspkr_input_remove(pcsp_chip.input_dev);
178 return err;

--- 43 unchanged lines hidden (view full) ---

222 .probe = pcsp_probe,
223 .remove = __devexit_p(pcsp_remove),
224 .suspend = pcsp_suspend,
225 .shutdown = pcsp_shutdown,
226};
227
228static int __init pcsp_init(void)
229{
169 err = pcspkr_input_init(&pcsp_chip.input_dev, &dev->dev);
170 if (err < 0)
171 return err;
172
173 err = alsa_card_pcsp_init(&dev->dev);
174 if (err < 0) {
175 pcspkr_input_remove(pcsp_chip.input_dev);
176 return err;

--- 43 unchanged lines hidden (view full) ---

220 .probe = pcsp_probe,
221 .remove = __devexit_p(pcsp_remove),
222 .suspend = pcsp_suspend,
223 .shutdown = pcsp_shutdown,
224};
225
226static int __init pcsp_init(void)
227{
228 if (!enable)
229 return -ENODEV;
230 return platform_driver_register(&pcsp_platform_driver);
231}
232
233static void __exit pcsp_exit(void)
234{
235 platform_driver_unregister(&pcsp_platform_driver);
236}
237
238module_init(pcsp_init);
239module_exit(pcsp_exit);
230 return platform_driver_register(&pcsp_platform_driver);
231}
232
233static void __exit pcsp_exit(void)
234{
235 platform_driver_unregister(&pcsp_platform_driver);
236}
237
238module_init(pcsp_init);
239module_exit(pcsp_exit);