diff options
-rw-r--r-- | sound/isa/sscape.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 681e2237acb7..33c1258029f9 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -135,8 +135,6 @@ enum card_type { | |||
135 | struct soundscape { | 135 | struct soundscape { |
136 | spinlock_t lock; | 136 | spinlock_t lock; |
137 | unsigned io_base; | 137 | unsigned io_base; |
138 | unsigned wss_base; | ||
139 | int codec_type; | ||
140 | int ic_type; | 138 | int ic_type; |
141 | enum card_type type; | 139 | enum card_type type; |
142 | struct resource *io_res; | 140 | struct resource *io_res; |
@@ -726,13 +724,7 @@ static int sscape_midi_get(struct snd_kcontrol *kctl, | |||
726 | unsigned long flags; | 724 | unsigned long flags; |
727 | 725 | ||
728 | spin_lock_irqsave(&s->lock, flags); | 726 | spin_lock_irqsave(&s->lock, flags); |
729 | set_host_mode_unsafe(s->io_base); | 727 | uctl->value.integer.value[0] = s->midi_vol; |
730 | |||
731 | if (host_write_ctrl_unsafe(s->io_base, CMD_GET_MIDI_VOL, 100)) { | ||
732 | uctl->value.integer.value[0] = host_read_ctrl_unsafe(s->io_base, 100); | ||
733 | } | ||
734 | |||
735 | set_midi_mode_unsafe(s->io_base); | ||
736 | spin_unlock_irqrestore(&s->lock, flags); | 728 | spin_unlock_irqrestore(&s->lock, flags); |
737 | return 0; | 729 | return 0; |
738 | } | 730 | } |
@@ -767,6 +759,7 @@ static int sscape_midi_put(struct snd_kcontrol *kctl, | |||
767 | change = (host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) | 759 | change = (host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) |
768 | && host_write_ctrl_unsafe(s->io_base, ((unsigned char) uctl->value.integer. value[0]) & 127, 100) | 760 | && host_write_ctrl_unsafe(s->io_base, ((unsigned char) uctl->value.integer. value[0]) & 127, 100) |
769 | && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100)); | 761 | && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100)); |
762 | s->midi_vol = (unsigned char) uctl->value.integer.value[0] & 127; | ||
770 | __skip_change: | 763 | __skip_change: |
771 | 764 | ||
772 | /* | 765 | /* |
@@ -809,12 +802,11 @@ static unsigned __devinit get_irq_config(int irq) | |||
809 | * Perform certain arcane port-checks to see whether there | 802 | * Perform certain arcane port-checks to see whether there |
810 | * is a SoundScape board lurking behind the given ports. | 803 | * is a SoundScape board lurking behind the given ports. |
811 | */ | 804 | */ |
812 | static int __devinit detect_sscape(struct soundscape *s) | 805 | static int __devinit detect_sscape(struct soundscape *s, long wss_io) |
813 | { | 806 | { |
814 | unsigned long flags; | 807 | unsigned long flags; |
815 | unsigned d; | 808 | unsigned d; |
816 | int retval = 0; | 809 | int retval = 0; |
817 | int codec = s->wss_base; | ||
818 | 810 | ||
819 | spin_lock_irqsave(&s->lock, flags); | 811 | spin_lock_irqsave(&s->lock, flags); |
820 | 812 | ||
@@ -830,13 +822,11 @@ static int __devinit detect_sscape(struct soundscape *s) | |||
830 | if ((d & 0x80) != 0) | 822 | if ((d & 0x80) != 0) |
831 | goto _done; | 823 | goto _done; |
832 | 824 | ||
833 | if (d == 0) { | 825 | if (d == 0) |
834 | s->codec_type = 1; | ||
835 | s->ic_type = IC_ODIE; | 826 | s->ic_type = IC_ODIE; |
836 | } else if ((d & 0x60) != 0) { | 827 | else if ((d & 0x60) != 0) |
837 | s->codec_type = 2; | ||
838 | s->ic_type = IC_OPUS; | 828 | s->ic_type = IC_OPUS; |
839 | } else | 829 | else |
840 | goto _done; | 830 | goto _done; |
841 | 831 | ||
842 | outb(0xfa, ODIE_ADDR_IO(s->io_base)); | 832 | outb(0xfa, ODIE_ADDR_IO(s->io_base)); |
@@ -856,10 +846,10 @@ static int __devinit detect_sscape(struct soundscape *s) | |||
856 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); | 846 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); |
857 | 847 | ||
858 | if (s->type == SSCAPE_VIVO) | 848 | if (s->type == SSCAPE_VIVO) |
859 | codec += 4; | 849 | wss_io += 4; |
860 | /* wait for WSS codec */ | 850 | /* wait for WSS codec */ |
861 | for (d = 0; d < 500; d++) { | 851 | for (d = 0; d < 500; d++) { |
862 | if ((inb(codec) & 0x80) == 0) | 852 | if ((inb(wss_io) & 0x80) == 0) |
863 | break; | 853 | break; |
864 | spin_unlock_irqrestore(&s->lock, flags); | 854 | spin_unlock_irqrestore(&s->lock, flags); |
865 | msleep(1); | 855 | msleep(1); |
@@ -1057,7 +1047,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1057 | unsigned dma_cfg; | 1047 | unsigned dma_cfg; |
1058 | unsigned irq_cfg; | 1048 | unsigned irq_cfg; |
1059 | unsigned mpu_irq_cfg; | 1049 | unsigned mpu_irq_cfg; |
1060 | unsigned xport; | ||
1061 | struct resource *io_res; | 1050 | struct resource *io_res; |
1062 | struct resource *wss_res; | 1051 | struct resource *wss_res; |
1063 | unsigned long flags; | 1052 | unsigned long flags; |
@@ -1077,15 +1066,15 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1077 | printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); | 1066 | printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]); |
1078 | return -ENXIO; | 1067 | return -ENXIO; |
1079 | } | 1068 | } |
1080 | xport = port[dev]; | ||
1081 | 1069 | ||
1082 | /* | 1070 | /* |
1083 | * Grab IO ports that we will need to probe so that we | 1071 | * Grab IO ports that we will need to probe so that we |
1084 | * can detect and control this hardware ... | 1072 | * can detect and control this hardware ... |
1085 | */ | 1073 | */ |
1086 | io_res = request_region(xport, 8, "SoundScape"); | 1074 | io_res = request_region(port[dev], 8, "SoundScape"); |
1087 | if (!io_res) { | 1075 | if (!io_res) { |
1088 | snd_printk(KERN_ERR "sscape: can't grab port 0x%x\n", xport); | 1076 | snd_printk(KERN_ERR |
1077 | "sscape: can't grab port 0x%lx\n", port[dev]); | ||
1089 | return -EBUSY; | 1078 | return -EBUSY; |
1090 | } | 1079 | } |
1091 | wss_res = NULL; | 1080 | wss_res = NULL; |
@@ -1112,10 +1101,9 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1112 | spin_lock_init(&sscape->fwlock); | 1101 | spin_lock_init(&sscape->fwlock); |
1113 | sscape->io_res = io_res; | 1102 | sscape->io_res = io_res; |
1114 | sscape->wss_res = wss_res; | 1103 | sscape->wss_res = wss_res; |
1115 | sscape->io_base = xport; | 1104 | sscape->io_base = port[dev]; |
1116 | sscape->wss_base = wss_port[dev]; | ||
1117 | 1105 | ||
1118 | if (!detect_sscape(sscape)) { | 1106 | if (!detect_sscape(sscape, wss_port[dev])) { |
1119 | printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", sscape->io_base); | 1107 | printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", sscape->io_base); |
1120 | err = -ENODEV; | 1108 | err = -ENODEV; |
1121 | goto _release_dma; | 1109 | goto _release_dma; |
@@ -1188,11 +1176,11 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1188 | } | 1176 | } |
1189 | #define MIDI_DEVNUM 0 | 1177 | #define MIDI_DEVNUM 0 |
1190 | if (sscape->type != SSCAPE_VIVO) { | 1178 | if (sscape->type != SSCAPE_VIVO) { |
1191 | err = create_mpu401(card, MIDI_DEVNUM, xport, mpu_irq[dev]); | 1179 | err = create_mpu401(card, MIDI_DEVNUM, port[dev], mpu_irq[dev]); |
1192 | if (err < 0) { | 1180 | if (err < 0) { |
1193 | printk(KERN_ERR "sscape: Failed to create " | 1181 | printk(KERN_ERR "sscape: Failed to create " |
1194 | "MPU-401 device at 0x%x\n", | 1182 | "MPU-401 device at 0x%lx\n", |
1195 | xport); | 1183 | port[dev]); |
1196 | goto _release_dma; | 1184 | goto _release_dma; |
1197 | } | 1185 | } |
1198 | 1186 | ||