1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ALSA soundcard driver for Miro miroSOUND PCM1 pro
5 * miroSOUND PCM20 Radio
7 * Copyright (C) 2004-2005 Martin Langer <martin-langer@gmx.de>
9 * Based on OSS ACI and ALSA OPTi9xx drivers
12 #include <linux/init.h>
13 #include <linux/err.h>
14 #include <linux/isa.h>
15 #include <linux/pnp.h>
16 #include <linux/delay.h>
17 #include <linux/ioport.h>
18 #include <linux/module.h>
21 #include <sound/core.h>
22 #include <sound/wss.h>
23 #include <sound/mpu401.h>
24 #include <sound/opl4.h>
25 #include <sound/control.h>
26 #include <sound/info.h>
27 #define SNDRV_LEGACY_FIND_FREE_IOPORT
28 #define SNDRV_LEGACY_FIND_FREE_IRQ
29 #define SNDRV_LEGACY_FIND_FREE_DMA
30 #include <sound/initval.h>
31 #include <sound/aci.h>
33 MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>");
34 MODULE_LICENSE("GPL");
35 MODULE_DESCRIPTION("Miro miroSOUND PCM1 pro, PCM12, PCM20 Radio");
37 static int index
= SNDRV_DEFAULT_IDX1
; /* Index 0-MAX */
38 static char *id
= SNDRV_DEFAULT_STR1
; /* ID for this card */
39 static long port
= SNDRV_DEFAULT_PORT1
; /* 0x530,0xe80,0xf40,0x604 */
40 static long mpu_port
= SNDRV_DEFAULT_PORT1
; /* 0x300,0x310,0x320,0x330 */
41 static long fm_port
= SNDRV_DEFAULT_PORT1
; /* 0x388 */
42 static int irq
= SNDRV_DEFAULT_IRQ1
; /* 5,7,9,10,11 */
43 static int mpu_irq
= SNDRV_DEFAULT_IRQ1
; /* 5,7,9,10 */
44 static int dma1
= SNDRV_DEFAULT_DMA1
; /* 0,1,3 */
45 static int dma2
= SNDRV_DEFAULT_DMA1
; /* 0,1,3 */
49 static bool isapnp
= 1; /* Enable ISA PnP detection */
52 module_param(index
, int, 0444);
53 MODULE_PARM_DESC(index
, "Index value for miro soundcard.");
54 module_param(id
, charp
, 0444);
55 MODULE_PARM_DESC(id
, "ID string for miro soundcard.");
56 module_param_hw(port
, long, ioport
, 0444);
57 MODULE_PARM_DESC(port
, "WSS port # for miro driver.");
58 module_param_hw(mpu_port
, long, ioport
, 0444);
59 MODULE_PARM_DESC(mpu_port
, "MPU-401 port # for miro driver.");
60 module_param_hw(fm_port
, long, ioport
, 0444);
61 MODULE_PARM_DESC(fm_port
, "FM Port # for miro driver.");
62 module_param_hw(irq
, int, irq
, 0444);
63 MODULE_PARM_DESC(irq
, "WSS irq # for miro driver.");
64 module_param_hw(mpu_irq
, int, irq
, 0444);
65 MODULE_PARM_DESC(mpu_irq
, "MPU-401 irq # for miro driver.");
66 module_param_hw(dma1
, int, dma
, 0444);
67 MODULE_PARM_DESC(dma1
, "1st dma # for miro driver.");
68 module_param_hw(dma2
, int, dma
, 0444);
69 MODULE_PARM_DESC(dma2
, "2nd dma # for miro driver.");
70 module_param(wss
, int, 0444);
71 MODULE_PARM_DESC(wss
, "wss mode");
72 module_param(ide
, int, 0444);
73 MODULE_PARM_DESC(ide
, "enable ide port");
75 module_param(isapnp
, bool, 0444);
76 MODULE_PARM_DESC(isapnp
, "Enable ISA PnP detection for specified soundcard.");
79 #define OPTi9XX_HW_DETECT 0
80 #define OPTi9XX_HW_82C928 1
81 #define OPTi9XX_HW_82C929 2
82 #define OPTi9XX_HW_82C924 3
83 #define OPTi9XX_HW_82C925 4
84 #define OPTi9XX_HW_82C930 5
85 #define OPTi9XX_HW_82C931 6
86 #define OPTi9XX_HW_82C933 7
87 #define OPTi9XX_HW_LAST OPTi9XX_HW_82C933
89 #define OPTi9XX_MC_REG(n) n
92 unsigned short hardware
;
93 unsigned char password
;
96 struct resource
*res_mc_base
;
97 struct resource
*res_aci_port
;
99 unsigned long mc_base
;
100 unsigned long mc_base_size
;
101 unsigned long pwd_reg
;
114 struct snd_miro_aci
*aci
;
117 static struct snd_miro_aci aci_device
;
119 static const char * const snd_opti9xx_names
[] = {
123 "82C930", "82C931", "82C933"
126 static int snd_miro_pnp_is_probed
;
130 static const struct pnp_card_device_id snd_miro_pnpids
[] = {
131 /* PCM20 and PCM12 in PnP mode */
133 .devs
= { { "MIR0000" }, { "MIR0002" }, { "MIR0005" } }, },
137 MODULE_DEVICE_TABLE(pnp_card
, snd_miro_pnpids
);
139 #endif /* CONFIG_PNP */
145 static int aci_busy_wait(struct snd_miro_aci
*aci
)
150 for (timeout
= 1; timeout
<= ACI_MINTIME
+ 30; timeout
++) {
151 byte
= inb(aci
->aci_port
+ ACI_REG_BUSY
);
152 if ((byte
& 1) == 0) {
153 if (timeout
>= ACI_MINTIME
)
154 snd_printd("aci ready in round %ld.\n",
155 timeout
-ACI_MINTIME
);
158 if (timeout
>= ACI_MINTIME
) {
160 switch (timeout
-ACI_MINTIME
) {
171 set_current_state(TASK_UNINTERRUPTIBLE
);
172 schedule_timeout(out
);
177 snd_printk(KERN_ERR
"aci_busy_wait() time out\n");
181 static inline int aci_write(struct snd_miro_aci
*aci
, unsigned char byte
)
183 if (aci_busy_wait(aci
) >= 0) {
184 outb(byte
, aci
->aci_port
+ ACI_REG_COMMAND
);
187 snd_printk(KERN_ERR
"aci busy, aci_write(0x%x) stopped.\n", byte
);
192 static inline int aci_read(struct snd_miro_aci
*aci
)
196 if (aci_busy_wait(aci
) >= 0) {
197 byte
= inb(aci
->aci_port
+ ACI_REG_STATUS
);
200 snd_printk(KERN_ERR
"aci busy, aci_read() stopped.\n");
205 int snd_aci_cmd(struct snd_miro_aci
*aci
, int write1
, int write2
, int write3
)
207 int write
[] = {write1
, write2
, write3
};
210 if (mutex_lock_interruptible(&aci
->aci_mutex
))
213 for (i
=0; i
<3; i
++) {
214 if (write
[i
]< 0 || write
[i
] > 255)
217 value
= aci_write(aci
, write
[i
]);
223 value
= aci_read(aci
);
225 out
: mutex_unlock(&aci
->aci_mutex
);
228 EXPORT_SYMBOL(snd_aci_cmd
);
230 static int aci_getvalue(struct snd_miro_aci
*aci
, unsigned char index
)
232 return snd_aci_cmd(aci
, ACI_STATUS
, index
, -1);
235 static int aci_setvalue(struct snd_miro_aci
*aci
, unsigned char index
,
238 return snd_aci_cmd(aci
, index
, value
, -1);
241 struct snd_miro_aci
*snd_aci_get_aci(void)
243 if (aci_device
.aci_port
== 0)
247 EXPORT_SYMBOL(snd_aci_get_aci
);
253 #define snd_miro_info_capture snd_ctl_boolean_mono_info
255 static int snd_miro_get_capture(struct snd_kcontrol
*kcontrol
,
256 struct snd_ctl_elem_value
*ucontrol
)
258 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
261 value
= aci_getvalue(miro
->aci
, ACI_S_GENERAL
);
263 snd_printk(KERN_ERR
"snd_miro_get_capture() failed: %d\n",
268 ucontrol
->value
.integer
.value
[0] = value
& 0x20;
273 static int snd_miro_put_capture(struct snd_kcontrol
*kcontrol
,
274 struct snd_ctl_elem_value
*ucontrol
)
276 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
277 int change
, value
, error
;
279 value
= !(ucontrol
->value
.integer
.value
[0]);
281 error
= aci_setvalue(miro
->aci
, ACI_SET_SOLOMODE
, value
);
283 snd_printk(KERN_ERR
"snd_miro_put_capture() failed: %d\n",
288 change
= (value
!= miro
->aci
->aci_solomode
);
289 miro
->aci
->aci_solomode
= value
;
294 static int snd_miro_info_preamp(struct snd_kcontrol
*kcontrol
,
295 struct snd_ctl_elem_info
*uinfo
)
297 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_INTEGER
;
299 uinfo
->value
.integer
.min
= 0;
300 uinfo
->value
.integer
.max
= 3;
305 static int snd_miro_get_preamp(struct snd_kcontrol
*kcontrol
,
306 struct snd_ctl_elem_value
*ucontrol
)
308 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
311 if (miro
->aci
->aci_version
<= 176) {
314 OSS says it's not readable with versions < 176.
315 But it doesn't work on my card,
316 which is a PCM12 with aci_version = 176.
319 ucontrol
->value
.integer
.value
[0] = miro
->aci
->aci_preamp
;
323 value
= aci_getvalue(miro
->aci
, ACI_GET_PREAMP
);
325 snd_printk(KERN_ERR
"snd_miro_get_preamp() failed: %d\n",
330 ucontrol
->value
.integer
.value
[0] = value
;
335 static int snd_miro_put_preamp(struct snd_kcontrol
*kcontrol
,
336 struct snd_ctl_elem_value
*ucontrol
)
338 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
339 int error
, value
, change
;
341 value
= ucontrol
->value
.integer
.value
[0];
343 error
= aci_setvalue(miro
->aci
, ACI_SET_PREAMP
, value
);
345 snd_printk(KERN_ERR
"snd_miro_put_preamp() failed: %d\n",
350 change
= (value
!= miro
->aci
->aci_preamp
);
351 miro
->aci
->aci_preamp
= value
;
356 #define snd_miro_info_amp snd_ctl_boolean_mono_info
358 static int snd_miro_get_amp(struct snd_kcontrol
*kcontrol
,
359 struct snd_ctl_elem_value
*ucontrol
)
361 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
362 ucontrol
->value
.integer
.value
[0] = miro
->aci
->aci_amp
;
367 static int snd_miro_put_amp(struct snd_kcontrol
*kcontrol
,
368 struct snd_ctl_elem_value
*ucontrol
)
370 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
371 int error
, value
, change
;
373 value
= ucontrol
->value
.integer
.value
[0];
375 error
= aci_setvalue(miro
->aci
, ACI_SET_POWERAMP
, value
);
377 snd_printk(KERN_ERR
"snd_miro_put_amp() to %d failed: %d\n", value
, error
);
381 change
= (value
!= miro
->aci
->aci_amp
);
382 miro
->aci
->aci_amp
= value
;
387 #define MIRO_DOUBLE(ctl_name, ctl_index, get_right_reg, set_right_reg) \
388 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
390 .index = ctl_index, \
391 .info = snd_miro_info_double, \
392 .get = snd_miro_get_double, \
393 .put = snd_miro_put_double, \
394 .private_value = get_right_reg | (set_right_reg << 8) \
397 static int snd_miro_info_double(struct snd_kcontrol
*kcontrol
,
398 struct snd_ctl_elem_info
*uinfo
)
400 int reg
= kcontrol
->private_value
& 0xff;
402 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_INTEGER
;
405 if ((reg
>= ACI_GET_EQ1
) && (reg
<= ACI_GET_EQ7
)) {
407 /* equalizer elements */
409 uinfo
->value
.integer
.min
= - 0x7f;
410 uinfo
->value
.integer
.max
= 0x7f;
413 /* non-equalizer elements */
415 uinfo
->value
.integer
.min
= 0;
416 uinfo
->value
.integer
.max
= 0x20;
422 static int snd_miro_get_double(struct snd_kcontrol
*kcontrol
,
423 struct snd_ctl_elem_value
*uinfo
)
425 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
426 int left_val
, right_val
;
428 int right_reg
= kcontrol
->private_value
& 0xff;
429 int left_reg
= right_reg
+ 1;
431 right_val
= aci_getvalue(miro
->aci
, right_reg
);
433 snd_printk(KERN_ERR
"aci_getvalue(%d) failed: %d\n", right_reg
, right_val
);
437 left_val
= aci_getvalue(miro
->aci
, left_reg
);
439 snd_printk(KERN_ERR
"aci_getvalue(%d) failed: %d\n", left_reg
, left_val
);
443 if ((right_reg
>= ACI_GET_EQ1
) && (right_reg
<= ACI_GET_EQ7
)) {
445 /* equalizer elements */
447 if (left_val
< 0x80) {
448 uinfo
->value
.integer
.value
[0] = left_val
;
450 uinfo
->value
.integer
.value
[0] = 0x80 - left_val
;
453 if (right_val
< 0x80) {
454 uinfo
->value
.integer
.value
[1] = right_val
;
456 uinfo
->value
.integer
.value
[1] = 0x80 - right_val
;
461 /* non-equalizer elements */
463 uinfo
->value
.integer
.value
[0] = 0x20 - left_val
;
464 uinfo
->value
.integer
.value
[1] = 0x20 - right_val
;
470 static int snd_miro_put_double(struct snd_kcontrol
*kcontrol
,
471 struct snd_ctl_elem_value
*ucontrol
)
473 struct snd_miro
*miro
= snd_kcontrol_chip(kcontrol
);
474 struct snd_miro_aci
*aci
= miro
->aci
;
475 int left
, right
, left_old
, right_old
;
476 int setreg_left
, setreg_right
, getreg_left
, getreg_right
;
479 left
= ucontrol
->value
.integer
.value
[0];
480 right
= ucontrol
->value
.integer
.value
[1];
482 setreg_right
= (kcontrol
->private_value
>> 8) & 0xff;
483 setreg_left
= setreg_right
+ 8;
484 if (setreg_right
== ACI_SET_MASTER
)
487 getreg_right
= kcontrol
->private_value
& 0xff;
488 getreg_left
= getreg_right
+ 1;
490 left_old
= aci_getvalue(aci
, getreg_left
);
492 snd_printk(KERN_ERR
"aci_getvalue(%d) failed: %d\n", getreg_left
, left_old
);
496 right_old
= aci_getvalue(aci
, getreg_right
);
498 snd_printk(KERN_ERR
"aci_getvalue(%d) failed: %d\n", getreg_right
, right_old
);
502 if ((getreg_right
>= ACI_GET_EQ1
) && (getreg_right
<= ACI_GET_EQ7
)) {
504 /* equalizer elements */
506 if (left
< -0x7f || left
> 0x7f ||
507 right
< -0x7f || right
> 0x7f)
511 left_old
= 0x80 - left_old
;
512 if (right_old
> 0x80)
513 right_old
= 0x80 - right_old
;
516 error
= aci_setvalue(aci
, setreg_left
, left
);
518 snd_printk(KERN_ERR
"aci_setvalue(%d) failed: %d\n",
523 error
= aci_setvalue(aci
, setreg_left
, 0x80 - left
);
525 snd_printk(KERN_ERR
"aci_setvalue(%d) failed: %d\n",
532 error
= aci_setvalue(aci
, setreg_right
, right
);
534 snd_printk(KERN_ERR
"aci_setvalue(%d) failed: %d\n",
539 error
= aci_setvalue(aci
, setreg_right
, 0x80 - right
);
541 snd_printk(KERN_ERR
"aci_setvalue(%d) failed: %d\n",
542 0x80 - right
, error
);
549 /* non-equalizer elements */
551 if (left
< 0 || left
> 0x20 ||
552 right
< 0 || right
> 0x20)
555 left_old
= 0x20 - left_old
;
556 right_old
= 0x20 - right_old
;
558 error
= aci_setvalue(aci
, setreg_left
, 0x20 - left
);
560 snd_printk(KERN_ERR
"aci_setvalue(%d) failed: %d\n",
564 error
= aci_setvalue(aci
, setreg_right
, 0x20 - right
);
566 snd_printk(KERN_ERR
"aci_setvalue(%d) failed: %d\n",
567 0x20 - right
, error
);
572 change
= (left
!= left_old
) || (right
!= right_old
);
577 static const struct snd_kcontrol_new snd_miro_controls
[] = {
578 MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER
, ACI_SET_MASTER
),
579 MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC
, ACI_SET_MIC
),
580 MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE
, ACI_SET_LINE
),
581 MIRO_DOUBLE("CD Playback Volume", 0, ACI_GET_CD
, ACI_SET_CD
),
582 MIRO_DOUBLE("Synth Playback Volume", 0, ACI_GET_SYNTH
, ACI_SET_SYNTH
),
583 MIRO_DOUBLE("PCM Playback Volume", 1, ACI_GET_PCM
, ACI_SET_PCM
),
584 MIRO_DOUBLE("Aux Playback Volume", 2, ACI_GET_LINE2
, ACI_SET_LINE2
),
587 /* Equalizer with seven bands (only PCM20)
588 from -12dB up to +12dB on each band */
589 static const struct snd_kcontrol_new snd_miro_eq_controls
[] = {
590 MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1
, ACI_SET_EQ1
),
591 MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2
, ACI_SET_EQ2
),
592 MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3
, ACI_SET_EQ3
),
593 MIRO_DOUBLE("Tone Control - 1 kHz", 0, ACI_GET_EQ4
, ACI_SET_EQ4
),
594 MIRO_DOUBLE("Tone Control - 2.5 kHz", 0, ACI_GET_EQ5
, ACI_SET_EQ5
),
595 MIRO_DOUBLE("Tone Control - 6.3 kHz", 0, ACI_GET_EQ6
, ACI_SET_EQ6
),
596 MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7
, ACI_SET_EQ7
),
599 static const struct snd_kcontrol_new snd_miro_radio_control
[] = {
600 MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1
, ACI_SET_LINE1
),
603 static const struct snd_kcontrol_new snd_miro_line_control
[] = {
604 MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1
, ACI_SET_LINE1
),
607 static const struct snd_kcontrol_new snd_miro_preamp_control
[] = {
609 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
612 .info
= snd_miro_info_preamp
,
613 .get
= snd_miro_get_preamp
,
614 .put
= snd_miro_put_preamp
,
617 static const struct snd_kcontrol_new snd_miro_amp_control
[] = {
619 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
620 .name
= "Line Boost",
622 .info
= snd_miro_info_amp
,
623 .get
= snd_miro_get_amp
,
624 .put
= snd_miro_put_amp
,
627 static const struct snd_kcontrol_new snd_miro_capture_control
[] = {
629 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
630 .name
= "PCM Capture Switch",
632 .info
= snd_miro_info_capture
,
633 .get
= snd_miro_get_capture
,
634 .put
= snd_miro_put_capture
,
637 static const unsigned char aci_init_values
[][2] = {
638 { ACI_SET_MUTE
, 0x00 },
639 { ACI_SET_POWERAMP
, 0x00 },
640 { ACI_SET_PREAMP
, 0x00 },
641 { ACI_SET_SOLOMODE
, 0x00 },
642 { ACI_SET_MIC
+ 0, 0x20 },
643 { ACI_SET_MIC
+ 8, 0x20 },
644 { ACI_SET_LINE
+ 0, 0x20 },
645 { ACI_SET_LINE
+ 8, 0x20 },
646 { ACI_SET_CD
+ 0, 0x20 },
647 { ACI_SET_CD
+ 8, 0x20 },
648 { ACI_SET_PCM
+ 0, 0x20 },
649 { ACI_SET_PCM
+ 8, 0x20 },
650 { ACI_SET_LINE1
+ 0, 0x20 },
651 { ACI_SET_LINE1
+ 8, 0x20 },
652 { ACI_SET_LINE2
+ 0, 0x20 },
653 { ACI_SET_LINE2
+ 8, 0x20 },
654 { ACI_SET_SYNTH
+ 0, 0x20 },
655 { ACI_SET_SYNTH
+ 8, 0x20 },
656 { ACI_SET_MASTER
+ 0, 0x20 },
657 { ACI_SET_MASTER
+ 1, 0x20 },
660 static int snd_set_aci_init_values(struct snd_miro
*miro
)
663 struct snd_miro_aci
*aci
= miro
->aci
;
665 /* enable WSS on PCM1 */
667 if ((aci
->aci_product
== 'A') && wss
) {
668 error
= aci_setvalue(aci
, ACI_SET_WSS
, wss
);
670 snd_printk(KERN_ERR
"enabling WSS mode failed\n");
675 /* enable IDE port */
678 error
= aci_setvalue(aci
, ACI_SET_IDE
, ide
);
680 snd_printk(KERN_ERR
"enabling IDE port failed\n");
685 /* set common aci values */
687 for (idx
= 0; idx
< ARRAY_SIZE(aci_init_values
); idx
++) {
688 error
= aci_setvalue(aci
, aci_init_values
[idx
][0],
689 aci_init_values
[idx
][1]);
691 snd_printk(KERN_ERR
"aci_setvalue(%d) failed: %d\n",
692 aci_init_values
[idx
][0], error
);
698 aci
->aci_solomode
= 1;
703 static int snd_miro_mixer(struct snd_card
*card
,
704 struct snd_miro
*miro
)
709 if (snd_BUG_ON(!miro
|| !card
))
712 switch (miro
->hardware
) {
713 case OPTi9XX_HW_82C924
:
714 strcpy(card
->mixername
, "ACI & OPTi924");
716 case OPTi9XX_HW_82C929
:
717 strcpy(card
->mixername
, "ACI & OPTi929");
724 for (idx
= 0; idx
< ARRAY_SIZE(snd_miro_controls
); idx
++) {
725 if ((err
= snd_ctl_add(card
, snd_ctl_new1(&snd_miro_controls
[idx
], miro
))) < 0)
729 if ((miro
->aci
->aci_product
== 'A') ||
730 (miro
->aci
->aci_product
== 'B')) {
731 /* PCM1/PCM12 with power-amp and Line 2 */
732 if ((err
= snd_ctl_add(card
, snd_ctl_new1(&snd_miro_line_control
[0], miro
))) < 0)
734 if ((err
= snd_ctl_add(card
, snd_ctl_new1(&snd_miro_amp_control
[0], miro
))) < 0)
738 if ((miro
->aci
->aci_product
== 'B') ||
739 (miro
->aci
->aci_product
== 'C')) {
740 /* PCM12/PCM20 with mic-preamp */
741 if ((err
= snd_ctl_add(card
, snd_ctl_new1(&snd_miro_preamp_control
[0], miro
))) < 0)
743 if (miro
->aci
->aci_version
>= 176)
744 if ((err
= snd_ctl_add(card
, snd_ctl_new1(&snd_miro_capture_control
[0], miro
))) < 0)
748 if (miro
->aci
->aci_product
== 'C') {
749 /* PCM20 with radio and 7 band equalizer */
750 if ((err
= snd_ctl_add(card
, snd_ctl_new1(&snd_miro_radio_control
[0], miro
))) < 0)
752 for (idx
= 0; idx
< ARRAY_SIZE(snd_miro_eq_controls
); idx
++) {
753 if ((err
= snd_ctl_add(card
, snd_ctl_new1(&snd_miro_eq_controls
[idx
], miro
))) < 0)
761 static int snd_miro_init(struct snd_miro
*chip
,
762 unsigned short hardware
)
764 static const int opti9xx_mc_size
[] = {7, 7, 10, 10, 2, 2, 2};
766 chip
->hardware
= hardware
;
767 strcpy(chip
->name
, snd_opti9xx_names
[hardware
]);
769 chip
->mc_base_size
= opti9xx_mc_size
[hardware
];
771 spin_lock_init(&chip
->lock
);
783 if (isapnp
&& chip
->mc_base
)
784 /* PnP resource gives the least 10 bits */
785 chip
->mc_base
|= 0xc00;
788 chip
->mc_base
= 0xf8c;
791 case OPTi9XX_HW_82C929
:
792 chip
->password
= 0xe3;
795 case OPTi9XX_HW_82C924
:
796 chip
->password
= 0xe5;
800 snd_printk(KERN_ERR
"sorry, no support for %d\n", hardware
);
807 static unsigned char snd_miro_read(struct snd_miro
*chip
,
811 unsigned char retval
= 0xff;
813 spin_lock_irqsave(&chip
->lock
, flags
);
814 outb(chip
->password
, chip
->mc_base
+ chip
->pwd_reg
);
816 switch (chip
->hardware
) {
817 case OPTi9XX_HW_82C924
:
819 outb(reg
, chip
->mc_base
+ 8);
820 outb(chip
->password
, chip
->mc_base
+ chip
->pwd_reg
);
821 retval
= inb(chip
->mc_base
+ 9);
826 case OPTi9XX_HW_82C929
:
827 retval
= inb(chip
->mc_base
+ reg
);
831 snd_printk(KERN_ERR
"sorry, no support for %d\n", chip
->hardware
);
834 spin_unlock_irqrestore(&chip
->lock
, flags
);
838 static void snd_miro_write(struct snd_miro
*chip
, unsigned char reg
,
843 spin_lock_irqsave(&chip
->lock
, flags
);
844 outb(chip
->password
, chip
->mc_base
+ chip
->pwd_reg
);
846 switch (chip
->hardware
) {
847 case OPTi9XX_HW_82C924
:
849 outb(reg
, chip
->mc_base
+ 8);
850 outb(chip
->password
, chip
->mc_base
+ chip
->pwd_reg
);
851 outb(value
, chip
->mc_base
+ 9);
856 case OPTi9XX_HW_82C929
:
857 outb(value
, chip
->mc_base
+ reg
);
861 snd_printk(KERN_ERR
"sorry, no support for %d\n", chip
->hardware
);
864 spin_unlock_irqrestore(&chip
->lock
, flags
);
867 static inline void snd_miro_write_mask(struct snd_miro
*chip
,
868 unsigned char reg
, unsigned char value
, unsigned char mask
)
870 unsigned char oldval
= snd_miro_read(chip
, reg
);
872 snd_miro_write(chip
, reg
, (oldval
& ~mask
) | (value
& mask
));
879 static void snd_miro_proc_read(struct snd_info_entry
* entry
,
880 struct snd_info_buffer
*buffer
)
882 struct snd_miro
*miro
= (struct snd_miro
*) entry
->private_data
;
883 struct snd_miro_aci
*aci
= miro
->aci
;
884 char* model
= "unknown";
886 /* miroSOUND PCM1 pro, early PCM12 */
888 if ((miro
->hardware
== OPTi9XX_HW_82C929
) &&
889 (aci
->aci_vendor
== 'm') &&
890 (aci
->aci_product
== 'A')) {
891 switch (aci
->aci_version
) {
893 model
= "miroSOUND PCM1 pro";
896 model
= "miroSOUND PCM1 pro / (early) PCM12";
901 /* miroSOUND PCM12, PCM12 (Rev. E), PCM12 pnp */
903 if ((miro
->hardware
== OPTi9XX_HW_82C924
) &&
904 (aci
->aci_vendor
== 'm') &&
905 (aci
->aci_product
== 'B')) {
906 switch (aci
->aci_version
) {
908 model
= "miroSOUND PCM12";
911 model
= "miroSOUND PCM12 (Rev. E)";
914 model
= "miroSOUND PCM12 / PCM12 pnp";
919 /* miroSOUND PCM20 radio */
921 if ((miro
->hardware
== OPTi9XX_HW_82C924
) &&
922 (aci
->aci_vendor
== 'm') &&
923 (aci
->aci_product
== 'C')) {
924 switch (aci
->aci_version
) {
926 model
= "miroSOUND PCM20 radio (Rev. E)";
929 model
= "miroSOUND PCM20 radio";
934 snd_iprintf(buffer
, "\nGeneral information:\n");
935 snd_iprintf(buffer
, " model : %s\n", model
);
936 snd_iprintf(buffer
, " opti : %s\n", miro
->name
);
937 snd_iprintf(buffer
, " codec : %s\n", miro
->pcm
->name
);
938 snd_iprintf(buffer
, " port : 0x%lx\n", miro
->wss_base
);
939 snd_iprintf(buffer
, " irq : %d\n", miro
->irq
);
940 snd_iprintf(buffer
, " dma : %d,%d\n\n", miro
->dma1
, miro
->dma2
);
942 snd_iprintf(buffer
, "MPU-401:\n");
943 snd_iprintf(buffer
, " port : 0x%lx\n", miro
->mpu_port
);
944 snd_iprintf(buffer
, " irq : %d\n\n", miro
->mpu_irq
);
946 snd_iprintf(buffer
, "ACI information:\n");
947 snd_iprintf(buffer
, " vendor : ");
948 switch (aci
->aci_vendor
) {
950 snd_iprintf(buffer
, "Miro\n");
953 snd_iprintf(buffer
, "unknown (0x%x)\n", aci
->aci_vendor
);
957 snd_iprintf(buffer
, " product : ");
958 switch (aci
->aci_product
) {
960 snd_iprintf(buffer
, "miroSOUND PCM1 pro / (early) PCM12\n");
963 snd_iprintf(buffer
, "miroSOUND PCM12\n");
966 snd_iprintf(buffer
, "miroSOUND PCM20 radio\n");
969 snd_iprintf(buffer
, "unknown (0x%x)\n", aci
->aci_product
);
973 snd_iprintf(buffer
, " firmware: %d (0x%x)\n",
974 aci
->aci_version
, aci
->aci_version
);
975 snd_iprintf(buffer
, " port : 0x%lx-0x%lx\n",
976 aci
->aci_port
, aci
->aci_port
+2);
977 snd_iprintf(buffer
, " wss : 0x%x\n", wss
);
978 snd_iprintf(buffer
, " ide : 0x%x\n", ide
);
979 snd_iprintf(buffer
, " solomode: 0x%x\n", aci
->aci_solomode
);
980 snd_iprintf(buffer
, " amp : 0x%x\n", aci
->aci_amp
);
981 snd_iprintf(buffer
, " preamp : 0x%x\n", aci
->aci_preamp
);
984 static void snd_miro_proc_init(struct snd_card
*card
,
985 struct snd_miro
*miro
)
987 snd_card_ro_proc_new(card
, "miro", miro
, snd_miro_proc_read
);
994 static int snd_miro_configure(struct snd_miro
*chip
)
996 unsigned char wss_base_bits
;
997 unsigned char irq_bits
;
998 unsigned char dma_bits
;
999 unsigned char mpu_port_bits
= 0;
1000 unsigned char mpu_irq_bits
;
1001 unsigned long flags
;
1003 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(1), 0x80, 0x80);
1004 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */
1005 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(5), 0x02, 0x02);
1007 switch (chip
->hardware
) {
1008 case OPTi9XX_HW_82C924
:
1009 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(6), 0x02, 0x02);
1010 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(3), 0xf0, 0xff);
1012 case OPTi9XX_HW_82C929
:
1013 /* untested init commands for OPTi929 */
1014 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(4), 0x00, 0x0c);
1017 snd_printk(KERN_ERR
"chip %d not supported\n", chip
->hardware
);
1021 /* PnP resource says it decodes only 10 bits of address */
1022 switch (chip
->wss_base
& 0x3ff) {
1024 chip
->wss_base
= 0x530;
1025 wss_base_bits
= 0x00;
1028 chip
->wss_base
= 0x604;
1029 wss_base_bits
= 0x03;
1032 chip
->wss_base
= 0xe80;
1033 wss_base_bits
= 0x01;
1036 chip
->wss_base
= 0xf40;
1037 wss_base_bits
= 0x02;
1040 snd_printk(KERN_ERR
"WSS port 0x%lx not valid\n", chip
->wss_base
);
1043 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(1), wss_base_bits
<< 4, 0x30);
1046 switch (chip
->irq
) {
1063 snd_printk(KERN_ERR
"WSS irq # %d not valid\n", chip
->irq
);
1064 goto __skip_resources
;
1067 switch (chip
->dma1
) {
1078 snd_printk(KERN_ERR
"WSS dma1 # %d not valid\n", chip
->dma1
);
1079 goto __skip_resources
;
1082 if (chip
->dma1
== chip
->dma2
) {
1083 snd_printk(KERN_ERR
"don't want to share dmas\n");
1087 switch (chip
->dma2
) {
1092 snd_printk(KERN_ERR
"WSS dma2 # %d not valid\n", chip
->dma2
);
1093 goto __skip_resources
;
1097 spin_lock_irqsave(&chip
->lock
, flags
);
1098 outb(irq_bits
<< 3 | dma_bits
, chip
->wss_base
);
1099 spin_unlock_irqrestore(&chip
->lock
, flags
);
1102 if (chip
->hardware
> OPTi9XX_HW_82C928
) {
1103 switch (chip
->mpu_port
) {
1108 mpu_port_bits
= 0x03;
1111 mpu_port_bits
= 0x02;
1114 mpu_port_bits
= 0x01;
1117 mpu_port_bits
= 0x00;
1120 snd_printk(KERN_ERR
"MPU-401 port 0x%lx not valid\n",
1125 switch (chip
->mpu_irq
) {
1127 mpu_irq_bits
= 0x02;
1130 mpu_irq_bits
= 0x03;
1133 mpu_irq_bits
= 0x00;
1136 mpu_irq_bits
= 0x01;
1139 snd_printk(KERN_ERR
"MPU-401 irq # %d not valid\n",
1144 snd_miro_write_mask(chip
, OPTi9XX_MC_REG(6),
1145 (chip
->mpu_port
<= 0) ? 0x00 :
1146 0x80 | mpu_port_bits
<< 5 | mpu_irq_bits
<< 3,
1154 static int snd_miro_opti_check(struct snd_miro
*chip
)
1156 unsigned char value
;
1158 chip
->res_mc_base
= request_region(chip
->mc_base
, chip
->mc_base_size
,
1160 if (chip
->res_mc_base
== NULL
)
1163 value
= snd_miro_read(chip
, OPTi9XX_MC_REG(1));
1164 if (value
!= 0xff && value
!= inb(chip
->mc_base
+ OPTi9XX_MC_REG(1)))
1165 if (value
== snd_miro_read(chip
, OPTi9XX_MC_REG(1)))
1168 release_and_free_resource(chip
->res_mc_base
);
1169 chip
->res_mc_base
= NULL
;
1174 static int snd_card_miro_detect(struct snd_card
*card
,
1175 struct snd_miro
*chip
)
1179 for (i
= OPTi9XX_HW_82C929
; i
<= OPTi9XX_HW_82C924
; i
++) {
1181 if ((err
= snd_miro_init(chip
, i
)) < 0)
1184 err
= snd_miro_opti_check(chip
);
1192 static int snd_card_miro_aci_detect(struct snd_card
*card
,
1193 struct snd_miro
*miro
)
1195 unsigned char regval
;
1197 struct snd_miro_aci
*aci
= &aci_device
;
1201 mutex_init(&aci
->aci_mutex
);
1203 /* get ACI port from OPTi9xx MC 4 */
1205 regval
=inb(miro
->mc_base
+ 4);
1206 aci
->aci_port
= (regval
& 0x10) ? 0x344 : 0x354;
1208 miro
->res_aci_port
= request_region(aci
->aci_port
, 3, "miro aci");
1209 if (miro
->res_aci_port
== NULL
) {
1210 snd_printk(KERN_ERR
"aci i/o area 0x%lx-0x%lx already used.\n",
1211 aci
->aci_port
, aci
->aci_port
+2);
1215 /* force ACI into a known state */
1216 for (i
= 0; i
< 3; i
++)
1217 if (snd_aci_cmd(aci
, ACI_ERROR_OP
, -1, -1) < 0) {
1218 snd_printk(KERN_ERR
"can't force aci into known state.\n");
1222 aci
->aci_vendor
= snd_aci_cmd(aci
, ACI_READ_IDCODE
, -1, -1);
1223 aci
->aci_product
= snd_aci_cmd(aci
, ACI_READ_IDCODE
, -1, -1);
1224 if (aci
->aci_vendor
< 0 || aci
->aci_product
< 0) {
1225 snd_printk(KERN_ERR
"can't read aci id on 0x%lx.\n",
1230 aci
->aci_version
= snd_aci_cmd(aci
, ACI_READ_VERSION
, -1, -1);
1231 if (aci
->aci_version
< 0) {
1232 snd_printk(KERN_ERR
"can't read aci version on 0x%lx.\n",
1237 if (snd_aci_cmd(aci
, ACI_INIT
, -1, -1) < 0 ||
1238 snd_aci_cmd(aci
, ACI_ERROR_OP
, ACI_ERROR_OP
, ACI_ERROR_OP
) < 0 ||
1239 snd_aci_cmd(aci
, ACI_ERROR_OP
, ACI_ERROR_OP
, ACI_ERROR_OP
) < 0) {
1240 snd_printk(KERN_ERR
"can't initialize aci.\n");
1247 static void snd_card_miro_free(struct snd_card
*card
)
1249 struct snd_miro
*miro
= card
->private_data
;
1251 release_and_free_resource(miro
->res_aci_port
);
1253 miro
->aci
->aci_port
= 0;
1254 release_and_free_resource(miro
->res_mc_base
);
1257 static int snd_miro_probe(struct snd_card
*card
)
1260 struct snd_miro
*miro
= card
->private_data
;
1261 struct snd_wss
*codec
;
1262 struct snd_rawmidi
*rmidi
;
1264 if (!miro
->res_mc_base
) {
1265 miro
->res_mc_base
= request_region(miro
->mc_base
,
1267 "miro (OPTi9xx MC)");
1268 if (miro
->res_mc_base
== NULL
) {
1269 snd_printk(KERN_ERR
"request for OPTI9xx MC failed\n");
1274 error
= snd_card_miro_aci_detect(card
, miro
);
1276 snd_printk(KERN_ERR
"unable to detect aci chip\n");
1280 miro
->wss_base
= port
;
1281 miro
->mpu_port
= mpu_port
;
1283 miro
->mpu_irq
= mpu_irq
;
1287 /* init proc interface */
1288 snd_miro_proc_init(card
, miro
);
1290 error
= snd_miro_configure(miro
);
1294 error
= snd_wss_create(card
, miro
->wss_base
+ 4, -1,
1295 miro
->irq
, miro
->dma1
, miro
->dma2
,
1296 WSS_HW_DETECT
, 0, &codec
);
1300 error
= snd_wss_pcm(codec
, 0);
1304 error
= snd_wss_mixer(codec
);
1308 error
= snd_wss_timer(codec
, 0);
1312 miro
->pcm
= codec
->pcm
;
1314 error
= snd_miro_mixer(card
, miro
);
1318 if (miro
->aci
->aci_vendor
== 'm') {
1319 /* It looks like a miro sound card. */
1320 switch (miro
->aci
->aci_product
) {
1322 sprintf(card
->shortname
,
1323 "miroSOUND PCM1 pro / PCM12");
1326 sprintf(card
->shortname
,
1330 sprintf(card
->shortname
,
1331 "miroSOUND PCM20 radio");
1334 sprintf(card
->shortname
,
1336 snd_printk(KERN_INFO
"unknown miro aci id\n");
1340 snd_printk(KERN_INFO
"found unsupported aci card\n");
1341 sprintf(card
->shortname
, "unknown Cardinal Technologies");
1344 strcpy(card
->driver
, "miro");
1345 snprintf(card
->longname
, sizeof(card
->longname
),
1346 "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
1347 card
->shortname
, miro
->name
, codec
->pcm
->name
,
1348 miro
->wss_base
+ 4, miro
->irq
, miro
->dma1
, miro
->dma2
);
1350 if (mpu_port
<= 0 || mpu_port
== SNDRV_AUTO_PORT
)
1353 error
= snd_mpu401_uart_new(card
, 0, MPU401_HW_MPU401
,
1354 mpu_port
, 0, miro
->mpu_irq
, &rmidi
);
1356 snd_printk(KERN_WARNING
"no MPU-401 device at 0x%lx?\n",
1360 if (fm_port
> 0 && fm_port
!= SNDRV_AUTO_PORT
) {
1361 struct snd_opl3
*opl3
= NULL
;
1362 struct snd_opl4
*opl4
;
1364 if (snd_opl4_create(card
, fm_port
, fm_port
- 8,
1365 2, &opl3
, &opl4
) < 0)
1366 snd_printk(KERN_WARNING
"no OPL4 device at 0x%lx\n",
1370 error
= snd_set_aci_init_values(miro
);
1374 return snd_card_register(card
);
1377 static int snd_miro_isa_match(struct device
*devptr
, unsigned int n
)
1380 if (snd_miro_pnp_is_probed
)
1388 static int snd_miro_isa_probe(struct device
*devptr
, unsigned int n
)
1390 static const long possible_ports
[] = {0x530, 0xe80, 0xf40, 0x604, -1};
1391 static const long possible_mpu_ports
[] = {0x330, 0x300, 0x310, 0x320, -1};
1392 static const int possible_irqs
[] = {11, 9, 10, 7, -1};
1393 static const int possible_mpu_irqs
[] = {10, 5, 9, 7, -1};
1394 static const int possible_dma1s
[] = {3, 1, 0, -1};
1395 static const int possible_dma2s
[][2] = { {1, -1}, {0, -1}, {-1, -1},
1399 struct snd_miro
*miro
;
1400 struct snd_card
*card
;
1402 error
= snd_card_new(devptr
, index
, id
, THIS_MODULE
,
1403 sizeof(struct snd_miro
), &card
);
1407 card
->private_free
= snd_card_miro_free
;
1408 miro
= card
->private_data
;
1410 error
= snd_card_miro_detect(card
, miro
);
1412 snd_card_free(card
);
1413 snd_printk(KERN_ERR
"unable to detect OPTi9xx chip\n");
1417 if (port
== SNDRV_AUTO_PORT
) {
1418 port
= snd_legacy_find_free_ioport(possible_ports
, 4);
1420 snd_card_free(card
);
1421 snd_printk(KERN_ERR
"unable to find a free WSS port\n");
1426 if (mpu_port
== SNDRV_AUTO_PORT
) {
1427 mpu_port
= snd_legacy_find_free_ioport(possible_mpu_ports
, 2);
1429 snd_card_free(card
);
1431 "unable to find a free MPU401 port\n");
1436 if (irq
== SNDRV_AUTO_IRQ
) {
1437 irq
= snd_legacy_find_free_irq(possible_irqs
);
1439 snd_card_free(card
);
1440 snd_printk(KERN_ERR
"unable to find a free IRQ\n");
1444 if (mpu_irq
== SNDRV_AUTO_IRQ
) {
1445 mpu_irq
= snd_legacy_find_free_irq(possible_mpu_irqs
);
1447 snd_card_free(card
);
1449 "unable to find a free MPU401 IRQ\n");
1453 if (dma1
== SNDRV_AUTO_DMA
) {
1454 dma1
= snd_legacy_find_free_dma(possible_dma1s
);
1456 snd_card_free(card
);
1457 snd_printk(KERN_ERR
"unable to find a free DMA1\n");
1461 if (dma2
== SNDRV_AUTO_DMA
) {
1462 dma2
= snd_legacy_find_free_dma(possible_dma2s
[dma1
% 4]);
1464 snd_card_free(card
);
1465 snd_printk(KERN_ERR
"unable to find a free DMA2\n");
1470 error
= snd_miro_probe(card
);
1472 snd_card_free(card
);
1476 dev_set_drvdata(devptr
, card
);
1480 static void snd_miro_isa_remove(struct device
*devptr
,
1483 snd_card_free(dev_get_drvdata(devptr
));
1486 #define DEV_NAME "miro"
1488 static struct isa_driver snd_miro_driver
= {
1489 .match
= snd_miro_isa_match
,
1490 .probe
= snd_miro_isa_probe
,
1491 .remove
= snd_miro_isa_remove
,
1492 /* FIXME: suspend/resume */
1500 static int snd_card_miro_pnp(struct snd_miro
*chip
,
1501 struct pnp_card_link
*card
,
1502 const struct pnp_card_device_id
*pid
)
1504 struct pnp_dev
*pdev
;
1506 struct pnp_dev
*devmpu
;
1507 struct pnp_dev
*devmc
;
1509 pdev
= pnp_request_card_device(card
, pid
->devs
[0].id
, NULL
);
1513 devmpu
= pnp_request_card_device(card
, pid
->devs
[1].id
, NULL
);
1517 devmc
= pnp_request_card_device(card
, pid
->devs
[2].id
, NULL
);
1521 err
= pnp_activate_dev(pdev
);
1523 snd_printk(KERN_ERR
"AUDIO pnp configure failure: %d\n", err
);
1527 err
= pnp_activate_dev(devmc
);
1529 snd_printk(KERN_ERR
"MC pnp configure failure: %d\n",
1534 port
= pnp_port_start(pdev
, 1);
1535 fm_port
= pnp_port_start(pdev
, 2) + 8;
1538 * The MC(0) is never accessed and the miroSOUND PCM20 card does not
1539 * include it in the PnP resource range. OPTI93x include it.
1541 chip
->mc_base
= pnp_port_start(devmc
, 0) - 1;
1542 chip
->mc_base_size
= pnp_port_len(devmc
, 0) + 1;
1544 irq
= pnp_irq(pdev
, 0);
1545 dma1
= pnp_dma(pdev
, 0);
1546 dma2
= pnp_dma(pdev
, 1);
1549 err
= pnp_activate_dev(devmpu
);
1551 snd_printk(KERN_ERR
"MPU401 pnp configure failure\n");
1555 mpu_port
= pnp_port_start(devmpu
, 0);
1556 mpu_irq
= pnp_irq(devmpu
, 0);
1561 static int snd_miro_pnp_probe(struct pnp_card_link
*pcard
,
1562 const struct pnp_card_device_id
*pid
)
1564 struct snd_card
*card
;
1566 struct snd_miro
*miro
;
1568 if (snd_miro_pnp_is_probed
)
1572 err
= snd_card_new(&pcard
->card
->dev
, index
, id
, THIS_MODULE
,
1573 sizeof(struct snd_miro
), &card
);
1577 card
->private_free
= snd_card_miro_free
;
1578 miro
= card
->private_data
;
1580 err
= snd_card_miro_pnp(miro
, pcard
, pid
);
1582 snd_card_free(card
);
1586 /* only miroSOUND PCM20 and PCM12 == OPTi924 */
1587 err
= snd_miro_init(miro
, OPTi9XX_HW_82C924
);
1589 snd_card_free(card
);
1593 err
= snd_miro_opti_check(miro
);
1595 snd_printk(KERN_ERR
"OPTI chip not found\n");
1596 snd_card_free(card
);
1600 err
= snd_miro_probe(card
);
1602 snd_card_free(card
);
1605 pnp_set_card_drvdata(pcard
, card
);
1606 snd_miro_pnp_is_probed
= 1;
1610 static void snd_miro_pnp_remove(struct pnp_card_link
*pcard
)
1612 snd_card_free(pnp_get_card_drvdata(pcard
));
1613 pnp_set_card_drvdata(pcard
, NULL
);
1614 snd_miro_pnp_is_probed
= 0;
1617 static struct pnp_card_driver miro_pnpc_driver
= {
1618 .flags
= PNP_DRIVER_RES_DISABLE
,
1620 .id_table
= snd_miro_pnpids
,
1621 .probe
= snd_miro_pnp_probe
,
1622 .remove
= snd_miro_pnp_remove
,
1626 static int __init
alsa_card_miro_init(void)
1629 pnp_register_card_driver(&miro_pnpc_driver
);
1630 if (snd_miro_pnp_is_probed
)
1632 pnp_unregister_card_driver(&miro_pnpc_driver
);
1634 return isa_register_driver(&snd_miro_driver
, 1);
1637 static void __exit
alsa_card_miro_exit(void)
1639 if (!snd_miro_pnp_is_probed
) {
1640 isa_unregister_driver(&snd_miro_driver
);
1644 pnp_unregister_card_driver(&miro_pnpc_driver
);
1648 module_init(alsa_card_miro_init
)
1649 module_exit(alsa_card_miro_exit
)