diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-02-22 06:50:54 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-05-11 10:55:40 -0400 |
commit | 5e24c1c1c496c4603395d6e9cc320f85008fc891 (patch) | |
tree | 3bc2d3797f632d99c7f31a49346d4e77b56520aa /sound/isa/opti9xx/miro.c | |
parent | 442f4f36bed8bcadcbda299c615c12fae95eda99 (diff) |
[ALSA] Port the rest of ALSA ISA drivers to isa_driver
Port the rest of ALSA ISA drivers to use isa_driver framework
instead of platform_driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/isa/opti9xx/miro.c')
-rw-r--r-- | sound/isa/opti9xx/miro.c | 74 |
1 files changed, 33 insertions, 41 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 | ||
142 | static struct platform_device *device; | ||
143 | |||
144 | static char * snd_opti9xx_names[] = { | 142 | static 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 | ||
561 | static struct snd_kcontrol_new snd_miro_controls[] = { | 559 | static struct snd_kcontrol_new snd_miro_controls[] __devinitdata = { |
562 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), | 560 | 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), | 561 | 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), | 562 | MIRO_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 */ |
573 | static struct snd_kcontrol_new snd_miro_eq_controls[] = { | 571 | static struct snd_kcontrol_new snd_miro_eq_controls[] __devinitdata = { |
574 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), | 572 | 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), | 573 | 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), | 574 | MIRO_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), | |||
580 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), | 578 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), |
581 | }; | 579 | }; |
582 | 580 | ||
583 | static struct snd_kcontrol_new snd_miro_radio_control[] = { | 581 | static struct snd_kcontrol_new snd_miro_radio_control[] __devinitdata = { |
584 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), | 582 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), |
585 | }; | 583 | }; |
586 | 584 | ||
587 | static struct snd_kcontrol_new snd_miro_line_control[] = { | 585 | static struct snd_kcontrol_new snd_miro_line_control[] __devinitdata = { |
588 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), | 586 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), |
589 | }; | 587 | }; |
590 | 588 | ||
591 | static struct snd_kcontrol_new snd_miro_preamp_control[] = { | 589 | static 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 | ||
601 | static struct snd_kcontrol_new snd_miro_amp_control[] = { | 599 | static 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 | ||
611 | static struct snd_kcontrol_new snd_miro_capture_control[] = { | 609 | static 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 | ||
621 | static unsigned char aci_init_values[][2] __initdata = { | 619 | static 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 | ||
644 | static int __init snd_set_aci_init_values(struct snd_miro *miro) | 642 | static 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 | ||
754 | static int __init snd_miro_init(struct snd_miro *chip, unsigned short hardware) | 752 | static 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 | ||
965 | static void __init snd_miro_proc_init(struct snd_miro * miro) | 964 | static 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 | ||
977 | static int __init snd_miro_configure(struct snd_miro *chip) | 976 | static 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 | ||
1134 | static int __init snd_card_miro_detect(struct snd_card *card, struct snd_miro *chip) | 1133 | static 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 | ||
1160 | static int __init snd_card_miro_aci_detect(struct snd_card *card, struct snd_miro * miro) | 1160 | static 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 | ||
1216 | static int __init snd_miro_probe(struct platform_device *devptr) | 1217 | static int __devinit snd_miro_match(struct device *devptr, unsigned int n) |
1218 | { | ||
1219 | return 1; | ||
1220 | } | ||
1221 | |||
1222 | static 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 | ||
1413 | static int __devexit snd_miro_remove(struct platform_device *devptr) | 1419 | static 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 | ||
1420 | static struct platform_driver snd_miro_driver = { | 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 */ |
@@ -1428,27 +1435,12 @@ static struct platform_driver snd_miro_driver = { | |||
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) |