aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/opti9xx
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/opti9xx')
-rw-r--r--sound/isa/opti9xx/miro.c74
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c94
2 files changed, 72 insertions, 96 deletions
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 1dd98375ac85..33471bdbe269 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -25,7 +25,7 @@
25#include <sound/driver.h> 25#include <sound/driver.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/platform_device.h> 28#include <linux/isa.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/ioport.h> 31#include <linux/ioport.h>
@@ -139,8 +139,6 @@ static void snd_miro_proc_init(struct snd_miro * miro);
139 139
140#define DRIVER_NAME "snd-miro" 140#define DRIVER_NAME "snd-miro"
141 141
142static struct platform_device *device;
143
144static char * snd_opti9xx_names[] = { 142static char * snd_opti9xx_names[] = {
145 "unkown", 143 "unkown",
146 "82C928", "82C929", 144 "82C928", "82C929",
@@ -558,7 +556,7 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol,
558 return change; 556 return change;
559} 557}
560 558
561static struct snd_kcontrol_new snd_miro_controls[] = { 559static struct snd_kcontrol_new snd_miro_controls[] __devinitdata = {
562MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), 560MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER),
563MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), 561MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC),
564MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), 562MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE),
@@ -570,7 +568,7 @@ MIRO_DOUBLE("Aux Playback Volume", 2, ACI_GET_LINE2, ACI_SET_LINE2),
570 568
571/* Equalizer with seven bands (only PCM20) 569/* Equalizer with seven bands (only PCM20)
572 from -12dB up to +12dB on each band */ 570 from -12dB up to +12dB on each band */
573static struct snd_kcontrol_new snd_miro_eq_controls[] = { 571static struct snd_kcontrol_new snd_miro_eq_controls[] __devinitdata = {
574MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), 572MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1),
575MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), 573MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2),
576MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), 574MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3),
@@ -580,15 +578,15 @@ MIRO_DOUBLE("Tone Control - 6.3 kHz", 0, ACI_GET_EQ6, ACI_SET_EQ6),
580MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), 578MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7),
581}; 579};
582 580
583static struct snd_kcontrol_new snd_miro_radio_control[] = { 581static struct snd_kcontrol_new snd_miro_radio_control[] __devinitdata = {
584MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), 582MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1),
585}; 583};
586 584
587static struct snd_kcontrol_new snd_miro_line_control[] = { 585static struct snd_kcontrol_new snd_miro_line_control[] __devinitdata = {
588MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), 586MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1),
589}; 587};
590 588
591static struct snd_kcontrol_new snd_miro_preamp_control[] = { 589static struct snd_kcontrol_new snd_miro_preamp_control[] __devinitdata = {
592{ 590{
593 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 591 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
594 .name = "Mic Boost", 592 .name = "Mic Boost",
@@ -598,7 +596,7 @@ static struct snd_kcontrol_new snd_miro_preamp_control[] = {
598 .put = snd_miro_put_preamp, 596 .put = snd_miro_put_preamp,
599}}; 597}};
600 598
601static struct snd_kcontrol_new snd_miro_amp_control[] = { 599static struct snd_kcontrol_new snd_miro_amp_control[] __devinitdata = {
602{ 600{
603 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 601 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
604 .name = "Line Boost", 602 .name = "Line Boost",
@@ -608,7 +606,7 @@ static struct snd_kcontrol_new snd_miro_amp_control[] = {
608 .put = snd_miro_put_amp, 606 .put = snd_miro_put_amp,
609}}; 607}};
610 608
611static struct snd_kcontrol_new snd_miro_capture_control[] = { 609static struct snd_kcontrol_new snd_miro_capture_control[] __devinitdata = {
612{ 610{
613 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 611 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
614 .name = "PCM Capture Switch", 612 .name = "PCM Capture Switch",
@@ -618,7 +616,7 @@ static struct snd_kcontrol_new snd_miro_capture_control[] = {
618 .put = snd_miro_put_capture, 616 .put = snd_miro_put_capture,
619}}; 617}};
620 618
621static unsigned char aci_init_values[][2] __initdata = { 619static unsigned char aci_init_values[][2] __devinitdata = {
622 { ACI_SET_MUTE, 0x00 }, 620 { ACI_SET_MUTE, 0x00 },
623 { ACI_SET_POWERAMP, 0x00 }, 621 { ACI_SET_POWERAMP, 0x00 },
624 { ACI_SET_PREAMP, 0x00 }, 622 { ACI_SET_PREAMP, 0x00 },
@@ -641,7 +639,7 @@ static unsigned char aci_init_values[][2] __initdata = {
641 { ACI_SET_MASTER + 1, 0x20 }, 639 { ACI_SET_MASTER + 1, 0x20 },
642}; 640};
643 641
644static int __init snd_set_aci_init_values(struct snd_miro *miro) 642static int __devinit snd_set_aci_init_values(struct snd_miro *miro)
645{ 643{
646 int idx, error; 644 int idx, error;
647 645
@@ -751,7 +749,8 @@ static long snd_legacy_find_free_ioport(long *port_table, long size)
751 return -1; 749 return -1;
752} 750}
753 751
754static int __init snd_miro_init(struct snd_miro *chip, unsigned short hardware) 752static int __devinit snd_miro_init(struct snd_miro *chip,
753 unsigned short hardware)
755{ 754{
756 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; 755 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
757 756
@@ -962,7 +961,7 @@ static void snd_miro_proc_read(struct snd_info_entry * entry,
962 snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); 961 snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp);
963} 962}
964 963
965static void __init snd_miro_proc_init(struct snd_miro * miro) 964static void __devinit snd_miro_proc_init(struct snd_miro * miro)
966{ 965{
967 struct snd_info_entry *entry; 966 struct snd_info_entry *entry;
968 967
@@ -974,7 +973,7 @@ static void __init snd_miro_proc_init(struct snd_miro * miro)
974 * Init 973 * Init
975 */ 974 */
976 975
977static int __init snd_miro_configure(struct snd_miro *chip) 976static int __devinit snd_miro_configure(struct snd_miro *chip)
978{ 977{
979 unsigned char wss_base_bits; 978 unsigned char wss_base_bits;
980 unsigned char irq_bits; 979 unsigned char irq_bits;
@@ -1131,7 +1130,8 @@ __skip_mpu:
1131 return 0; 1130 return 0;
1132} 1131}
1133 1132
1134static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *chip) 1133static int __devinit snd_card_miro_detect(struct snd_card *card,
1134 struct snd_miro *chip)
1135{ 1135{
1136 int i, err; 1136 int i, err;
1137 unsigned char value; 1137 unsigned char value;
@@ -1157,7 +1157,8 @@ static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *c
1157 return -ENODEV; 1157 return -ENODEV;
1158} 1158}
1159 1159
1160static int __init snd_card_miro_aci_detect(struct snd_card *card, struct snd_miro * miro) 1160static int __devinit snd_card_miro_aci_detect(struct snd_card *card,
1161 struct snd_miro * miro)
1161{ 1162{
1162 unsigned char regval; 1163 unsigned char regval;
1163 int i; 1164 int i;
@@ -1213,7 +1214,12 @@ static void snd_card_miro_free(struct snd_card *card)
1213 release_and_free_resource(miro->res_mc_base); 1214 release_and_free_resource(miro->res_mc_base);
1214} 1215}
1215 1216
1216static int __init snd_miro_probe(struct platform_device *devptr) 1217static int __devinit snd_miro_match(struct device *devptr, unsigned int n)
1218{
1219 return 1;
1220}
1221
1222static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
1217{ 1223{
1218 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 1224 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
1219 static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; 1225 static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1};
@@ -1399,25 +1405,26 @@ static int __init snd_miro_probe(struct platform_device *devptr)
1399 return error; 1405 return error;
1400 } 1406 }
1401 1407
1402 snd_card_set_dev(card, &devptr->dev); 1408 snd_card_set_dev(card, devptr);
1403 1409
1404 if ((error = snd_card_register(card))) { 1410 if ((error = snd_card_register(card))) {
1405 snd_card_free(card); 1411 snd_card_free(card);
1406 return error; 1412 return error;
1407 } 1413 }
1408 1414
1409 platform_set_drvdata(devptr, card); 1415 dev_set_drvdata(devptr, card);
1410 return 0; 1416 return 0;
1411} 1417}
1412 1418
1413static int __devexit snd_miro_remove(struct platform_device *devptr) 1419static int __devexit snd_miro_remove(struct device *devptr, unsigned int dev)
1414{ 1420{
1415 snd_card_free(platform_get_drvdata(devptr)); 1421 snd_card_free(dev_get_drvdata(devptr));
1416 platform_set_drvdata(devptr, NULL); 1422 dev_set_drvdata(devptr, NULL);
1417 return 0; 1423 return 0;
1418} 1424}
1419 1425
1420static struct platform_driver snd_miro_driver = { 1426static struct isa_driver snd_miro_driver = {
1427 .match = snd_miro_match,
1421 .probe = snd_miro_probe, 1428 .probe = snd_miro_probe,
1422 .remove = __devexit_p(snd_miro_remove), 1429 .remove = __devexit_p(snd_miro_remove),
1423 /* FIXME: suspend/resume */ 1430 /* FIXME: suspend/resume */
@@ -1428,27 +1435,12 @@ static struct platform_driver snd_miro_driver = {
1428 1435
1429static int __init alsa_card_miro_init(void) 1436static int __init alsa_card_miro_init(void)
1430{ 1437{
1431 int error; 1438 return isa_register_driver(&snd_miro_driver, 1);
1432
1433 if ((error = platform_driver_register(&snd_miro_driver)) < 0)
1434 return error;
1435 device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
1436 if (! IS_ERR(device)) {
1437 if (platform_get_drvdata(device))
1438 return 0;
1439 platform_device_unregister(device);
1440 }
1441#ifdef MODULE
1442 printk(KERN_ERR "no miro soundcard found\n");
1443#endif
1444 platform_driver_unregister(&snd_miro_driver);
1445 return PTR_ERR(device);
1446} 1439}
1447 1440
1448static void __exit alsa_card_miro_exit(void) 1441static void __exit alsa_card_miro_exit(void)
1449{ 1442{
1450 platform_device_unregister(device); 1443 isa_unregister_driver(&snd_miro_driver);
1451 platform_driver_unregister(&snd_miro_driver);
1452} 1444}
1453 1445
1454module_init(alsa_card_miro_init) 1446module_init(alsa_card_miro_init)
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index df227377c333..1c390580bd50 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -26,7 +26,7 @@
26#include <sound/driver.h> 26#include <sound/driver.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/platform_device.h> 29#include <linux/isa.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/pnp.h> 32#include <linux/pnp.h>
@@ -259,7 +259,6 @@ struct snd_opti9xx {
259}; 259};
260 260
261static int snd_opti9xx_pnp_is_probed; 261static int snd_opti9xx_pnp_is_probed;
262static struct platform_device *snd_opti9xx_platform_device;
263 262
264#ifdef CONFIG_PNP 263#ifdef CONFIG_PNP
265 264
@@ -294,7 +293,7 @@ static char * snd_opti9xx_names[] = {
294}; 293};
295 294
296 295
297static long __init snd_legacy_find_free_ioport(long *port_table, long size) 296static long __devinit snd_legacy_find_free_ioport(long *port_table, long size)
298{ 297{
299 while (*port_table != -1) { 298 while (*port_table != -1) {
300 if (request_region(*port_table, size, "ALSA test")) { 299 if (request_region(*port_table, size, "ALSA test")) {
@@ -306,7 +305,8 @@ static long __init snd_legacy_find_free_ioport(long *port_table, long size)
306 return -1; 305 return -1;
307} 306}
308 307
309static int __init snd_opti9xx_init(struct snd_opti9xx *chip, unsigned short hardware) 308static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
309 unsigned short hardware)
310{ 310{
311 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; 311 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
312 312
@@ -451,7 +451,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
451 (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) 451 (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
452 452
453 453
454static int __init snd_opti9xx_configure(struct snd_opti9xx *chip) 454static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
455{ 455{
456 unsigned char wss_base_bits; 456 unsigned char wss_base_bits;
457 unsigned char irq_bits; 457 unsigned char irq_bits;
@@ -1561,7 +1561,7 @@ static int snd_opti93x_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
1561 return change; 1561 return change;
1562} 1562}
1563 1563
1564static struct snd_kcontrol_new snd_opti93x_controls[] = { 1564static struct snd_kcontrol_new snd_opti93x_controls[] __devinitdata = {
1565OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), 1565OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1),
1566OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), 1566OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1),
1567OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1), 1567OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1),
@@ -1622,7 +1622,8 @@ static int snd_opti93x_mixer(struct snd_opti93x *chip)
1622 1622
1623#endif /* OPTi93X */ 1623#endif /* OPTi93X */
1624 1624
1625static int __init snd_card_opti9xx_detect(struct snd_card *card, struct snd_opti9xx *chip) 1625static int __devinit snd_card_opti9xx_detect(struct snd_card *card,
1626 struct snd_opti9xx *chip)
1626{ 1627{
1627 int i, err; 1628 int i, err;
1628 1629
@@ -1676,8 +1677,9 @@ static int __init snd_card_opti9xx_detect(struct snd_card *card, struct snd_opti
1676} 1677}
1677 1678
1678#ifdef CONFIG_PNP 1679#ifdef CONFIG_PNP
1679static int __init snd_card_opti9xx_pnp(struct snd_opti9xx *chip, struct pnp_card_link *card, 1680static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
1680 const struct pnp_card_device_id *pid) 1681 struct pnp_card_link *card,
1682 const struct pnp_card_device_id *pid)
1681{ 1683{
1682 struct pnp_dev *pdev; 1684 struct pnp_dev *pdev;
1683 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 1685 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
@@ -1778,7 +1780,7 @@ static void snd_card_opti9xx_free(struct snd_card *card)
1778 release_and_free_resource(chip->res_mc_base); 1780 release_and_free_resource(chip->res_mc_base);
1779} 1781}
1780 1782
1781static int __init snd_opti9xx_probe(struct snd_card *card) 1783static int __devinit snd_opti9xx_probe(struct snd_card *card)
1782{ 1784{
1783 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 1785 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
1784 int error; 1786 int error;
@@ -1924,7 +1926,18 @@ static struct snd_card *snd_opti9xx_card_new(void)
1924 return card; 1926 return card;
1925} 1927}
1926 1928
1927static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr) 1929static int __devinit snd_opti9xx_isa_match(struct device *devptr,
1930 unsigned int dev)
1931{
1932 if (snd_opti9xx_pnp_is_probed)
1933 return 0;
1934 if (isapnp)
1935 return 0;
1936 return 1;
1937}
1938
1939static int __devinit snd_opti9xx_isa_probe(struct device *devptr,
1940 unsigned int dev)
1928{ 1941{
1929 struct snd_card *card; 1942 struct snd_card *card;
1930 int error; 1943 int error;
@@ -1940,9 +1953,6 @@ static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr)
1940 static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; 1953 static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}};
1941#endif /* CS4231 || OPTi93X */ 1954#endif /* CS4231 || OPTi93X */
1942 1955
1943 if (snd_opti9xx_pnp_is_probed)
1944 return -EBUSY;
1945
1946 if (mpu_port == SNDRV_AUTO_PORT) { 1956 if (mpu_port == SNDRV_AUTO_PORT) {
1947 if ((mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) { 1957 if ((mpu_port = snd_legacy_find_free_ioport(possible_mpu_ports, 2)) < 0) {
1948 snd_printk(KERN_ERR "unable to find a free MPU401 port\n"); 1958 snd_printk(KERN_ERR "unable to find a free MPU401 port\n");
@@ -1984,25 +1994,27 @@ static int __init snd_opti9xx_nonpnp_probe(struct platform_device *devptr)
1984 snd_card_free(card); 1994 snd_card_free(card);
1985 return error; 1995 return error;
1986 } 1996 }
1987 snd_card_set_dev(card, &devptr->dev); 1997 snd_card_set_dev(card, devptr);
1988 if ((error = snd_opti9xx_probe(card)) < 0) { 1998 if ((error = snd_opti9xx_probe(card)) < 0) {
1989 snd_card_free(card); 1999 snd_card_free(card);
1990 return error; 2000 return error;
1991 } 2001 }
1992 platform_set_drvdata(devptr, card); 2002 dev_set_drvdata(devptr, card);
1993 return 0; 2003 return 0;
1994} 2004}
1995 2005
1996static int __devexit snd_opti9xx_nonpnp_remove(struct platform_device *devptr) 2006static int __devexit snd_opti9xx_isa_remove(struct device *devptr,
2007 unsigned int dev)
1997{ 2008{
1998 snd_card_free(platform_get_drvdata(devptr)); 2009 snd_card_free(dev_get_drvdata(devptr));
1999 platform_set_drvdata(devptr, NULL); 2010 dev_set_drvdata(devptr, NULL);
2000 return 0; 2011 return 0;
2001} 2012}
2002 2013
2003static struct platform_driver snd_opti9xx_driver = { 2014static struct isa_driver snd_opti9xx_driver = {
2004 .probe = snd_opti9xx_nonpnp_probe, 2015 .match = snd_opti9xx_isa_match,
2005 .remove = __devexit_p(snd_opti9xx_nonpnp_remove), 2016 .probe = snd_opti9xx_isa_probe,
2017 .remove = __devexit_p(snd_opti9xx_isa_remove),
2006 /* FIXME: suspend/resume */ 2018 /* FIXME: suspend/resume */
2007 .driver = { 2019 .driver = {
2008 .name = DRIVER_NAME 2020 .name = DRIVER_NAME
@@ -2010,8 +2022,8 @@ static struct platform_driver snd_opti9xx_driver = {
2010}; 2022};
2011 2023
2012#ifdef CONFIG_PNP 2024#ifdef CONFIG_PNP
2013static int __init snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, 2025static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
2014 const struct pnp_card_device_id *pid) 2026 const struct pnp_card_device_id *pid)
2015{ 2027{
2016 struct snd_card *card; 2028 struct snd_card *card;
2017 int error, hw; 2029 int error, hw;
@@ -2074,11 +2086,6 @@ static struct pnp_card_driver opti9xx_pnpc_driver = {
2074}; 2086};
2075#endif 2087#endif
2076 2088
2077#ifdef CONFIG_PNP
2078#define is_isapnp_selected() isapnp
2079#else
2080#define is_isapnp_selected() 0
2081#endif
2082#ifdef OPTi93X 2089#ifdef OPTi93X
2083#define CHIP_NAME "82C93x" 2090#define CHIP_NAME "82C93x"
2084#else 2091#else
@@ -2087,42 +2094,19 @@ static struct pnp_card_driver opti9xx_pnpc_driver = {
2087 2094
2088static int __init alsa_card_opti9xx_init(void) 2095static int __init alsa_card_opti9xx_init(void)
2089{ 2096{
2090 int error;
2091 struct platform_device *device;
2092
2093#ifdef CONFIG_PNP 2097#ifdef CONFIG_PNP
2094 pnp_register_card_driver(&opti9xx_pnpc_driver); 2098 pnp_register_card_driver(&opti9xx_pnpc_driver);
2095 if (snd_opti9xx_pnp_is_probed) 2099 if (snd_opti9xx_pnp_is_probed)
2096 return 0; 2100 return 0;
2097#endif 2101#endif
2098 if (! is_isapnp_selected()) { 2102 return isa_register_driver(&snd_opti9xx_driver, 1);
2099 error = platform_driver_register(&snd_opti9xx_driver);
2100 if (error < 0)
2101 return error;
2102 device = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
2103 if (!IS_ERR(device)) {
2104 if (platform_get_drvdata(device)) {
2105 snd_opti9xx_platform_device = device;
2106 return 0;
2107 }
2108 platform_device_unregister(device);
2109 }
2110 platform_driver_unregister(&snd_opti9xx_driver);
2111 }
2112#ifdef CONFIG_PNP
2113 pnp_unregister_card_driver(&opti9xx_pnpc_driver);
2114#endif
2115#ifdef MODULE
2116 printk(KERN_ERR "no OPTi " CHIP_NAME " soundcard found\n");
2117#endif
2118 return -ENODEV;
2119} 2103}
2120 2104
2121static void __exit alsa_card_opti9xx_exit(void) 2105static void __exit alsa_card_opti9xx_exit(void)
2122{ 2106{
2123 if (!snd_opti9xx_pnp_is_probed) { 2107 if (!snd_opti9xx_pnp_is_probed) {
2124 platform_device_unregister(snd_opti9xx_platform_device); 2108 isa_unregister_driver(&snd_opti9xx_driver);
2125 platform_driver_unregister(&snd_opti9xx_driver); 2109 return;
2126 } 2110 }
2127#ifdef CONFIG_PNP 2111#ifdef CONFIG_PNP
2128 pnp_unregister_card_driver(&opti9xx_pnpc_driver); 2112 pnp_unregister_card_driver(&opti9xx_pnpc_driver);