• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/sound/drivers/opl3/

Lines Matching refs:opl3

26 #include <sound/opl3.h>
40 static void snd_opl2_command(struct snd_opl3 * opl3, unsigned short cmd, unsigned char val)
50 port = (cmd & OPL3_RIGHT) ? opl3->r_port : opl3->l_port;
52 spin_lock_irqsave(&opl3->reg_lock, flags);
60 spin_unlock_irqrestore(&opl3->reg_lock, flags);
63 static void snd_opl3_command(struct snd_opl3 * opl3, unsigned short cmd, unsigned char val)
73 port = (cmd & OPL3_RIGHT) ? opl3->r_port : opl3->l_port;
75 spin_lock_irqsave(&opl3->reg_lock, flags);
78 inb(opl3->l_port);
79 inb(opl3->l_port);
82 inb(opl3->l_port);
83 inb(opl3->l_port);
85 spin_unlock_irqrestore(&opl3->reg_lock, flags);
88 static int snd_opl3_detect(struct snd_opl3 * opl3)
104 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, OPL3_TIMER1_MASK | OPL3_TIMER2_MASK);
106 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, OPL3_IRQ_RESET);
107 signature = stat1 = inb(opl3->l_port); /* Status register */
113 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER1, 0xff);
115 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, OPL3_TIMER2_MASK | OPL3_TIMER1_START);
119 stat2 = inb(opl3->l_port);
121 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, OPL3_TIMER1_MASK | OPL3_TIMER2_MASK);
123 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, OPL3_IRQ_RESET);
131 if (opl3->hardware != OPL3_HW_AUTO)
136 opl3->hardware = OPL3_HW_OPL2;
139 * If we had an OPL4 chip, opl3->hardware would have been set
142 snd_assert(opl3->r_port != 0, return -ENODEV);
143 opl3->hardware = OPL3_HW_OPL3;
161 struct snd_opl3 *opl3;
163 opl3 = snd_timer_chip(timer);
164 spin_lock_irqsave(&opl3->timer_lock, flags);
166 tmp = (opl3->timer_enable | OPL3_TIMER1_START) & ~OPL3_TIMER1_MASK;
167 opl3->timer_enable = tmp;
168 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER1, 256 - ticks); /* timer 1 count */
169 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, tmp); /* enable timer 1 IRQ */
170 spin_unlock_irqrestore(&opl3->timer_lock, flags);
178 struct snd_opl3 *opl3;
180 opl3 = snd_timer_chip(timer);
181 spin_lock_irqsave(&opl3->timer_lock, flags);
182 tmp = (opl3->timer_enable | OPL3_TIMER1_MASK) & ~OPL3_TIMER1_START;
183 opl3->timer_enable = tmp;
184 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, tmp); /* disable timer #1 */
185 spin_unlock_irqrestore(&opl3->timer_lock, flags);
198 struct snd_opl3 *opl3;
200 opl3 = snd_timer_chip(timer);
201 spin_lock_irqsave(&opl3->timer_lock, flags);
203 tmp = (opl3->timer_enable | OPL3_TIMER2_START) & ~OPL3_TIMER2_MASK;
204 opl3->timer_enable = tmp;
205 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER2, 256 - ticks); /* timer 1 count */
206 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, tmp); /* enable timer 1 IRQ */
207 spin_unlock_irqrestore(&opl3->timer_lock, flags);
215 struct snd_opl3 *opl3;
217 opl3 = snd_timer_chip(timer);
218 spin_lock_irqsave(&opl3->timer_lock, flags);
219 tmp = (opl3->timer_enable | OPL3_TIMER2_MASK) & ~OPL3_TIMER2_START;
220 opl3->timer_enable = tmp;
221 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TIMER_CONTROL, tmp); /* disable timer #1 */
222 spin_unlock_irqrestore(&opl3->timer_lock, flags);
248 static int snd_opl3_timer1_init(struct snd_opl3 * opl3, int timer_no)
256 tid.card = opl3->card->number;
259 if ((err = snd_timer_new(opl3->card, "AdLib timer #1", &tid, &timer)) >= 0) {
261 timer->private_data = opl3;
264 opl3->timer1 = timer;
268 static int snd_opl3_timer2_init(struct snd_opl3 * opl3, int timer_no)
276 tid.card = opl3->card->number;
279 if ((err = snd_timer_new(opl3->card, "AdLib timer #2", &tid, &timer)) >= 0) {
281 timer->private_data = opl3;
284 opl3->timer2 = timer;
295 struct snd_opl3 *opl3;
301 opl3 = hw->private_data;
302 status = inb(opl3->l_port);
307 timer = opl3->timer1;
311 timer = opl3->timer2;
322 static int snd_opl3_free(struct snd_opl3 *opl3)
324 snd_assert(opl3 != NULL, return -ENXIO);
325 if (opl3->private_free)
326 opl3->private_free(opl3);
327 release_and_free_resource(opl3->res_l_port);
328 release_and_free_resource(opl3->res_r_port);
329 kfree(opl3);
335 struct snd_opl3 *opl3 = device->device_data;
336 return snd_opl3_free(opl3);
346 struct snd_opl3 *opl3;
350 opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL);
351 if (opl3 == NULL) {
352 snd_printk(KERN_ERR "opl3: cannot allocate\n");
356 opl3->card = card;
357 opl3->hardware = hardware;
358 spin_lock_init(&opl3->reg_lock);
359 spin_lock_init(&opl3->timer_lock);
360 mutex_init(&opl3->access_mutex);
362 if ((err = snd_device_new(card, SNDRV_DEV_CODEC, opl3, &ops)) < 0) {
363 snd_opl3_free(opl3);
367 *ropl3 = opl3;
373 int snd_opl3_init(struct snd_opl3 *opl3)
375 if (! opl3->command) {
380 opl3->command(opl3, OPL3_LEFT | OPL3_REG_TEST, OPL3_ENABLE_WAVE_SELECT);
382 opl3->command(opl3, OPL3_LEFT | OPL3_REG_PERCUSSION, 0x00);
384 switch (opl3->hardware & OPL3_HW_MASK) {
386 opl3->max_voices = MAX_OPL2_VOICES;
390 opl3->max_voices = MAX_OPL3_VOICES;
392 opl3->command(opl3, OPL3_RIGHT | OPL3_REG_MODE, OPL3_OPL3_ENABLE);
406 struct snd_opl3 *opl3;
410 if ((err = snd_opl3_new(card, hardware, &opl3)) < 0)
413 if ((opl3->res_l_port = request_region(l_port, 2, "OPL2/3 (left)")) == NULL) {
414 snd_printk(KERN_ERR "opl3: can't grab left port 0x%lx\n", l_port);
415 snd_device_free(card, opl3);
419 (opl3->res_r_port = request_region(r_port, 2, "OPL2/3 (right)")) == NULL) {
420 snd_printk(KERN_ERR "opl3: can't grab right port 0x%lx\n", r_port);
421 snd_device_free(card, opl3);
425 opl3->l_port = l_port;
426 opl3->r_port = r_port;
428 switch (opl3->hardware) {
433 opl3->command = &snd_opl3_command;
436 opl3->command = &snd_opl2_command;
437 if ((err = snd_opl3_detect(opl3)) < 0) {
439 opl3->l_port, opl3->r_port);
440 snd_device_free(card, opl3);
444 switch (opl3->hardware & OPL3_HW_MASK) {
447 opl3->command = &snd_opl3_command;
451 snd_opl3_init(opl3);
453 *ropl3 = opl3;
459 int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev)
464 if ((err = snd_opl3_timer1_init(opl3, timer1_dev)) < 0)
467 if ((err = snd_opl3_timer2_init(opl3, timer2_dev)) < 0) {
468 snd_device_free(opl3->card, opl3->timer1);
469 opl3->timer1 = NULL;
478 int snd_opl3_hwdep_new(struct snd_opl3 * opl3,
483 struct snd_card *card = opl3->card;
492 snd_device_free(card, opl3);
495 hw->private_data = opl3;
503 switch (opl3->hardware & OPL3_HW_MASK) {
523 opl3->seq_dev_num = seq_device;
527 sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) {
528 strcpy(opl3->seq_dev->name, hw->name);
529 *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(opl3->seq_dev) = opl3;