diff options
Diffstat (limited to 'sound/isa/opti9xx/miro.c')
-rw-r--r-- | sound/isa/opti9xx/miro.c | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 1dd98375ac85..cd29b30b362e 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> |
@@ -137,10 +137,6 @@ struct snd_miro { | |||
137 | 137 | ||
138 | static void snd_miro_proc_init(struct snd_miro * miro); | 138 | static void snd_miro_proc_init(struct snd_miro * miro); |
139 | 139 | ||
140 | #define DRIVER_NAME "snd-miro" | ||
141 | |||
142 | static struct platform_device *device; | ||
143 | |||
144 | static char * snd_opti9xx_names[] = { | 140 | static char * snd_opti9xx_names[] = { |
145 | "unkown", | 141 | "unkown", |
146 | "82C928", "82C929", | 142 | "82C928", "82C929", |
@@ -558,7 +554,7 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
558 | return change; | 554 | return change; |
559 | } | 555 | } |
560 | 556 | ||
561 | static struct snd_kcontrol_new snd_miro_controls[] = { | 557 | static struct snd_kcontrol_new snd_miro_controls[] __devinitdata = { |
562 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), | 558 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), |
563 | MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), | 559 | MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), |
564 | MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), | 560 | MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), |
@@ -570,7 +566,7 @@ MIRO_DOUBLE("Aux Playback Volume", 2, ACI_GET_LINE2, ACI_SET_LINE2), | |||
570 | 566 | ||
571 | /* Equalizer with seven bands (only PCM20) | 567 | /* Equalizer with seven bands (only PCM20) |
572 | from -12dB up to +12dB on each band */ | 568 | from -12dB up to +12dB on each band */ |
573 | static struct snd_kcontrol_new snd_miro_eq_controls[] = { | 569 | static struct snd_kcontrol_new snd_miro_eq_controls[] __devinitdata = { |
574 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), | 570 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), |
575 | MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), | 571 | MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), |
576 | MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), | 572 | MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), |
@@ -580,15 +576,15 @@ MIRO_DOUBLE("Tone Control - 6.3 kHz", 0, ACI_GET_EQ6, ACI_SET_EQ6), | |||
580 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), | 576 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), |
581 | }; | 577 | }; |
582 | 578 | ||
583 | static struct snd_kcontrol_new snd_miro_radio_control[] = { | 579 | static struct snd_kcontrol_new snd_miro_radio_control[] __devinitdata = { |
584 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), | 580 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), |
585 | }; | 581 | }; |
586 | 582 | ||
587 | static struct snd_kcontrol_new snd_miro_line_control[] = { | 583 | static struct snd_kcontrol_new snd_miro_line_control[] __devinitdata = { |
588 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), | 584 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), |
589 | }; | 585 | }; |
590 | 586 | ||
591 | static struct snd_kcontrol_new snd_miro_preamp_control[] = { | 587 | static struct snd_kcontrol_new snd_miro_preamp_control[] __devinitdata = { |
592 | { | 588 | { |
593 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 589 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
594 | .name = "Mic Boost", | 590 | .name = "Mic Boost", |
@@ -598,7 +594,7 @@ static struct snd_kcontrol_new snd_miro_preamp_control[] = { | |||
598 | .put = snd_miro_put_preamp, | 594 | .put = snd_miro_put_preamp, |
599 | }}; | 595 | }}; |
600 | 596 | ||
601 | static struct snd_kcontrol_new snd_miro_amp_control[] = { | 597 | static struct snd_kcontrol_new snd_miro_amp_control[] __devinitdata = { |
602 | { | 598 | { |
603 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 599 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
604 | .name = "Line Boost", | 600 | .name = "Line Boost", |
@@ -608,7 +604,7 @@ static struct snd_kcontrol_new snd_miro_amp_control[] = { | |||
608 | .put = snd_miro_put_amp, | 604 | .put = snd_miro_put_amp, |
609 | }}; | 605 | }}; |
610 | 606 | ||
611 | static struct snd_kcontrol_new snd_miro_capture_control[] = { | 607 | static struct snd_kcontrol_new snd_miro_capture_control[] __devinitdata = { |
612 | { | 608 | { |
613 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 609 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
614 | .name = "PCM Capture Switch", | 610 | .name = "PCM Capture Switch", |
@@ -618,7 +614,7 @@ static struct snd_kcontrol_new snd_miro_capture_control[] = { | |||
618 | .put = snd_miro_put_capture, | 614 | .put = snd_miro_put_capture, |
619 | }}; | 615 | }}; |
620 | 616 | ||
621 | static unsigned char aci_init_values[][2] __initdata = { | 617 | static unsigned char aci_init_values[][2] __devinitdata = { |
622 | { ACI_SET_MUTE, 0x00 }, | 618 | { ACI_SET_MUTE, 0x00 }, |
623 | { ACI_SET_POWERAMP, 0x00 }, | 619 | { ACI_SET_POWERAMP, 0x00 }, |
624 | { ACI_SET_PREAMP, 0x00 }, | 620 | { ACI_SET_PREAMP, 0x00 }, |
@@ -641,7 +637,7 @@ static unsigned char aci_init_values[][2] __initdata = { | |||
641 | { ACI_SET_MASTER + 1, 0x20 }, | 637 | { ACI_SET_MASTER + 1, 0x20 }, |
642 | }; | 638 | }; |
643 | 639 | ||
644 | static int __init snd_set_aci_init_values(struct snd_miro *miro) | 640 | static int __devinit snd_set_aci_init_values(struct snd_miro *miro) |
645 | { | 641 | { |
646 | int idx, error; | 642 | int idx, error; |
647 | 643 | ||
@@ -751,7 +747,8 @@ static long snd_legacy_find_free_ioport(long *port_table, long size) | |||
751 | return -1; | 747 | return -1; |
752 | } | 748 | } |
753 | 749 | ||
754 | static int __init snd_miro_init(struct snd_miro *chip, unsigned short hardware) | 750 | static int __devinit snd_miro_init(struct snd_miro *chip, |
751 | unsigned short hardware) | ||
755 | { | 752 | { |
756 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; | 753 | static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
757 | 754 | ||
@@ -962,7 +959,7 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
962 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); | 959 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); |
963 | } | 960 | } |
964 | 961 | ||
965 | static void __init snd_miro_proc_init(struct snd_miro * miro) | 962 | static void __devinit snd_miro_proc_init(struct snd_miro * miro) |
966 | { | 963 | { |
967 | struct snd_info_entry *entry; | 964 | struct snd_info_entry *entry; |
968 | 965 | ||
@@ -974,7 +971,7 @@ static void __init snd_miro_proc_init(struct snd_miro * miro) | |||
974 | * Init | 971 | * Init |
975 | */ | 972 | */ |
976 | 973 | ||
977 | static int __init snd_miro_configure(struct snd_miro *chip) | 974 | static int __devinit snd_miro_configure(struct snd_miro *chip) |
978 | { | 975 | { |
979 | unsigned char wss_base_bits; | 976 | unsigned char wss_base_bits; |
980 | unsigned char irq_bits; | 977 | unsigned char irq_bits; |
@@ -1131,7 +1128,8 @@ __skip_mpu: | |||
1131 | return 0; | 1128 | return 0; |
1132 | } | 1129 | } |
1133 | 1130 | ||
1134 | static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *chip) | 1131 | static int __devinit snd_card_miro_detect(struct snd_card *card, |
1132 | struct snd_miro *chip) | ||
1135 | { | 1133 | { |
1136 | int i, err; | 1134 | int i, err; |
1137 | unsigned char value; | 1135 | unsigned char value; |
@@ -1157,7 +1155,8 @@ static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *c | |||
1157 | return -ENODEV; | 1155 | return -ENODEV; |
1158 | } | 1156 | } |
1159 | 1157 | ||
1160 | static int __init snd_card_miro_aci_detect(struct snd_card *card, struct snd_miro * miro) | 1158 | static int __devinit snd_card_miro_aci_detect(struct snd_card *card, |
1159 | struct snd_miro * miro) | ||
1161 | { | 1160 | { |
1162 | unsigned char regval; | 1161 | unsigned char regval; |
1163 | int i; | 1162 | int i; |
@@ -1213,7 +1212,12 @@ static void snd_card_miro_free(struct snd_card *card) | |||
1213 | release_and_free_resource(miro->res_mc_base); | 1212 | release_and_free_resource(miro->res_mc_base); |
1214 | } | 1213 | } |
1215 | 1214 | ||
1216 | static int __init snd_miro_probe(struct platform_device *devptr) | 1215 | static int __devinit snd_miro_match(struct device *devptr, unsigned int n) |
1216 | { | ||
1217 | return 1; | ||
1218 | } | ||
1219 | |||
1220 | static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | ||
1217 | { | 1221 | { |
1218 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 1222 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
1219 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; | 1223 | static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; |
@@ -1399,56 +1403,44 @@ static int __init snd_miro_probe(struct platform_device *devptr) | |||
1399 | return error; | 1403 | return error; |
1400 | } | 1404 | } |
1401 | 1405 | ||
1402 | snd_card_set_dev(card, &devptr->dev); | 1406 | snd_card_set_dev(card, devptr); |
1403 | 1407 | ||
1404 | if ((error = snd_card_register(card))) { | 1408 | if ((error = snd_card_register(card))) { |
1405 | snd_card_free(card); | 1409 | snd_card_free(card); |
1406 | return error; | 1410 | return error; |
1407 | } | 1411 | } |
1408 | 1412 | ||
1409 | platform_set_drvdata(devptr, card); | 1413 | dev_set_drvdata(devptr, card); |
1410 | return 0; | 1414 | return 0; |
1411 | } | 1415 | } |
1412 | 1416 | ||
1413 | static int __devexit snd_miro_remove(struct platform_device *devptr) | 1417 | static int __devexit snd_miro_remove(struct device *devptr, unsigned int dev) |
1414 | { | 1418 | { |
1415 | snd_card_free(platform_get_drvdata(devptr)); | 1419 | snd_card_free(dev_get_drvdata(devptr)); |
1416 | platform_set_drvdata(devptr, NULL); | 1420 | dev_set_drvdata(devptr, NULL); |
1417 | return 0; | 1421 | return 0; |
1418 | } | 1422 | } |
1419 | 1423 | ||
1420 | static struct platform_driver snd_miro_driver = { | 1424 | #define DEV_NAME "miro" |
1425 | |||
1426 | static 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 */ |
1424 | .driver = { | 1431 | .driver = { |
1425 | .name = DRIVER_NAME | 1432 | .name = DEV_NAME |
1426 | }, | 1433 | }, |
1427 | }; | 1434 | }; |
1428 | 1435 | ||
1429 | static int __init alsa_card_miro_init(void) | 1436 | static 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 | ||
1448 | static void __exit alsa_card_miro_exit(void) | 1441 | static 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 | ||
1454 | module_init(alsa_card_miro_init) | 1446 | module_init(alsa_card_miro_init) |