diff options
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/opti9xx/miro.c | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 17761030affa..db4a4fbdc5ca 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -110,7 +110,6 @@ struct snd_miro { | |||
110 | unsigned long pwd_reg; | 110 | unsigned long pwd_reg; |
111 | 111 | ||
112 | spinlock_t lock; | 112 | spinlock_t lock; |
113 | struct snd_card *card; | ||
114 | struct snd_pcm *pcm; | 113 | struct snd_pcm *pcm; |
115 | 114 | ||
116 | long wss_base; | 115 | long wss_base; |
@@ -132,8 +131,6 @@ struct snd_miro { | |||
132 | struct mutex aci_mutex; | 131 | struct mutex aci_mutex; |
133 | }; | 132 | }; |
134 | 133 | ||
135 | static void snd_miro_proc_init(struct snd_miro * miro); | ||
136 | |||
137 | static char * snd_opti9xx_names[] = { | 134 | static char * snd_opti9xx_names[] = { |
138 | "unkown", | 135 | "unkown", |
139 | "82C928", "82C929", | 136 | "82C928", "82C929", |
@@ -457,11 +454,9 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol, | |||
457 | right = ucontrol->value.integer.value[1]; | 454 | right = ucontrol->value.integer.value[1]; |
458 | 455 | ||
459 | setreg_right = (kcontrol->private_value >> 8) & 0xff; | 456 | setreg_right = (kcontrol->private_value >> 8) & 0xff; |
460 | if (setreg_right == ACI_SET_MASTER) { | 457 | setreg_left = setreg_right + 8; |
461 | setreg_left = setreg_right + 1; | 458 | if (setreg_right == ACI_SET_MASTER) |
462 | } else { | 459 | setreg_left -= 7; |
463 | setreg_left = setreg_right + 8; | ||
464 | } | ||
465 | 460 | ||
466 | getreg_right = kcontrol->private_value & 0xff; | 461 | getreg_right = kcontrol->private_value & 0xff; |
467 | getreg_left = getreg_right + 1; | 462 | getreg_left = getreg_right + 1; |
@@ -667,17 +662,15 @@ static int __devinit snd_set_aci_init_values(struct snd_miro *miro) | |||
667 | return 0; | 662 | return 0; |
668 | } | 663 | } |
669 | 664 | ||
670 | static int __devinit snd_miro_mixer(struct snd_miro *miro) | 665 | static int __devinit snd_miro_mixer(struct snd_card *card, |
666 | struct snd_miro *miro) | ||
671 | { | 667 | { |
672 | struct snd_card *card; | ||
673 | unsigned int idx; | 668 | unsigned int idx; |
674 | int err; | 669 | int err; |
675 | 670 | ||
676 | if (snd_BUG_ON(!miro || !miro->card)) | 671 | if (snd_BUG_ON(!miro || !card)) |
677 | return -EINVAL; | 672 | return -EINVAL; |
678 | 673 | ||
679 | card = miro->card; | ||
680 | |||
681 | switch (miro->hardware) { | 674 | switch (miro->hardware) { |
682 | case OPTi9XX_HW_82C924: | 675 | case OPTi9XX_HW_82C924: |
683 | strcpy(card->mixername, "ACI & OPTi924"); | 676 | strcpy(card->mixername, "ACI & OPTi924"); |
@@ -950,11 +943,12 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, | |||
950 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); | 943 | snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp); |
951 | } | 944 | } |
952 | 945 | ||
953 | static void __devinit snd_miro_proc_init(struct snd_miro * miro) | 946 | static void __devinit snd_miro_proc_init(struct snd_card *card, |
947 | struct snd_miro *miro) | ||
954 | { | 948 | { |
955 | struct snd_info_entry *entry; | 949 | struct snd_info_entry *entry; |
956 | 950 | ||
957 | if (! snd_card_proc_new(miro->card, "miro", &entry)) | 951 | if (!snd_card_proc_new(card, "miro", &entry)) |
958 | snd_info_set_text_ops(entry, miro, snd_miro_proc_read); | 952 | snd_info_set_text_ops(entry, miro, snd_miro_proc_read); |
959 | } | 953 | } |
960 | 954 | ||
@@ -971,20 +965,18 @@ static int __devinit snd_miro_configure(struct snd_miro *chip) | |||
971 | unsigned char mpu_irq_bits; | 965 | unsigned char mpu_irq_bits; |
972 | unsigned long flags; | 966 | unsigned long flags; |
973 | 967 | ||
968 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | ||
969 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */ | ||
970 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | ||
971 | |||
974 | switch (chip->hardware) { | 972 | switch (chip->hardware) { |
975 | case OPTi9XX_HW_82C924: | 973 | case OPTi9XX_HW_82C924: |
976 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); | 974 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); |
977 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | ||
978 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */ | ||
979 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); | 975 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff); |
980 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | ||
981 | break; | 976 | break; |
982 | case OPTi9XX_HW_82C929: | 977 | case OPTi9XX_HW_82C929: |
983 | /* untested init commands for OPTi929 */ | 978 | /* untested init commands for OPTi929 */ |
984 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80); | ||
985 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */ | ||
986 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(4), 0x00, 0x0c); | 979 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(4), 0x00, 0x0c); |
987 | snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02); | ||
988 | break; | 980 | break; |
989 | default: | 981 | default: |
990 | snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); | 982 | snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware); |
@@ -1156,7 +1148,6 @@ static int __devinit snd_card_miro_aci_detect(struct snd_card *card, | |||
1156 | 1148 | ||
1157 | /* get ACI port from OPTi9xx MC 4 */ | 1149 | /* get ACI port from OPTi9xx MC 4 */ |
1158 | 1150 | ||
1159 | miro->mc_base = 0xf8c; | ||
1160 | regval=inb(miro->mc_base + 4); | 1151 | regval=inb(miro->mc_base + 4); |
1161 | miro->aci_port = (regval & 0x10) ? 0x344: 0x354; | 1152 | miro->aci_port = (regval & 0x10) ? 0x344: 0x354; |
1162 | 1153 | ||
@@ -1232,7 +1223,13 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1232 | 1223 | ||
1233 | card->private_free = snd_card_miro_free; | 1224 | card->private_free = snd_card_miro_free; |
1234 | miro = card->private_data; | 1225 | miro = card->private_data; |
1235 | miro->card = card; | 1226 | |
1227 | error = snd_card_miro_detect(card, miro); | ||
1228 | if (error < 0) { | ||
1229 | snd_card_free(card); | ||
1230 | snd_printk(KERN_ERR "unable to detect OPTi9xx chip\n"); | ||
1231 | return -ENODEV; | ||
1232 | } | ||
1236 | 1233 | ||
1237 | if ((error = snd_card_miro_aci_detect(card, miro)) < 0) { | 1234 | if ((error = snd_card_miro_aci_detect(card, miro)) < 0) { |
1238 | snd_card_free(card); | 1235 | snd_card_free(card); |
@@ -1241,13 +1238,8 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1241 | } | 1238 | } |
1242 | 1239 | ||
1243 | /* init proc interface */ | 1240 | /* init proc interface */ |
1244 | snd_miro_proc_init(miro); | 1241 | snd_miro_proc_init(card, miro); |
1245 | 1242 | ||
1246 | if ((error = snd_card_miro_detect(card, miro)) < 0) { | ||
1247 | snd_card_free(card); | ||
1248 | snd_printk(KERN_ERR "unable to detect OPTi9xx chip\n"); | ||
1249 | return -ENODEV; | ||
1250 | } | ||
1251 | 1243 | ||
1252 | if (! miro->res_mc_base && | 1244 | if (! miro->res_mc_base && |
1253 | (miro->res_mc_base = request_region(miro->mc_base, miro->mc_base_size, | 1245 | (miro->res_mc_base = request_region(miro->mc_base, miro->mc_base_size, |
@@ -1341,7 +1333,8 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n) | |||
1341 | 1333 | ||
1342 | miro->pcm = pcm; | 1334 | miro->pcm = pcm; |
1343 | 1335 | ||
1344 | if ((error = snd_miro_mixer(miro)) < 0) { | 1336 | error = snd_miro_mixer(card, miro); |
1337 | if (error < 0) { | ||
1345 | snd_card_free(card); | 1338 | snd_card_free(card); |
1346 | return error; | 1339 | return error; |
1347 | } | 1340 | } |