diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2009-10-10 04:27:58 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-10-10 04:54:52 -0400 |
commit | 6fcfa3959a5f5ecb7c333f54f401575d94eb8172 (patch) | |
tree | 669255d8a637ca7957adfd3ffce7f7530d1ca09b | |
parent | ed76f652d5329d9dff0ea7f3953b1357ed7f8e6e (diff) |
ALSA: sscape: coding style fixes
Fix coding style errors in the driver.
Also, add missing argument for CMD_XXX_MIDI_VOL command.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/isa/sscape.c | 169 |
1 files changed, 83 insertions, 86 deletions
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 579a59b9e470..e2d5d2d3ed96 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -109,14 +109,14 @@ MODULE_DEVICE_TABLE(pnp_card, sscape_pnpids); | |||
109 | #define RX_READY 0x01 | 109 | #define RX_READY 0x01 |
110 | #define TX_READY 0x02 | 110 | #define TX_READY 0x02 |
111 | 111 | ||
112 | #define CMD_ACK 0x80 | 112 | #define CMD_ACK 0x80 |
113 | #define CMD_SET_MIDI_VOL 0x84 | 113 | #define CMD_SET_MIDI_VOL 0x84 |
114 | #define CMD_GET_MIDI_VOL 0x85 | 114 | #define CMD_GET_MIDI_VOL 0x85 |
115 | #define CMD_XXX_MIDI_VOL 0x86 | 115 | #define CMD_XXX_MIDI_VOL 0x86 |
116 | #define CMD_SET_EXTMIDI 0x8a | 116 | #define CMD_SET_EXTMIDI 0x8a |
117 | #define CMD_GET_EXTMIDI 0x8b | 117 | #define CMD_GET_EXTMIDI 0x8b |
118 | #define CMD_SET_MT32 0x8c | 118 | #define CMD_SET_MT32 0x8c |
119 | #define CMD_GET_MT32 0x8d | 119 | #define CMD_GET_MT32 0x8d |
120 | 120 | ||
121 | enum GA_REG { | 121 | enum GA_REG { |
122 | GA_INTSTAT_REG = 0, | 122 | GA_INTSTAT_REG = 0, |
@@ -166,10 +166,12 @@ static inline struct soundscape *get_card_soundscape(struct snd_card *c) | |||
166 | * I think this means that the memory has to map to | 166 | * I think this means that the memory has to map to |
167 | * contiguous pages of physical memory. | 167 | * contiguous pages of physical memory. |
168 | */ | 168 | */ |
169 | static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, unsigned long size) | 169 | static struct snd_dma_buffer *get_dmabuf(struct snd_dma_buffer *buf, |
170 | unsigned long size) | ||
170 | { | 171 | { |
171 | if (buf) { | 172 | if (buf) { |
172 | if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(), | 173 | if (snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV, |
174 | snd_dma_isa_data(), | ||
173 | size, buf) < 0) { | 175 | size, buf) < 0) { |
174 | snd_printk(KERN_ERR "sscape: Failed to allocate " | 176 | snd_printk(KERN_ERR "sscape: Failed to allocate " |
175 | "%lu bytes for DMA\n", | 177 | "%lu bytes for DMA\n", |
@@ -190,13 +192,13 @@ static void free_dmabuf(struct snd_dma_buffer *buf) | |||
190 | snd_dma_free_pages(buf); | 192 | snd_dma_free_pages(buf); |
191 | } | 193 | } |
192 | 194 | ||
193 | |||
194 | /* | 195 | /* |
195 | * This function writes to the SoundScape's control registers, | 196 | * This function writes to the SoundScape's control registers, |
196 | * but doesn't do any locking. It's up to the caller to do that. | 197 | * but doesn't do any locking. It's up to the caller to do that. |
197 | * This is why this function is "unsafe" ... | 198 | * This is why this function is "unsafe" ... |
198 | */ | 199 | */ |
199 | static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsigned char val) | 200 | static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, |
201 | unsigned char val) | ||
200 | { | 202 | { |
201 | outb(reg, ODIE_ADDR_IO(io_base)); | 203 | outb(reg, ODIE_ADDR_IO(io_base)); |
202 | outb(val, ODIE_DATA_IO(io_base)); | 204 | outb(val, ODIE_DATA_IO(io_base)); |
@@ -206,7 +208,8 @@ static inline void sscape_write_unsafe(unsigned io_base, enum GA_REG reg, unsign | |||
206 | * Write to the SoundScape's control registers, and do the | 208 | * Write to the SoundScape's control registers, and do the |
207 | * necessary locking ... | 209 | * necessary locking ... |
208 | */ | 210 | */ |
209 | static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char val) | 211 | static void sscape_write(struct soundscape *s, enum GA_REG reg, |
212 | unsigned char val) | ||
210 | { | 213 | { |
211 | unsigned long flags; | 214 | unsigned long flags; |
212 | 215 | ||
@@ -219,7 +222,8 @@ static void sscape_write(struct soundscape *s, enum GA_REG reg, unsigned char va | |||
219 | * Read from the SoundScape's control registers, but leave any | 222 | * Read from the SoundScape's control registers, but leave any |
220 | * locking to the caller. This is why the function is "unsafe" ... | 223 | * locking to the caller. This is why the function is "unsafe" ... |
221 | */ | 224 | */ |
222 | static inline unsigned char sscape_read_unsafe(unsigned io_base, enum GA_REG reg) | 225 | static inline unsigned char sscape_read_unsafe(unsigned io_base, |
226 | enum GA_REG reg) | ||
223 | { | 227 | { |
224 | outb(reg, ODIE_ADDR_IO(io_base)); | 228 | outb(reg, ODIE_ADDR_IO(io_base)); |
225 | return inb(ODIE_DATA_IO(io_base)); | 229 | return inb(ODIE_DATA_IO(io_base)); |
@@ -248,9 +252,8 @@ static inline void set_midi_mode_unsafe(unsigned io_base) | |||
248 | static inline int host_read_unsafe(unsigned io_base) | 252 | static inline int host_read_unsafe(unsigned io_base) |
249 | { | 253 | { |
250 | int data = -1; | 254 | int data = -1; |
251 | if ((inb(HOST_CTRL_IO(io_base)) & RX_READY) != 0) { | 255 | if ((inb(HOST_CTRL_IO(io_base)) & RX_READY) != 0) |
252 | data = inb(HOST_DATA_IO(io_base)); | 256 | data = inb(HOST_DATA_IO(io_base)); |
253 | } | ||
254 | 257 | ||
255 | return data; | 258 | return data; |
256 | } | 259 | } |
@@ -292,7 +295,7 @@ static inline int host_write_unsafe(unsigned io_base, unsigned char data) | |||
292 | * Also leaves all locking-issues to the caller ... | 295 | * Also leaves all locking-issues to the caller ... |
293 | */ | 296 | */ |
294 | static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, | 297 | static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, |
295 | unsigned timeout) | 298 | unsigned timeout) |
296 | { | 299 | { |
297 | int err; | 300 | int err; |
298 | 301 | ||
@@ -311,7 +314,7 @@ static int host_write_ctrl_unsafe(unsigned io_base, unsigned char data, | |||
311 | * | 314 | * |
312 | * NOTE: This check is based upon observation, not documentation. | 315 | * NOTE: This check is based upon observation, not documentation. |
313 | */ | 316 | */ |
314 | static inline int verify_mpu401(const struct snd_mpu401 * mpu) | 317 | static inline int verify_mpu401(const struct snd_mpu401 *mpu) |
315 | { | 318 | { |
316 | return ((inb(MPU401C(mpu)) & 0xc0) == 0x80); | 319 | return ((inb(MPU401C(mpu)) & 0xc0) == 0x80); |
317 | } | 320 | } |
@@ -319,7 +322,7 @@ static inline int verify_mpu401(const struct snd_mpu401 * mpu) | |||
319 | /* | 322 | /* |
320 | * This is apparently the standard way to initailise an MPU-401 | 323 | * This is apparently the standard way to initailise an MPU-401 |
321 | */ | 324 | */ |
322 | static inline void initialise_mpu401(const struct snd_mpu401 * mpu) | 325 | static inline void initialise_mpu401(const struct snd_mpu401 *mpu) |
323 | { | 326 | { |
324 | outb(0, MPU401D(mpu)); | 327 | outb(0, MPU401D(mpu)); |
325 | } | 328 | } |
@@ -329,9 +332,10 @@ static inline void initialise_mpu401(const struct snd_mpu401 * mpu) | |||
329 | * The AD1845 detection fails if we *don't* do this, so I | 332 | * The AD1845 detection fails if we *don't* do this, so I |
330 | * think that this is a good idea ... | 333 | * think that this is a good idea ... |
331 | */ | 334 | */ |
332 | static inline void activate_ad1845_unsafe(unsigned io_base) | 335 | static void activate_ad1845_unsafe(unsigned io_base) |
333 | { | 336 | { |
334 | sscape_write_unsafe(io_base, GA_HMCTL_REG, (sscape_read_unsafe(io_base, GA_HMCTL_REG) & 0xcf) | 0x10); | 337 | unsigned char val = sscape_read_unsafe(io_base, GA_HMCTL_REG); |
338 | sscape_write_unsafe(io_base, GA_HMCTL_REG, (val & 0xcf) | 0x10); | ||
335 | sscape_write_unsafe(io_base, GA_CDCFG_REG, 0x80); | 339 | sscape_write_unsafe(io_base, GA_CDCFG_REG, 0x80); |
336 | } | 340 | } |
337 | 341 | ||
@@ -350,24 +354,27 @@ static void soundscape_free(struct snd_card *c) | |||
350 | * Tell the SoundScape to begin a DMA tranfer using the given channel. | 354 | * Tell the SoundScape to begin a DMA tranfer using the given channel. |
351 | * All locking issues are left to the caller. | 355 | * All locking issues are left to the caller. |
352 | */ | 356 | */ |
353 | static inline void sscape_start_dma_unsafe(unsigned io_base, enum GA_REG reg) | 357 | static void sscape_start_dma_unsafe(unsigned io_base, enum GA_REG reg) |
354 | { | 358 | { |
355 | sscape_write_unsafe(io_base, reg, sscape_read_unsafe(io_base, reg) | 0x01); | 359 | sscape_write_unsafe(io_base, reg, |
356 | sscape_write_unsafe(io_base, reg, sscape_read_unsafe(io_base, reg) & 0xfe); | 360 | sscape_read_unsafe(io_base, reg) | 0x01); |
361 | sscape_write_unsafe(io_base, reg, | ||
362 | sscape_read_unsafe(io_base, reg) & 0xfe); | ||
357 | } | 363 | } |
358 | 364 | ||
359 | /* | 365 | /* |
360 | * Wait for a DMA transfer to complete. This is a "limited busy-wait", | 366 | * Wait for a DMA transfer to complete. This is a "limited busy-wait", |
361 | * and all locking issues are left to the caller. | 367 | * and all locking issues are left to the caller. |
362 | */ | 368 | */ |
363 | static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, unsigned timeout) | 369 | static int sscape_wait_dma_unsafe(unsigned io_base, enum GA_REG reg, |
370 | unsigned timeout) | ||
364 | { | 371 | { |
365 | while (!(sscape_read_unsafe(io_base, reg) & 0x01) && (timeout != 0)) { | 372 | while (!(sscape_read_unsafe(io_base, reg) & 0x01) && (timeout != 0)) { |
366 | udelay(100); | 373 | udelay(100); |
367 | --timeout; | 374 | --timeout; |
368 | } /* while */ | 375 | } /* while */ |
369 | 376 | ||
370 | return (sscape_read_unsafe(io_base, reg) & 0x01); | 377 | return sscape_read_unsafe(io_base, reg) & 0x01; |
371 | } | 378 | } |
372 | 379 | ||
373 | /* | 380 | /* |
@@ -427,13 +434,13 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) | |||
427 | /* | 434 | /* |
428 | * Upload a byte-stream into the SoundScape using DMA channel A. | 435 | * Upload a byte-stream into the SoundScape using DMA channel A. |
429 | */ | 436 | */ |
430 | static int upload_dma_data(struct soundscape *s, | 437 | static int upload_dma_data(struct soundscape *s, const unsigned char *data, |
431 | const unsigned char *data, | 438 | size_t size) |
432 | size_t size) | ||
433 | { | 439 | { |
434 | unsigned long flags; | 440 | unsigned long flags; |
435 | struct snd_dma_buffer dma; | 441 | struct snd_dma_buffer dma; |
436 | int ret; | 442 | int ret; |
443 | unsigned char val; | ||
437 | 444 | ||
438 | if (!get_dmabuf(&dma, PAGE_ALIGN(32 * 1024))) | 445 | if (!get_dmabuf(&dma, PAGE_ALIGN(32 * 1024))) |
439 | return -ENOMEM; | 446 | return -ENOMEM; |
@@ -443,18 +450,21 @@ static int upload_dma_data(struct soundscape *s, | |||
443 | /* | 450 | /* |
444 | * Reset the board ... | 451 | * Reset the board ... |
445 | */ | 452 | */ |
446 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f); | 453 | val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
454 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val & 0x3f); | ||
447 | 455 | ||
448 | /* | 456 | /* |
449 | * Enable the DMA channels and configure them ... | 457 | * Enable the DMA channels and configure them ... |
450 | */ | 458 | */ |
451 | sscape_write_unsafe(s->io_base, GA_DMAA_REG, (s->chip->dma1 << 4) | DMA_8BIT); | 459 | val = (s->chip->dma1 << 4) | DMA_8BIT; |
460 | sscape_write_unsafe(s->io_base, GA_DMAA_REG, val); | ||
452 | sscape_write_unsafe(s->io_base, GA_DMAB_REG, 0x20); | 461 | sscape_write_unsafe(s->io_base, GA_DMAB_REG, 0x20); |
453 | 462 | ||
454 | /* | 463 | /* |
455 | * Take the board out of reset ... | 464 | * Take the board out of reset ... |
456 | */ | 465 | */ |
457 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) | 0x80); | 466 | val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
467 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val | 0x80); | ||
458 | 468 | ||
459 | /* | 469 | /* |
460 | * Upload the firmware to the SoundScape | 470 | * Upload the firmware to the SoundScape |
@@ -472,7 +482,7 @@ static int upload_dma_data(struct soundscape *s, | |||
472 | sscape_start_dma_unsafe(s->io_base, GA_DMAA_REG); | 482 | sscape_start_dma_unsafe(s->io_base, GA_DMAA_REG); |
473 | if (!sscape_wait_dma_unsafe(s->io_base, GA_DMAA_REG, 5000)) { | 483 | if (!sscape_wait_dma_unsafe(s->io_base, GA_DMAA_REG, 5000)) { |
474 | /* | 484 | /* |
475 | * Don't forget to release this spinlock we're holding ... | 485 | * Don't forget to release this spinlock we're holding |
476 | */ | 486 | */ |
477 | spin_unlock_irqrestore(&s->lock, flags); | 487 | spin_unlock_irqrestore(&s->lock, flags); |
478 | 488 | ||
@@ -489,7 +499,8 @@ static int upload_dma_data(struct soundscape *s, | |||
489 | /* | 499 | /* |
490 | * Boot the board ... (I think) | 500 | * Boot the board ... (I think) |
491 | */ | 501 | */ |
492 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, sscape_read_unsafe(s->io_base, GA_HMCTL_REG) | 0x40); | 502 | val = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
503 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, val | 0x40); | ||
493 | spin_unlock_irqrestore(&s->lock, flags); | 504 | spin_unlock_irqrestore(&s->lock, flags); |
494 | 505 | ||
495 | /* | 506 | /* |
@@ -591,7 +602,7 @@ static int sscape_upload_microcode(struct snd_card *card, int version) | |||
591 | * Mixer control for the SoundScape's MIDI device. | 602 | * Mixer control for the SoundScape's MIDI device. |
592 | */ | 603 | */ |
593 | static int sscape_midi_info(struct snd_kcontrol *ctl, | 604 | static int sscape_midi_info(struct snd_kcontrol *ctl, |
594 | struct snd_ctl_elem_info *uinfo) | 605 | struct snd_ctl_elem_info *uinfo) |
595 | { | 606 | { |
596 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 607 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
597 | uinfo->count = 1; | 608 | uinfo->count = 1; |
@@ -601,7 +612,7 @@ static int sscape_midi_info(struct snd_kcontrol *ctl, | |||
601 | } | 612 | } |
602 | 613 | ||
603 | static int sscape_midi_get(struct snd_kcontrol *kctl, | 614 | static int sscape_midi_get(struct snd_kcontrol *kctl, |
604 | struct snd_ctl_elem_value *uctl) | 615 | struct snd_ctl_elem_value *uctl) |
605 | { | 616 | { |
606 | struct snd_wss *chip = snd_kcontrol_chip(kctl); | 617 | struct snd_wss *chip = snd_kcontrol_chip(kctl); |
607 | struct snd_card *card = chip->card; | 618 | struct snd_card *card = chip->card; |
@@ -615,16 +626,18 @@ static int sscape_midi_get(struct snd_kcontrol *kctl, | |||
615 | } | 626 | } |
616 | 627 | ||
617 | static int sscape_midi_put(struct snd_kcontrol *kctl, | 628 | static int sscape_midi_put(struct snd_kcontrol *kctl, |
618 | struct snd_ctl_elem_value *uctl) | 629 | struct snd_ctl_elem_value *uctl) |
619 | { | 630 | { |
620 | struct snd_wss *chip = snd_kcontrol_chip(kctl); | 631 | struct snd_wss *chip = snd_kcontrol_chip(kctl); |
621 | struct snd_card *card = chip->card; | 632 | struct snd_card *card = chip->card; |
622 | register struct soundscape *s = get_card_soundscape(card); | 633 | struct soundscape *s = get_card_soundscape(card); |
623 | unsigned long flags; | 634 | unsigned long flags; |
624 | int change; | 635 | int change; |
636 | unsigned char new_val; | ||
625 | 637 | ||
626 | spin_lock_irqsave(&s->lock, flags); | 638 | spin_lock_irqsave(&s->lock, flags); |
627 | 639 | ||
640 | new_val = uctl->value.integer.value[0] & 127; | ||
628 | /* | 641 | /* |
629 | * We need to put the board into HOST mode before we | 642 | * We need to put the board into HOST mode before we |
630 | * can send any volume-changing HOST commands ... | 643 | * can send any volume-changing HOST commands ... |
@@ -637,15 +650,16 @@ static int sscape_midi_put(struct snd_kcontrol *kctl, | |||
637 | * and then perform another volume-related command. Perhaps the | 650 | * and then perform another volume-related command. Perhaps the |
638 | * first command is an "open" and the second command is a "close"? | 651 | * first command is an "open" and the second command is a "close"? |
639 | */ | 652 | */ |
640 | if (s->midi_vol == ((unsigned char) uctl->value.integer. value[0] & 127)) { | 653 | if (s->midi_vol == new_val) { |
641 | change = 0; | 654 | change = 0; |
642 | goto __skip_change; | 655 | goto __skip_change; |
643 | } | 656 | } |
644 | change = (host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) | 657 | change = host_write_ctrl_unsafe(s->io_base, CMD_SET_MIDI_VOL, 100) |
645 | && host_write_ctrl_unsafe(s->io_base, ((unsigned char) uctl->value.integer. value[0]) & 127, 100) | 658 | && host_write_ctrl_unsafe(s->io_base, new_val, 100) |
646 | && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100)); | 659 | && host_write_ctrl_unsafe(s->io_base, CMD_XXX_MIDI_VOL, 100) |
647 | s->midi_vol = (unsigned char) uctl->value.integer.value[0] & 127; | 660 | && host_write_ctrl_unsafe(s->io_base, new_val, 100); |
648 | __skip_change: | 661 | s->midi_vol = new_val; |
662 | __skip_change: | ||
649 | 663 | ||
650 | /* | 664 | /* |
651 | * Take the board out of HOST mode and back into MIDI mode ... | 665 | * Take the board out of HOST mode and back into MIDI mode ... |
@@ -738,7 +752,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) | |||
738 | if (s->type == SSCAPE_VIVO) | 752 | if (s->type == SSCAPE_VIVO) |
739 | wss_io += 4; | 753 | wss_io += 4; |
740 | 754 | ||
741 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; | 755 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
742 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); | 756 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); |
743 | 757 | ||
744 | /* wait for WSS codec */ | 758 | /* wait for WSS codec */ |
@@ -762,7 +776,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) | |||
762 | if ((inb(wss_io) & 0x80) != 0) | 776 | if ((inb(wss_io) & 0x80) != 0) |
763 | s->type = MEDIA_FX; | 777 | s->type = MEDIA_FX; |
764 | 778 | ||
765 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG) & 0x3f; | 779 | d = sscape_read_unsafe(s->io_base, GA_HMCTL_REG); |
766 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); | 780 | sscape_write_unsafe(s->io_base, GA_HMCTL_REG, d | 0xc0); |
767 | /* wait for WSS codec */ | 781 | /* wait for WSS codec */ |
768 | for (d = 0; d < 500; d++) { | 782 | for (d = 0; d < 500; d++) { |
@@ -778,7 +792,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) | |||
778 | */ | 792 | */ |
779 | retval = 1; | 793 | retval = 1; |
780 | 794 | ||
781 | _done: | 795 | _done: |
782 | spin_unlock_irqrestore(&s->lock, flags); | 796 | spin_unlock_irqrestore(&s->lock, flags); |
783 | return retval; | 797 | return retval; |
784 | } | 798 | } |
@@ -789,7 +803,7 @@ static int __devinit detect_sscape(struct soundscape *s, long wss_io) | |||
789 | * to crash the machine. Also check that someone isn't using the hardware | 803 | * to crash the machine. Also check that someone isn't using the hardware |
790 | * IOCTL device. | 804 | * IOCTL device. |
791 | */ | 805 | */ |
792 | static int mpu401_open(struct snd_mpu401 * mpu) | 806 | static int mpu401_open(struct snd_mpu401 *mpu) |
793 | { | 807 | { |
794 | if (!verify_mpu401(mpu)) { | 808 | if (!verify_mpu401(mpu)) { |
795 | snd_printk(KERN_ERR "sscape: MIDI disabled, " | 809 | snd_printk(KERN_ERR "sscape: MIDI disabled, " |
@@ -803,18 +817,18 @@ static int mpu401_open(struct snd_mpu401 * mpu) | |||
803 | /* | 817 | /* |
804 | * Initialse an MPU-401 subdevice for MIDI support on the SoundScape. | 818 | * Initialse an MPU-401 subdevice for MIDI support on the SoundScape. |
805 | */ | 819 | */ |
806 | static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned long port, int irq) | 820 | static int __devinit create_mpu401(struct snd_card *card, int devnum, |
821 | unsigned long port, int irq) | ||
807 | { | 822 | { |
808 | struct soundscape *sscape = get_card_soundscape(card); | 823 | struct soundscape *sscape = get_card_soundscape(card); |
809 | struct snd_rawmidi *rawmidi; | 824 | struct snd_rawmidi *rawmidi; |
810 | int err; | 825 | int err; |
811 | 826 | ||
812 | if ((err = snd_mpu401_uart_new(card, devnum, | 827 | err = snd_mpu401_uart_new(card, devnum, MPU401_HW_MPU401, port, |
813 | MPU401_HW_MPU401, | 828 | MPU401_INFO_INTEGRATED, irq, IRQF_DISABLED, |
814 | port, MPU401_INFO_INTEGRATED, | 829 | &rawmidi); |
815 | irq, IRQF_DISABLED, | 830 | if (err == 0) { |
816 | &rawmidi)) == 0) { | 831 | struct snd_mpu401 *mpu = rawmidi->private_data; |
817 | struct snd_mpu401 *mpu = (struct snd_mpu401 *) rawmidi->private_data; | ||
818 | mpu->open_input = mpu401_open; | 832 | mpu->open_input = mpu401_open; |
819 | mpu->open_output = mpu401_open; | 833 | mpu->open_output = mpu401_open; |
820 | mpu->private_data = sscape; | 834 | mpu->private_data = sscape; |
@@ -866,19 +880,6 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
866 | unsigned long flags; | 880 | unsigned long flags; |
867 | struct snd_pcm *pcm; | 881 | struct snd_pcm *pcm; |
868 | 882 | ||
869 | /* | ||
870 | * It turns out that the PLAYBACK_ENABLE bit is set | ||
871 | * by the lowlevel driver ... | ||
872 | * | ||
873 | #define AD1845_IFACE_CONFIG \ | ||
874 | (CS4231_AUTOCALIB | CS4231_RECORD_ENABLE | CS4231_PLAYBACK_ENABLE) | ||
875 | snd_wss_mce_up(chip); | ||
876 | spin_lock_irqsave(&chip->reg_lock, flags); | ||
877 | snd_wss_out(chip, CS4231_IFACE_CTRL, AD1845_IFACE_CONFIG); | ||
878 | spin_unlock_irqrestore(&chip->reg_lock, flags); | ||
879 | snd_wss_mce_down(chip); | ||
880 | */ | ||
881 | |||
882 | if (sscape->type != SSCAPE_VIVO) { | 883 | if (sscape->type != SSCAPE_VIVO) { |
883 | /* | 884 | /* |
884 | * The input clock frequency on the SoundScape must | 885 | * The input clock frequency on the SoundScape must |
@@ -928,7 +929,7 @@ static int __devinit create_ad1845(struct snd_card *card, unsigned port, | |||
928 | sscape->chip = chip; | 929 | sscape->chip = chip; |
929 | } | 930 | } |
930 | 931 | ||
931 | _error: | 932 | _error: |
932 | return err; | 933 | return err; |
933 | } | 934 | } |
934 | 935 | ||
@@ -1034,7 +1035,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1034 | */ | 1035 | */ |
1035 | spin_lock_irqsave(&sscape->lock, flags); | 1036 | spin_lock_irqsave(&sscape->lock, flags); |
1036 | 1037 | ||
1037 | sscape_write_unsafe(sscape->io_base, GA_INTENA_REG, 0x00); /* disable */ | ||
1038 | sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2e); | 1038 | sscape_write_unsafe(sscape->io_base, GA_SMCFGA_REG, 0x2e); |
1039 | sscape_write_unsafe(sscape->io_base, GA_SMCFGB_REG, 0x00); | 1039 | sscape_write_unsafe(sscape->io_base, GA_SMCFGB_REG, 0x00); |
1040 | 1040 | ||
@@ -1055,6 +1055,10 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1055 | sscape_write_unsafe(sscape->io_base, | 1055 | sscape_write_unsafe(sscape->io_base, |
1056 | GA_CDCFG_REG, 0x09 | DMA_8BIT | 1056 | GA_CDCFG_REG, 0x09 | DMA_8BIT |
1057 | | (dma[dev] << 4) | (irq_cfg << 1)); | 1057 | | (dma[dev] << 4) | (irq_cfg << 1)); |
1058 | /* | ||
1059 | * Enable the master IRQ ... | ||
1060 | */ | ||
1061 | sscape_write_unsafe(sscape->io_base, GA_INTENA_REG, 0x80); | ||
1058 | 1062 | ||
1059 | spin_unlock_irqrestore(&sscape->lock, flags); | 1063 | spin_unlock_irqrestore(&sscape->lock, flags); |
1060 | 1064 | ||
@@ -1094,11 +1098,6 @@ static int __devinit create_sscape(int dev, struct snd_card *card) | |||
1094 | } | 1098 | } |
1095 | 1099 | ||
1096 | /* | 1100 | /* |
1097 | * Enable the master IRQ ... | ||
1098 | */ | ||
1099 | sscape_write(sscape, GA_INTENA_REG, 0x80); | ||
1100 | |||
1101 | /* | ||
1102 | * Initialize mixer | 1101 | * Initialize mixer |
1103 | */ | 1102 | */ |
1104 | spin_lock_irqsave(&sscape->lock, flags); | 1103 | spin_lock_irqsave(&sscape->lock, flags); |
@@ -1155,7 +1154,8 @@ static int __devinit snd_sscape_match(struct device *pdev, unsigned int i) | |||
1155 | mpu_irq[i] == SNDRV_AUTO_IRQ || | 1154 | mpu_irq[i] == SNDRV_AUTO_IRQ || |
1156 | dma[i] == SNDRV_AUTO_DMA) { | 1155 | dma[i] == SNDRV_AUTO_DMA) { |
1157 | printk(KERN_INFO | 1156 | printk(KERN_INFO |
1158 | "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); | 1157 | "sscape: insufficient parameters, " |
1158 | "need IO, IRQ, MPU-IRQ and DMA\n"); | ||
1159 | return 0; | 1159 | return 0; |
1160 | } | 1160 | } |
1161 | 1161 | ||
@@ -1183,7 +1183,8 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) | |||
1183 | if (ret < 0) | 1183 | if (ret < 0) |
1184 | goto _release_card; | 1184 | goto _release_card; |
1185 | 1185 | ||
1186 | if ((ret = snd_card_register(card)) < 0) { | 1186 | ret = snd_card_register(card); |
1187 | if (ret < 0) { | ||
1187 | snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); | 1188 | snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); |
1188 | goto _release_card; | 1189 | goto _release_card; |
1189 | } | 1190 | } |
@@ -1236,20 +1237,15 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, | |||
1236 | * Allow this function to fail *quietly* if all the ISA PnP | 1237 | * Allow this function to fail *quietly* if all the ISA PnP |
1237 | * devices were configured using module parameters instead. | 1238 | * devices were configured using module parameters instead. |
1238 | */ | 1239 | */ |
1239 | if ((idx = get_next_autoindex(idx)) >= SNDRV_CARDS) | 1240 | idx = get_next_autoindex(idx); |
1241 | if (idx >= SNDRV_CARDS) | ||
1240 | return -ENOSPC; | 1242 | return -ENOSPC; |
1241 | 1243 | ||
1242 | /* | 1244 | /* |
1243 | * We have found a candidate ISA PnP card. Now we | ||
1244 | * have to check that it has the devices that we | ||
1245 | * expect it to have. | ||
1246 | */ | ||
1247 | |||
1248 | /* | ||
1249 | * Check that we still have room for another sound card ... | 1245 | * Check that we still have room for another sound card ... |
1250 | */ | 1246 | */ |
1251 | dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); | 1247 | dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); |
1252 | if (! dev) | 1248 | if (!dev) |
1253 | return -ENODEV; | 1249 | return -ENODEV; |
1254 | 1250 | ||
1255 | if (!pnp_is_active(dev)) { | 1251 | if (!pnp_is_active(dev)) { |
@@ -1298,7 +1294,8 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, | |||
1298 | if (ret < 0) | 1294 | if (ret < 0) |
1299 | goto _release_card; | 1295 | goto _release_card; |
1300 | 1296 | ||
1301 | if ((ret = snd_card_register(card)) < 0) { | 1297 | ret = snd_card_register(card); |
1298 | if (ret < 0) { | ||
1302 | snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); | 1299 | snd_printk(KERN_ERR "sscape: Failed to register sound card\n"); |
1303 | goto _release_card; | 1300 | goto _release_card; |
1304 | } | 1301 | } |