aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/gus
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-14 20:31:54 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-14 20:31:54 -0400
commit6dc6472581f693b5fc95aebedf67b4960fb85cf0 (patch)
tree06a5a9a08519950575505273eabced331ed51405 /sound/isa/gus
parentee673eaa72d8d185012b1027a05e25aba18c267f (diff)
parent8acd3a60bcca17c6d89c73cee3ad6057eb83ba1e (diff)
Merge commit 'origin'
Manual fixup of conflicts on: arch/powerpc/include/asm/dcr-regs.h drivers/net/ibm_newemac/core.h
Diffstat (limited to 'sound/isa/gus')
-rw-r--r--sound/isa/gus/gus_main.c6
-rw-r--r--sound/isa/gus/gus_mixer.c6
-rw-r--r--sound/isa/gus/gus_pcm.c12
-rw-r--r--sound/isa/gus/gusmax.c50
-rw-r--r--sound/isa/gus/interwave.c67
5 files changed, 82 insertions, 59 deletions
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index cccc16c8113f..12eb98f2f931 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -276,9 +276,11 @@ static int snd_gus_init_dma_irq(struct snd_gus_card * gus, int latches)
276 static unsigned char dmas[8] = 276 static unsigned char dmas[8] =
277 {6, 1, 0, 2, 0, 3, 4, 5}; 277 {6, 1, 0, 2, 0, 3, 4, 5};
278 278
279 snd_assert(gus != NULL, return -EINVAL); 279 if (snd_BUG_ON(!gus))
280 return -EINVAL;
280 card = gus->card; 281 card = gus->card;
281 snd_assert(card != NULL, return -EINVAL); 282 if (snd_BUG_ON(!card))
283 return -EINVAL;
282 284
283 gus->mix_cntrl_reg &= 0xf8; 285 gus->mix_cntrl_reg &= 0xf8;
284 gus->mix_cntrl_reg |= 0x01; /* disable MIC, LINE IN, enable LINE OUT */ 286 gus->mix_cntrl_reg |= 0x01; /* disable MIC, LINE IN, enable LINE OUT */
diff --git a/sound/isa/gus/gus_mixer.c b/sound/isa/gus/gus_mixer.c
index ebdb33469306..0dd43414016e 100644
--- a/sound/isa/gus/gus_mixer.c
+++ b/sound/isa/gus/gus_mixer.c
@@ -161,9 +161,11 @@ int snd_gf1_new_mixer(struct snd_gus_card * gus)
161 unsigned int idx, max; 161 unsigned int idx, max;
162 int err; 162 int err;
163 163
164 snd_assert(gus != NULL, return -EINVAL); 164 if (snd_BUG_ON(!gus))
165 return -EINVAL;
165 card = gus->card; 166 card = gus->card;
166 snd_assert(card != NULL, return -EINVAL); 167 if (snd_BUG_ON(!card))
168 return -EINVAL;
167 169
168 if (gus->ics_flag) 170 if (gus->ics_flag)
169 snd_component_add(card, "ICS2101"); 171 snd_component_add(card, "ICS2101");
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 99731dc97325..38510aeb21c6 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -352,8 +352,10 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream,
352 352
353 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); 353 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
354 len = samples_to_bytes(runtime, count); 354 len = samples_to_bytes(runtime, count);
355 snd_assert(bpos <= pcmp->dma_size, return -EIO); 355 if (snd_BUG_ON(bpos > pcmp->dma_size))
356 snd_assert(bpos + len <= pcmp->dma_size, return -EIO); 356 return -EIO;
357 if (snd_BUG_ON(bpos + len > pcmp->dma_size))
358 return -EIO;
357 if (copy_from_user(runtime->dma_area + bpos, src, len)) 359 if (copy_from_user(runtime->dma_area + bpos, src, len))
358 return -EFAULT; 360 return -EFAULT;
359 if (snd_gf1_pcm_use_dma && len > 32) { 361 if (snd_gf1_pcm_use_dma && len > 32) {
@@ -381,8 +383,10 @@ static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
381 383
382 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); 384 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
383 len = samples_to_bytes(runtime, count); 385 len = samples_to_bytes(runtime, count);
384 snd_assert(bpos <= pcmp->dma_size, return -EIO); 386 if (snd_BUG_ON(bpos > pcmp->dma_size))
385 snd_assert(bpos + len <= pcmp->dma_size, return -EIO); 387 return -EIO;
388 if (snd_BUG_ON(bpos + len > pcmp->dma_size))
389 return -EIO;
386 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count); 390 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count);
387 if (snd_gf1_pcm_use_dma && len > 32) { 391 if (snd_gf1_pcm_use_dma && len > 32) {
388 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); 392 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len);
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index f87c6236661c..f94c1976e632 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -28,7 +28,7 @@
28#include <asm/dma.h> 28#include <asm/dma.h>
29#include <sound/core.h> 29#include <sound/core.h>
30#include <sound/gus.h> 30#include <sound/gus.h>
31#include <sound/cs4231.h> 31#include <sound/wss.h>
32#define SNDRV_LEGACY_FIND_FREE_IRQ 32#define SNDRV_LEGACY_FIND_FREE_IRQ
33#define SNDRV_LEGACY_FIND_FREE_DMA 33#define SNDRV_LEGACY_FIND_FREE_DMA
34#include <sound/initval.h> 34#include <sound/initval.h>
@@ -75,7 +75,7 @@ struct snd_gusmax {
75 int irq; 75 int irq;
76 struct snd_card *card; 76 struct snd_card *card;
77 struct snd_gus_card *gus; 77 struct snd_gus_card *gus;
78 struct snd_cs4231 *cs4231; 78 struct snd_wss *wss;
79 unsigned short gus_status_reg; 79 unsigned short gus_status_reg;
80 unsigned short pcm_status_reg; 80 unsigned short pcm_status_reg;
81}; 81};
@@ -117,7 +117,7 @@ static irqreturn_t snd_gusmax_interrupt(int irq, void *dev_id)
117 } 117 }
118 if (inb(maxcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */ 118 if (inb(maxcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */
119 handled = 1; 119 handled = 1;
120 snd_cs4231_interrupt(irq, maxcard->cs4231); 120 snd_wss_interrupt(irq, maxcard->wss);
121 loop++; 121 loop++;
122 } 122 }
123 } while (loop && --max > 0); 123 } while (loop && --max > 0);
@@ -140,10 +140,7 @@ static void __devinit snd_gusmax_init(int dev, struct snd_card *card,
140 outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT)); 140 outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT));
141} 141}
142 142
143#define CS4231_PRIVATE( left, right, shift, mute ) \ 143static int __devinit snd_gusmax_mixer(struct snd_wss *chip)
144 ((left << 24)|(right << 16)|(shift<<8)|mute)
145
146static int __devinit snd_gusmax_mixer(struct snd_cs4231 *chip)
147{ 144{
148 struct snd_card *card = chip->card; 145 struct snd_card *card = chip->card;
149 struct snd_ctl_elem_id id1, id2; 146 struct snd_ctl_elem_id id1, id2;
@@ -214,7 +211,7 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
214 int xirq, xdma1, xdma2, err; 211 int xirq, xdma1, xdma2, err;
215 struct snd_card *card; 212 struct snd_card *card;
216 struct snd_gus_card *gus = NULL; 213 struct snd_gus_card *gus = NULL;
217 struct snd_cs4231 *cs4231; 214 struct snd_wss *wss;
218 struct snd_gusmax *maxcard; 215 struct snd_gusmax *maxcard;
219 216
220 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 217 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
@@ -301,33 +298,39 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
301 } 298 }
302 maxcard->irq = xirq; 299 maxcard->irq = xirq;
303 300
304 if ((err = snd_cs4231_create(card, 301 err = snd_wss_create(card,
305 gus->gf1.port + 0x10c, -1, xirq, 302 gus->gf1.port + 0x10c, -1, xirq,
306 xdma2 < 0 ? xdma1 : xdma2, xdma1, 303 xdma2 < 0 ? xdma1 : xdma2, xdma1,
307 CS4231_HW_DETECT, 304 WSS_HW_DETECT,
308 CS4231_HWSHARE_IRQ | 305 WSS_HWSHARE_IRQ |
309 CS4231_HWSHARE_DMA1 | 306 WSS_HWSHARE_DMA1 |
310 CS4231_HWSHARE_DMA2, 307 WSS_HWSHARE_DMA2,
311 &cs4231)) < 0) 308 &wss);
309 if (err < 0)
312 goto _err; 310 goto _err;
313 311
314 if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) 312 err = snd_wss_pcm(wss, 0, NULL);
313 if (err < 0)
315 goto _err; 314 goto _err;
316 315
317 if ((err = snd_cs4231_mixer(cs4231)) < 0) 316 err = snd_wss_mixer(wss);
317 if (err < 0)
318 goto _err; 318 goto _err;
319 319
320 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) 320 err = snd_wss_timer(wss, 2, NULL);
321 if (err < 0)
321 goto _err; 322 goto _err;
322 323
323 if (pcm_channels[dev] > 0) { 324 if (pcm_channels[dev] > 0) {
324 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) 325 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
325 goto _err; 326 goto _err;
326 } 327 }
327 if ((err = snd_gusmax_mixer(cs4231)) < 0) 328 err = snd_gusmax_mixer(wss);
329 if (err < 0)
328 goto _err; 330 goto _err;
329 331
330 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) 332 err = snd_gf1_rawmidi_new(gus, 0, NULL);
333 if (err < 0)
331 goto _err; 334 goto _err;
332 335
333 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1); 336 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1);
@@ -336,11 +339,12 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
336 339
337 snd_card_set_dev(card, pdev); 340 snd_card_set_dev(card, pdev);
338 341
339 if ((err = snd_card_register(card)) < 0) 342 err = snd_card_register(card);
343 if (err < 0)
340 goto _err; 344 goto _err;
341 345
342 maxcard->gus = gus; 346 maxcard->gus = gus;
343 maxcard->cs4231 = cs4231; 347 maxcard->wss = wss;
344 348
345 dev_set_drvdata(pdev, card); 349 dev_set_drvdata(pdev, card);
346 return 0; 350 return 0;
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index ca0d7ace0c75..5faecfb602d3 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -32,7 +32,7 @@
32#include <asm/dma.h> 32#include <asm/dma.h>
33#include <sound/core.h> 33#include <sound/core.h>
34#include <sound/gus.h> 34#include <sound/gus.h>
35#include <sound/cs4231.h> 35#include <sound/wss.h>
36#ifdef SNDRV_STB 36#ifdef SNDRV_STB
37#include <sound/tea6330t.h> 37#include <sound/tea6330t.h>
38#endif 38#endif
@@ -118,7 +118,7 @@ struct snd_interwave {
118 int irq; 118 int irq;
119 struct snd_card *card; 119 struct snd_card *card;
120 struct snd_gus_card *gus; 120 struct snd_gus_card *gus;
121 struct snd_cs4231 *cs4231; 121 struct snd_wss *wss;
122#ifdef SNDRV_STB 122#ifdef SNDRV_STB
123 struct resource *i2c_res; 123 struct resource *i2c_res;
124#endif 124#endif
@@ -312,7 +312,7 @@ static irqreturn_t snd_interwave_interrupt(int irq, void *dev_id)
312 } 312 }
313 if (inb(iwcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */ 313 if (inb(iwcard->pcm_status_reg) & 0x01) { /* IRQ bit is set? */
314 handled = 1; 314 handled = 1;
315 snd_cs4231_interrupt(irq, iwcard->cs4231); 315 snd_wss_interrupt(irq, iwcard->wss);
316 loop++; 316 loop++;
317 } 317 }
318 } while (loop && --max > 0); 318 } while (loop && --max > 0);
@@ -498,13 +498,17 @@ static void __devinit snd_interwave_init(int dev, struct snd_gus_card * gus)
498} 498}
499 499
500static struct snd_kcontrol_new snd_interwave_controls[] = { 500static struct snd_kcontrol_new snd_interwave_controls[] = {
501CS4231_DOUBLE("Master Playback Switch", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), 501WSS_DOUBLE("Master Playback Switch", 0,
502CS4231_DOUBLE("Master Playback Volume", 0, CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 0, 0, 31, 1), 502 CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1),
503CS4231_DOUBLE("Mic Playback Switch", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 7, 7, 1, 1), 503WSS_DOUBLE("Master Playback Volume", 0,
504CS4231_DOUBLE("Mic Playback Volume", 0, CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1) 504 CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 0, 0, 31, 1),
505WSS_DOUBLE("Mic Playback Switch", 0,
506 CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 7, 7, 1, 1),
507WSS_DOUBLE("Mic Playback Volume", 0,
508 CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1)
505}; 509};
506 510
507static int __devinit snd_interwave_mixer(struct snd_cs4231 *chip) 511static int __devinit snd_interwave_mixer(struct snd_wss *chip)
508{ 512{
509 struct snd_card *card = chip->card; 513 struct snd_card *card = chip->card;
510 struct snd_ctl_elem_id id1, id2; 514 struct snd_ctl_elem_id id1, id2;
@@ -527,10 +531,10 @@ static int __devinit snd_interwave_mixer(struct snd_cs4231 *chip)
527 for (idx = 0; idx < ARRAY_SIZE(snd_interwave_controls); idx++) 531 for (idx = 0; idx < ARRAY_SIZE(snd_interwave_controls); idx++)
528 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_interwave_controls[idx], chip))) < 0) 532 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_interwave_controls[idx], chip))) < 0)
529 return err; 533 return err;
530 snd_cs4231_out(chip, CS4231_LINE_LEFT_OUTPUT, 0x9f); 534 snd_wss_out(chip, CS4231_LINE_LEFT_OUTPUT, 0x9f);
531 snd_cs4231_out(chip, CS4231_LINE_RIGHT_OUTPUT, 0x9f); 535 snd_wss_out(chip, CS4231_LINE_RIGHT_OUTPUT, 0x9f);
532 snd_cs4231_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f); 536 snd_wss_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f);
533 snd_cs4231_out(chip, CS4231_RIGHT_MIC_INPUT, 0x9f); 537 snd_wss_out(chip, CS4231_RIGHT_MIC_INPUT, 0x9f);
534 /* reassign AUXA to SYNTHESIZER */ 538 /* reassign AUXA to SYNTHESIZER */
535 strcpy(id1.name, "Aux Playback Switch"); 539 strcpy(id1.name, "Aux Playback Switch");
536 strcpy(id2.name, "Synth Playback Switch"); 540 strcpy(id2.name, "Synth Playback Switch");
@@ -642,7 +646,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
642{ 646{
643 int xirq, xdma1, xdma2; 647 int xirq, xdma1, xdma2;
644 struct snd_interwave *iwcard = card->private_data; 648 struct snd_interwave *iwcard = card->private_data;
645 struct snd_cs4231 *cs4231; 649 struct snd_wss *wss;
646 struct snd_gus_card *gus; 650 struct snd_gus_card *gus;
647#ifdef SNDRV_STB 651#ifdef SNDRV_STB
648 struct snd_i2c_bus *i2c_bus; 652 struct snd_i2c_bus *i2c_bus;
@@ -684,33 +688,39 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
684 } 688 }
685 iwcard->irq = xirq; 689 iwcard->irq = xirq;
686 690
687 if ((err = snd_cs4231_create(card, 691 err = snd_wss_create(card,
688 gus->gf1.port + 0x10c, -1, xirq, 692 gus->gf1.port + 0x10c, -1, xirq,
689 xdma2 < 0 ? xdma1 : xdma2, xdma1, 693 xdma2 < 0 ? xdma1 : xdma2, xdma1,
690 CS4231_HW_INTERWAVE, 694 WSS_HW_INTERWAVE,
691 CS4231_HWSHARE_IRQ | 695 WSS_HWSHARE_IRQ |
692 CS4231_HWSHARE_DMA1 | 696 WSS_HWSHARE_DMA1 |
693 CS4231_HWSHARE_DMA2, 697 WSS_HWSHARE_DMA2,
694 &cs4231)) < 0) 698 &wss);
699 if (err < 0)
695 return err; 700 return err;
696 701
697 if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) 702 err = snd_wss_pcm(wss, 0, &pcm);
703 if (err < 0)
698 return err; 704 return err;
699 705
700 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); 706 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
701 strcat(pcm->name, " (codec)"); 707 strcat(pcm->name, " (codec)");
702 708
703 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) 709 err = snd_wss_timer(wss, 2, NULL);
710 if (err < 0)
704 return err; 711 return err;
705 712
706 if ((err = snd_cs4231_mixer(cs4231)) < 0) 713 err = snd_wss_mixer(wss);
714 if (err < 0)
707 return err; 715 return err;
708 716
709 if (pcm_channels[dev] > 0) { 717 if (pcm_channels[dev] > 0) {
710 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) 718 err = snd_gf1_pcm_new(gus, 1, 1, NULL);
719 if (err < 0)
711 return err; 720 return err;
712 } 721 }
713 if ((err = snd_interwave_mixer(cs4231)) < 0) 722 err = snd_interwave_mixer(wss);
723 if (err < 0)
714 return err; 724 return err;
715 725
716#ifdef SNDRV_STB 726#ifdef SNDRV_STB
@@ -754,10 +764,11 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
754 if (xdma2 >= 0) 764 if (xdma2 >= 0)
755 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); 765 sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
756 766
757 if ((err = snd_card_register(card)) < 0) 767 err = snd_card_register(card);
768 if (err < 0)
758 return err; 769 return err;
759 770
760 iwcard->cs4231 = cs4231; 771 iwcard->wss = wss;
761 iwcard->gus = gus; 772 iwcard->gus = gus;
762 return 0; 773 return 0;
763} 774}