Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 133202
b: refs/heads/master
c: 453e37b
h: refs/heads/master
v: v3
  • Loading branch information
Krzysztof Helt authored and Takashi Iwai committed Feb 4, 2009
1 parent 5607bd2 commit 3e123dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56305757f0b64b7d5dd02fd54c6dfc0989868f31
refs/heads/master: 453e37b37521b613f0927fcf53ccd93ad3a8b3ae
44 changes: 16 additions & 28 deletions trunk/sound/isa/sscape.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ enum card_type {
struct soundscape {
spinlock_t lock;
unsigned io_base;
unsigned wss_base;
int codec_type;
int ic_type;
enum card_type type;
struct resource *io_res;
Expand Down Expand Up @@ -726,13 +724,7 @@ static int sscape_midi_get(struct snd_kcontrol *kctl,
unsigned long flags;

spin_lock_irqsave(&s->lock, flags);
set_host_mode_unsafe(s->io_base);

if (host_write_ctrl_unsafe(s->io_base, CMD_GET_MIDI_VOL, 100)) {
uctl->value.integer.value[0] = host_read_ctrl_unsafe(s->io_base, 100);
}

set_midi_mode_unsafe(s->io_base);
uctl->value.integer.value[0] = s->midi_vol;
spin_unlock_irqrestore(&s->lock, flags);
return 0;
}
Expand Down Expand Up @@ -767,6 +759,7 @@ static int sscape_midi_put(struct snd_kcontrol *kctl,
change = (host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100)
&& host_write_ctrl_unsafe(s->io_base, ((unsigned char) uctl->value.integer. value[0]) & 127, 100)
&& host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100));
s->midi_vol = (unsigned char) uctl->value.integer.value[0] & 127;
__skip_change:

/*
Expand Down Expand Up @@ -809,12 +802,11 @@ static unsigned __devinit get_irq_config(int irq)
* Perform certain arcane port-checks to see whether there
* is a SoundScape board lurking behind the given ports.
*/
static int __devinit detect_sscape(struct soundscape *s)
static int __devinit detect_sscape(struct soundscape *s, long wss_io)
{
unsigned long flags;
unsigned d;
int retval = 0;
int codec = s->wss_base;

spin_lock_irqsave(&s->lock, flags);

Expand All @@ -830,13 +822,11 @@ static int __devinit detect_sscape(struct soundscape *s)
if ((d & 0x80) != 0)
goto _done;

if (d == 0) {
s->codec_type = 1;
if (d == 0)
s->ic_type = IC_ODIE;
} else if ((d & 0x60) != 0) {
s->codec_type = 2;
else if ((d & 0x60) != 0)
s->ic_type = IC_OPUS;
} else
else
goto _done;

outb(0xfa, ODIE_ADDR_IO(s->io_base));
Expand All @@ -856,10 +846,10 @@ static int __devinit detect_sscape(struct soundscape *s)
sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0);

if (s->type == SSCAPE_VIVO)
codec += 4;
wss_io += 4;
/* wait for WSS codec */
for (d = 0; d < 500; d++) {
if ((inb(codec) & 0x80) == 0)
if ((inb(wss_io) & 0x80) == 0)
break;
spin_unlock_irqrestore(&s->lock, flags);
msleep(1);
Expand Down Expand Up @@ -1057,7 +1047,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card)
unsigned dma_cfg;
unsigned irq_cfg;
unsigned mpu_irq_cfg;
unsigned xport;
struct resource *io_res;
struct resource *wss_res;
unsigned long flags;
Expand All @@ -1077,15 +1066,15 @@ static int __devinit create_sscape(int dev, struct snd_card *card)
printk(KERN_ERR "sscape: Invalid IRQ %d\n", mpu_irq[dev]);
return -ENXIO;
}
xport = port[dev];

/*
* Grab IO ports that we will need to probe so that we
* can detect and control this hardware ...
*/
io_res = request_region(xport, 8, "SoundScape");
io_res = request_region(port[dev], 8, "SoundScape");
if (!io_res) {
snd_printk(KERN_ERR "sscape: can't grab port 0x%x\n", xport);
snd_printk(KERN_ERR
"sscape: can't grab port 0x%lx\n", port[dev]);
return -EBUSY;
}
wss_res = NULL;
Expand All @@ -1112,10 +1101,9 @@ static int __devinit create_sscape(int dev, struct snd_card *card)
spin_lock_init(&sscape->fwlock);
sscape->io_res = io_res;
sscape->wss_res = wss_res;
sscape->io_base = xport;
sscape->wss_base = wss_port[dev];
sscape->io_base = port[dev];

if (!detect_sscape(sscape)) {
if (!detect_sscape(sscape, wss_port[dev])) {
printk(KERN_ERR "sscape: hardware not detected at 0x%x\n", sscape->io_base);
err = -ENODEV;
goto _release_dma;
Expand Down Expand Up @@ -1188,11 +1176,11 @@ static int __devinit create_sscape(int dev, struct snd_card *card)
}
#define MIDI_DEVNUM 0
if (sscape->type != SSCAPE_VIVO) {
err = create_mpu401(card, MIDI_DEVNUM, xport, mpu_irq[dev]);
err = create_mpu401(card, MIDI_DEVNUM, port[dev], mpu_irq[dev]);
if (err < 0) {
printk(KERN_ERR "sscape: Failed to create "
"MPU-401 device at 0x%x\n",
xport);
"MPU-401 device at 0x%lx\n",
port[dev]);
goto _release_dma;
}

Expand Down

0 comments on commit 3e123dd

Please sign in to comment.