aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/ad1848/ad1848.c6
-rw-r--r--sound/isa/ad1848/ad1848_lib.c128
-rw-r--r--sound/isa/cmi8330.c2
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c4
-rw-r--r--sound/isa/sc6000.c4
-rw-r--r--sound/isa/sgalaxy.c8
6 files changed, 78 insertions, 74 deletions
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 5f5271efdc59..74db24ae6509 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -87,7 +87,7 @@ static int __devinit snd_ad1848_match(struct device *dev, unsigned int n)
87static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n) 87static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n)
88{ 88{
89 struct snd_card *card; 89 struct snd_card *card;
90 struct snd_ad1848 *chip; 90 struct snd_wss *chip;
91 struct snd_pcm *pcm; 91 struct snd_pcm *pcm;
92 int error; 92 int error;
93 93
@@ -142,7 +142,7 @@ static int __devexit snd_ad1848_remove(struct device *dev, unsigned int n)
142static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t state) 142static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t state)
143{ 143{
144 struct snd_card *card = dev_get_drvdata(dev); 144 struct snd_card *card = dev_get_drvdata(dev);
145 struct snd_ad1848 *chip = card->private_data; 145 struct snd_wss *chip = card->private_data;
146 146
147 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 147 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
148 chip->suspend(chip); 148 chip->suspend(chip);
@@ -152,7 +152,7 @@ static int snd_ad1848_suspend(struct device *dev, unsigned int n, pm_message_t s
152static int snd_ad1848_resume(struct device *dev, unsigned int n) 152static int snd_ad1848_resume(struct device *dev, unsigned int n)
153{ 153{
154 struct snd_card *card = dev_get_drvdata(dev); 154 struct snd_card *card = dev_get_drvdata(dev);
155 struct snd_ad1848 *chip = card->private_data; 155 struct snd_wss *chip = card->private_data;
156 156
157 chip->resume(chip); 157 chip->resume(chip);
158 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 158 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index 630c90f9ee50..e25fadffdb55 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -98,7 +98,7 @@ static unsigned char snd_ad1848_original_image[16] =
98 * Basic I/O functions 98 * Basic I/O functions
99 */ 99 */
100 100
101static void snd_ad1848_wait(struct snd_ad1848 *chip) 101static void snd_ad1848_wait(struct snd_wss *chip)
102{ 102{
103 int timeout; 103 int timeout;
104 104
@@ -109,7 +109,7 @@ static void snd_ad1848_wait(struct snd_ad1848 *chip)
109 } 109 }
110} 110}
111 111
112void snd_ad1848_out(struct snd_ad1848 *chip, 112void snd_ad1848_out(struct snd_wss *chip,
113 unsigned char reg, 113 unsigned char reg,
114 unsigned char value) 114 unsigned char value)
115{ 115{
@@ -128,7 +128,7 @@ void snd_ad1848_out(struct snd_ad1848 *chip,
128 128
129EXPORT_SYMBOL(snd_ad1848_out); 129EXPORT_SYMBOL(snd_ad1848_out);
130 130
131static void snd_ad1848_dout(struct snd_ad1848 *chip, 131static void snd_ad1848_dout(struct snd_wss *chip,
132 unsigned char reg, unsigned char value) 132 unsigned char reg, unsigned char value)
133{ 133{
134 snd_ad1848_wait(chip); 134 snd_ad1848_wait(chip);
@@ -137,7 +137,7 @@ static void snd_ad1848_dout(struct snd_ad1848 *chip,
137 mb(); 137 mb();
138} 138}
139 139
140static unsigned char snd_ad1848_in(struct snd_ad1848 *chip, unsigned char reg) 140static unsigned char snd_ad1848_in(struct snd_wss *chip, unsigned char reg)
141{ 141{
142 snd_ad1848_wait(chip); 142 snd_ad1848_wait(chip);
143#ifdef CONFIG_SND_DEBUG 143#ifdef CONFIG_SND_DEBUG
@@ -152,7 +152,7 @@ static unsigned char snd_ad1848_in(struct snd_ad1848 *chip, unsigned char reg)
152 152
153#if 0 153#if 0
154 154
155static void snd_ad1848_debug(struct snd_ad1848 *chip) 155static void snd_ad1848_debug(struct snd_wss *chip)
156{ 156{
157 printk("AD1848 REGS: INDEX = 0x%02x ", inb(AD1848P(chip, REGSEL))); 157 printk("AD1848 REGS: INDEX = 0x%02x ", inb(AD1848P(chip, REGSEL)));
158 printk(" STATUS = 0x%02x\n", inb(AD1848P(chip, STATUS))); 158 printk(" STATUS = 0x%02x\n", inb(AD1848P(chip, STATUS)));
@@ -180,7 +180,7 @@ static void snd_ad1848_debug(struct snd_ad1848 *chip)
180 * AD1848 detection / MCE routines 180 * AD1848 detection / MCE routines
181 */ 181 */
182 182
183static void snd_ad1848_mce_up(struct snd_ad1848 *chip) 183static void snd_ad1848_mce_up(struct snd_wss *chip)
184{ 184{
185 unsigned long flags; 185 unsigned long flags;
186 int timeout; 186 int timeout;
@@ -200,7 +200,7 @@ static void snd_ad1848_mce_up(struct snd_ad1848 *chip)
200 spin_unlock_irqrestore(&chip->reg_lock, flags); 200 spin_unlock_irqrestore(&chip->reg_lock, flags);
201} 201}
202 202
203static void snd_ad1848_mce_down(struct snd_ad1848 *chip) 203static void snd_ad1848_mce_down(struct snd_wss *chip)
204{ 204{
205 unsigned long flags, timeout; 205 unsigned long flags, timeout;
206 int reg; 206 int reg;
@@ -268,7 +268,7 @@ static unsigned int snd_ad1848_get_count(unsigned char format,
268 return size; 268 return size;
269} 269}
270 270
271static int snd_ad1848_trigger(struct snd_ad1848 *chip, unsigned char what, 271static int snd_ad1848_trigger(struct snd_wss *chip, unsigned char what,
272 int channel, int cmd) 272 int channel, int cmd)
273{ 273{
274 int result = 0; 274 int result = 0;
@@ -337,7 +337,7 @@ static unsigned char snd_ad1848_get_format(int format, int channels)
337 return rformat; 337 return rformat;
338} 338}
339 339
340static void snd_ad1848_calibrate_mute(struct snd_ad1848 *chip, int mute) 340static void snd_ad1848_calibrate_mute(struct snd_wss *chip, int mute)
341{ 341{
342 unsigned long flags; 342 unsigned long flags;
343 343
@@ -361,7 +361,8 @@ static void snd_ad1848_calibrate_mute(struct snd_ad1848 *chip, int mute)
361 spin_unlock_irqrestore(&chip->reg_lock, flags); 361 spin_unlock_irqrestore(&chip->reg_lock, flags);
362} 362}
363 363
364static void snd_ad1848_set_data_format(struct snd_ad1848 *chip, struct snd_pcm_hw_params *hw_params) 364static void snd_ad1848_set_data_format(struct snd_wss *chip,
365 struct snd_pcm_hw_params *hw_params)
365{ 366{
366 if (hw_params == NULL) { 367 if (hw_params == NULL) {
367 chip->image[AD1848_DATA_FORMAT] = 0x20; 368 chip->image[AD1848_DATA_FORMAT] = 0x20;
@@ -373,7 +374,7 @@ static void snd_ad1848_set_data_format(struct snd_ad1848 *chip, struct snd_pcm_h
373 // snd_printk(">>> pmode = 0x%x, dfr = 0x%x\n", pstr->mode, chip->image[AD1848_DATA_FORMAT]); 374 // snd_printk(">>> pmode = 0x%x, dfr = 0x%x\n", pstr->mode, chip->image[AD1848_DATA_FORMAT]);
374} 375}
375 376
376static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) 377static int snd_ad1848_open(struct snd_wss *chip, unsigned int mode)
377{ 378{
378 unsigned long flags; 379 unsigned long flags;
379 380
@@ -424,7 +425,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
424 return 0; 425 return 0;
425} 426}
426 427
427static void snd_ad1848_close(struct snd_ad1848 *chip) 428static void snd_ad1848_close(struct snd_wss *chip)
428{ 429{
429 unsigned long flags; 430 unsigned long flags;
430 431
@@ -464,21 +465,21 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
464static int snd_ad1848_playback_trigger(struct snd_pcm_substream *substream, 465static int snd_ad1848_playback_trigger(struct snd_pcm_substream *substream,
465 int cmd) 466 int cmd)
466{ 467{
467 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 468 struct snd_wss *chip = snd_pcm_substream_chip(substream);
468 return snd_ad1848_trigger(chip, AD1848_PLAYBACK_ENABLE, SNDRV_PCM_STREAM_PLAYBACK, cmd); 469 return snd_ad1848_trigger(chip, AD1848_PLAYBACK_ENABLE, SNDRV_PCM_STREAM_PLAYBACK, cmd);
469} 470}
470 471
471static int snd_ad1848_capture_trigger(struct snd_pcm_substream *substream, 472static int snd_ad1848_capture_trigger(struct snd_pcm_substream *substream,
472 int cmd) 473 int cmd)
473{ 474{
474 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 475 struct snd_wss *chip = snd_pcm_substream_chip(substream);
475 return snd_ad1848_trigger(chip, AD1848_CAPTURE_ENABLE, SNDRV_PCM_STREAM_CAPTURE, cmd); 476 return snd_ad1848_trigger(chip, AD1848_CAPTURE_ENABLE, SNDRV_PCM_STREAM_CAPTURE, cmd);
476} 477}
477 478
478static int snd_ad1848_playback_hw_params(struct snd_pcm_substream *substream, 479static int snd_ad1848_playback_hw_params(struct snd_pcm_substream *substream,
479 struct snd_pcm_hw_params *hw_params) 480 struct snd_pcm_hw_params *hw_params)
480{ 481{
481 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 482 struct snd_wss *chip = snd_pcm_substream_chip(substream);
482 unsigned long flags; 483 unsigned long flags;
483 int err; 484 int err;
484 485
@@ -502,15 +503,16 @@ static int snd_ad1848_playback_hw_free(struct snd_pcm_substream *substream)
502 503
503static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream) 504static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream)
504{ 505{
505 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 506 struct snd_wss *chip = snd_pcm_substream_chip(substream);
506 struct snd_pcm_runtime *runtime = substream->runtime; 507 struct snd_pcm_runtime *runtime = substream->runtime;
507 unsigned long flags; 508 unsigned long flags;
508 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 509 unsigned int size = snd_pcm_lib_buffer_bytes(substream);
509 unsigned int count = snd_pcm_lib_period_bytes(substream); 510 unsigned int count = snd_pcm_lib_period_bytes(substream);
510 511
511 chip->dma_size = size; 512 chip->p_dma_size = size;
512 chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_PLAYBACK_ENABLE | AD1848_PLAYBACK_PIO); 513 chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_PLAYBACK_ENABLE | AD1848_PLAYBACK_PIO);
513 snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 514 snd_dma_program(chip->dma1, runtime->dma_addr, size,
515 DMA_MODE_WRITE | DMA_AUTOINIT);
514 count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1; 516 count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
515 spin_lock_irqsave(&chip->reg_lock, flags); 517 spin_lock_irqsave(&chip->reg_lock, flags);
516 snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count); 518 snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count);
@@ -522,7 +524,7 @@ static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream)
522static int snd_ad1848_capture_hw_params(struct snd_pcm_substream *substream, 524static int snd_ad1848_capture_hw_params(struct snd_pcm_substream *substream,
523 struct snd_pcm_hw_params *hw_params) 525 struct snd_pcm_hw_params *hw_params)
524{ 526{
525 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 527 struct snd_wss *chip = snd_pcm_substream_chip(substream);
526 unsigned long flags; 528 unsigned long flags;
527 int err; 529 int err;
528 530
@@ -546,15 +548,16 @@ static int snd_ad1848_capture_hw_free(struct snd_pcm_substream *substream)
546 548
547static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream) 549static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream)
548{ 550{
549 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 551 struct snd_wss *chip = snd_pcm_substream_chip(substream);
550 struct snd_pcm_runtime *runtime = substream->runtime; 552 struct snd_pcm_runtime *runtime = substream->runtime;
551 unsigned long flags; 553 unsigned long flags;
552 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 554 unsigned int size = snd_pcm_lib_buffer_bytes(substream);
553 unsigned int count = snd_pcm_lib_period_bytes(substream); 555 unsigned int count = snd_pcm_lib_period_bytes(substream);
554 556
555 chip->dma_size = size; 557 chip->c_dma_size = size;
556 chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_CAPTURE_ENABLE | AD1848_CAPTURE_PIO); 558 chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_CAPTURE_ENABLE | AD1848_CAPTURE_PIO);
557 snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); 559 snd_dma_program(chip->dma2, runtime->dma_addr, size,
560 DMA_MODE_READ | DMA_AUTOINIT);
558 count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1; 561 count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1;
559 spin_lock_irqsave(&chip->reg_lock, flags); 562 spin_lock_irqsave(&chip->reg_lock, flags);
560 snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count); 563 snd_ad1848_out(chip, AD1848_DATA_LWR_CNT, (unsigned char) count);
@@ -565,7 +568,7 @@ static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream)
565 568
566static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id) 569static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id)
567{ 570{
568 struct snd_ad1848 *chip = dev_id; 571 struct snd_wss *chip = dev_id;
569 572
570 if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream && 573 if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream &&
571 (chip->mode & AD1848_MODE_RUNNING)) 574 (chip->mode & AD1848_MODE_RUNNING))
@@ -579,23 +582,23 @@ static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id)
579 582
580static snd_pcm_uframes_t snd_ad1848_playback_pointer(struct snd_pcm_substream *substream) 583static snd_pcm_uframes_t snd_ad1848_playback_pointer(struct snd_pcm_substream *substream)
581{ 584{
582 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 585 struct snd_wss *chip = snd_pcm_substream_chip(substream);
583 size_t ptr; 586 size_t ptr;
584 587
585 if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_PLAYBACK_ENABLE)) 588 if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_PLAYBACK_ENABLE))
586 return 0; 589 return 0;
587 ptr = snd_dma_pointer(chip->dma, chip->dma_size); 590 ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size);
588 return bytes_to_frames(substream->runtime, ptr); 591 return bytes_to_frames(substream->runtime, ptr);
589} 592}
590 593
591static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *substream) 594static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *substream)
592{ 595{
593 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 596 struct snd_wss *chip = snd_pcm_substream_chip(substream);
594 size_t ptr; 597 size_t ptr;
595 598
596 if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_CAPTURE_ENABLE)) 599 if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_CAPTURE_ENABLE))
597 return 0; 600 return 0;
598 ptr = snd_dma_pointer(chip->dma, chip->dma_size); 601 ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size);
599 return bytes_to_frames(substream->runtime, ptr); 602 return bytes_to_frames(substream->runtime, ptr);
600} 603}
601 604
@@ -603,8 +606,8 @@ static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *su
603 606
604 */ 607 */
605 608
606static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) { 609static void snd_ad1848_thinkpad_twiddle(struct snd_wss *chip, int on)
607 610{
608 int tmp; 611 int tmp;
609 612
610 if (!chip->thinkpad_flag) return; 613 if (!chip->thinkpad_flag) return;
@@ -624,14 +627,14 @@ static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) {
624} 627}
625 628
626#ifdef CONFIG_PM 629#ifdef CONFIG_PM
627static void snd_ad1848_suspend(struct snd_ad1848 *chip) 630static void snd_ad1848_suspend(struct snd_wss *chip)
628{ 631{
629 snd_pcm_suspend_all(chip->pcm); 632 snd_pcm_suspend_all(chip->pcm);
630 if (chip->thinkpad_flag) 633 if (chip->thinkpad_flag)
631 snd_ad1848_thinkpad_twiddle(chip, 0); 634 snd_ad1848_thinkpad_twiddle(chip, 0);
632} 635}
633 636
634static void snd_ad1848_resume(struct snd_ad1848 *chip) 637static void snd_ad1848_resume(struct snd_wss *chip)
635{ 638{
636 int i; 639 int i;
637 640
@@ -651,7 +654,7 @@ static void snd_ad1848_resume(struct snd_ad1848 *chip)
651} 654}
652#endif /* CONFIG_PM */ 655#endif /* CONFIG_PM */
653 656
654static int snd_ad1848_probe(struct snd_ad1848 * chip) 657static int snd_ad1848_probe(struct snd_wss *chip)
655{ 658{
656 unsigned long flags; 659 unsigned long flags;
657 int i, id, rev, ad1847; 660 int i, id, rev, ad1847;
@@ -775,7 +778,7 @@ static struct snd_pcm_hardware snd_ad1848_capture =
775 778
776static int snd_ad1848_playback_open(struct snd_pcm_substream *substream) 779static int snd_ad1848_playback_open(struct snd_pcm_substream *substream)
777{ 780{
778 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 781 struct snd_wss *chip = snd_pcm_substream_chip(substream);
779 struct snd_pcm_runtime *runtime = substream->runtime; 782 struct snd_pcm_runtime *runtime = substream->runtime;
780 int err; 783 int err;
781 784
@@ -783,15 +786,15 @@ static int snd_ad1848_playback_open(struct snd_pcm_substream *substream)
783 return err; 786 return err;
784 chip->playback_substream = substream; 787 chip->playback_substream = substream;
785 runtime->hw = snd_ad1848_playback; 788 runtime->hw = snd_ad1848_playback;
786 snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.buffer_bytes_max); 789 snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max);
787 snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.period_bytes_max); 790 snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max);
788 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); 791 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);
789 return 0; 792 return 0;
790} 793}
791 794
792static int snd_ad1848_capture_open(struct snd_pcm_substream *substream) 795static int snd_ad1848_capture_open(struct snd_pcm_substream *substream)
793{ 796{
794 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 797 struct snd_wss *chip = snd_pcm_substream_chip(substream);
795 struct snd_pcm_runtime *runtime = substream->runtime; 798 struct snd_pcm_runtime *runtime = substream->runtime;
796 int err; 799 int err;
797 800
@@ -799,15 +802,15 @@ static int snd_ad1848_capture_open(struct snd_pcm_substream *substream)
799 return err; 802 return err;
800 chip->capture_substream = substream; 803 chip->capture_substream = substream;
801 runtime->hw = snd_ad1848_capture; 804 runtime->hw = snd_ad1848_capture;
802 snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.buffer_bytes_max); 805 snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max);
803 snd_pcm_limit_isa_dma_size(chip->dma, &runtime->hw.period_bytes_max); 806 snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max);
804 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); 807 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);
805 return 0; 808 return 0;
806} 809}
807 810
808static int snd_ad1848_playback_close(struct snd_pcm_substream *substream) 811static int snd_ad1848_playback_close(struct snd_pcm_substream *substream)
809{ 812{
810 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 813 struct snd_wss *chip = snd_pcm_substream_chip(substream);
811 814
812 chip->mode &= ~AD1848_MODE_PLAY; 815 chip->mode &= ~AD1848_MODE_PLAY;
813 chip->playback_substream = NULL; 816 chip->playback_substream = NULL;
@@ -817,7 +820,7 @@ static int snd_ad1848_playback_close(struct snd_pcm_substream *substream)
817 820
818static int snd_ad1848_capture_close(struct snd_pcm_substream *substream) 821static int snd_ad1848_capture_close(struct snd_pcm_substream *substream)
819{ 822{
820 struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); 823 struct snd_wss *chip = snd_pcm_substream_chip(substream);
821 824
822 chip->mode &= ~AD1848_MODE_CAPTURE; 825 chip->mode &= ~AD1848_MODE_CAPTURE;
823 chip->capture_substream = NULL; 826 chip->capture_substream = NULL;
@@ -825,14 +828,14 @@ static int snd_ad1848_capture_close(struct snd_pcm_substream *substream)
825 return 0; 828 return 0;
826} 829}
827 830
828static int snd_ad1848_free(struct snd_ad1848 *chip) 831static int snd_ad1848_free(struct snd_wss *chip)
829{ 832{
830 release_and_free_resource(chip->res_port); 833 release_and_free_resource(chip->res_port);
831 if (chip->irq >= 0) 834 if (chip->irq >= 0)
832 free_irq(chip->irq, (void *) chip); 835 free_irq(chip->irq, (void *) chip);
833 if (chip->dma >= 0) { 836 if (chip->dma1 >= 0) {
834 snd_dma_disable(chip->dma); 837 snd_dma_disable(chip->dma1);
835 free_dma(chip->dma); 838 free_dma(chip->dma1);
836 } 839 }
837 kfree(chip); 840 kfree(chip);
838 return 0; 841 return 0;
@@ -840,11 +843,11 @@ static int snd_ad1848_free(struct snd_ad1848 *chip)
840 843
841static int snd_ad1848_dev_free(struct snd_device *device) 844static int snd_ad1848_dev_free(struct snd_device *device)
842{ 845{
843 struct snd_ad1848 *chip = device->device_data; 846 struct snd_wss *chip = device->device_data;
844 return snd_ad1848_free(chip); 847 return snd_ad1848_free(chip);
845} 848}
846 849
847static const char *snd_ad1848_chip_id(struct snd_ad1848 *chip) 850static const char *snd_ad1848_chip_id(struct snd_wss *chip)
848{ 851{
849 switch (chip->hardware) { 852 switch (chip->hardware) {
850 case AD1848_HW_AD1847: return "AD1847"; 853 case AD1848_HW_AD1847: return "AD1847";
@@ -859,12 +862,12 @@ int snd_ad1848_create(struct snd_card *card,
859 unsigned long port, 862 unsigned long port,
860 int irq, int dma, 863 int irq, int dma,
861 unsigned short hardware, 864 unsigned short hardware,
862 struct snd_ad1848 ** rchip) 865 struct snd_wss **rchip)
863{ 866{
864 static struct snd_device_ops ops = { 867 static struct snd_device_ops ops = {
865 .dev_free = snd_ad1848_dev_free, 868 .dev_free = snd_ad1848_dev_free,
866 }; 869 };
867 struct snd_ad1848 *chip; 870 struct snd_wss *chip;
868 int err; 871 int err;
869 872
870 *rchip = NULL; 873 *rchip = NULL;
@@ -875,7 +878,9 @@ int snd_ad1848_create(struct snd_card *card,
875 chip->card = card; 878 chip->card = card;
876 chip->port = port; 879 chip->port = port;
877 chip->irq = -1; 880 chip->irq = -1;
878 chip->dma = -1; 881 chip->dma1 = -1;
882 chip->dma2 = -1;
883 chip->single_dma = 1;
879 chip->hardware = hardware; 884 chip->hardware = hardware;
880 memcpy(&chip->image, &snd_ad1848_original_image, sizeof(snd_ad1848_original_image)); 885 memcpy(&chip->image, &snd_ad1848_original_image, sizeof(snd_ad1848_original_image));
881 886
@@ -895,7 +900,8 @@ int snd_ad1848_create(struct snd_card *card,
895 snd_ad1848_free(chip); 900 snd_ad1848_free(chip);
896 return -EBUSY; 901 return -EBUSY;
897 } 902 }
898 chip->dma = dma; 903 chip->dma1 = dma;
904 chip->dma2 = dma;
899 905
900 if (hardware == AD1848_HW_THINKPAD) { 906 if (hardware == AD1848_HW_THINKPAD) {
901 chip->thinkpad_flag = 1; 907 chip->thinkpad_flag = 1;
@@ -947,7 +953,7 @@ static struct snd_pcm_ops snd_ad1848_capture_ops = {
947 .pointer = snd_ad1848_capture_pointer, 953 .pointer = snd_ad1848_capture_pointer,
948}; 954};
949 955
950int snd_ad1848_pcm(struct snd_ad1848 *chip, int device, struct snd_pcm **rpcm) 956int snd_ad1848_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm)
951{ 957{
952 struct snd_pcm *pcm; 958 struct snd_pcm *pcm;
953 int err; 959 int err;
@@ -964,7 +970,9 @@ int snd_ad1848_pcm(struct snd_ad1848 *chip, int device, struct snd_pcm **rpcm)
964 970
965 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 971 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
966 snd_dma_isa_data(), 972 snd_dma_isa_data(),
967 64*1024, chip->dma > 3 ? 128*1024 : 64*1024); 973 64 * 1024,
974 chip->dma1 > 3 ?
975 128 * 1024 : 64 * 1024);
968 976
969 chip->pcm = pcm; 977 chip->pcm = pcm;
970 if (rpcm) 978 if (rpcm)
@@ -1003,7 +1011,7 @@ static int snd_ad1848_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
1003 1011
1004static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1012static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1005{ 1013{
1006 struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); 1014 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
1007 unsigned long flags; 1015 unsigned long flags;
1008 1016
1009 spin_lock_irqsave(&chip->reg_lock, flags); 1017 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -1015,7 +1023,7 @@ static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
1015 1023
1016static int snd_ad1848_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1024static int snd_ad1848_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1017{ 1025{
1018 struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); 1026 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
1019 unsigned long flags; 1027 unsigned long flags;
1020 unsigned short left, right; 1028 unsigned short left, right;
1021 int change; 1029 int change;
@@ -1049,7 +1057,7 @@ static int snd_ad1848_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_
1049 1057
1050static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1058static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1051{ 1059{
1052 struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); 1060 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
1053 unsigned long flags; 1061 unsigned long flags;
1054 int reg = kcontrol->private_value & 0xff; 1062 int reg = kcontrol->private_value & 0xff;
1055 int shift = (kcontrol->private_value >> 8) & 0xff; 1063 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -1066,7 +1074,7 @@ static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1066 1074
1067static int snd_ad1848_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1075static int snd_ad1848_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1068{ 1076{
1069 struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); 1077 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
1070 unsigned long flags; 1078 unsigned long flags;
1071 int reg = kcontrol->private_value & 0xff; 1079 int reg = kcontrol->private_value & 0xff;
1072 int shift = (kcontrol->private_value >> 8) & 0xff; 1080 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -1100,7 +1108,7 @@ static int snd_ad1848_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
1100 1108
1101static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1109static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1102{ 1110{
1103 struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); 1111 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
1104 unsigned long flags; 1112 unsigned long flags;
1105 int left_reg = kcontrol->private_value & 0xff; 1113 int left_reg = kcontrol->private_value & 0xff;
1106 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1114 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -1122,7 +1130,7 @@ static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1122 1130
1123static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1131static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1124{ 1132{
1125 struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); 1133 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
1126 unsigned long flags; 1134 unsigned long flags;
1127 int left_reg = kcontrol->private_value & 0xff; 1135 int left_reg = kcontrol->private_value & 0xff;
1128 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1136 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -1159,7 +1167,7 @@ static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1159 1167
1160/* 1168/*
1161 */ 1169 */
1162int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, 1170int snd_ad1848_add_ctl_elem(struct snd_wss *chip,
1163 const struct ad1848_mix_elem *c) 1171 const struct ad1848_mix_elem *c)
1164{ 1172{
1165 static struct snd_kcontrol_new newctls[] = { 1173 static struct snd_kcontrol_new newctls[] = {
@@ -1227,7 +1235,7 @@ AD1848_SINGLE_TLV("Loopback Capture Volume", 0, AD1848_LOOPBACK, 1, 63, 0,
1227 db_scale_6bit), 1235 db_scale_6bit),
1228}; 1236};
1229 1237
1230int snd_ad1848_mixer(struct snd_ad1848 *chip) 1238int snd_ad1848_mixer(struct snd_wss *chip)
1231{ 1239{
1232 struct snd_card *card; 1240 struct snd_card *card;
1233 struct snd_pcm *pcm; 1241 struct snd_pcm *pcm;
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 4d198ec71e9b..aefd2f4a0572 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -151,7 +151,7 @@ struct snd_cmi8330 {
151 struct pnp_dev *play; 151 struct pnp_dev *play;
152#endif 152#endif
153 struct snd_card *card; 153 struct snd_card *card;
154 struct snd_ad1848 *wss; 154 struct snd_wss *wss;
155 struct snd_sb *sb; 155 struct snd_sb *sb;
156 156
157 struct snd_pcm *pcm; 157 struct snd_pcm *pcm;
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index fefb8597717c..ff9baf751b22 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -706,14 +706,10 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
706 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 706 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
707 int error; 707 int error;
708 struct snd_opti9xx *chip = card->private_data; 708 struct snd_opti9xx *chip = card->private_data;
709#if defined(CS4231) || defined(OPTi93X)
710 struct snd_wss *codec; 709 struct snd_wss *codec;
711#ifdef CS4231 710#ifdef CS4231
712 struct snd_timer *timer; 711 struct snd_timer *timer;
713#endif 712#endif
714#else
715 struct snd_ad1848 *codec;
716#endif
717 struct snd_pcm *pcm; 713 struct snd_pcm *pcm;
718 struct snd_rawmidi *rmidi; 714 struct snd_rawmidi *rmidi;
719 struct snd_hwdep *synth; 715 struct snd_hwdep *synth;
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index da3d152bcad4..1771f15d6d3c 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -397,7 +397,7 @@ static int __devinit sc6000_init_board(char __iomem *vport, int irq, int dma,
397 return 0; 397 return 0;
398} 398}
399 399
400static int __devinit snd_sc6000_mixer(struct snd_ad1848 *chip) 400static int __devinit snd_sc6000_mixer(struct snd_wss *chip)
401{ 401{
402 struct snd_card *card = chip->card; 402 struct snd_card *card = chip->card;
403 struct snd_ctl_elem_id id1, id2; 403 struct snd_ctl_elem_id id1, id2;
@@ -483,7 +483,7 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev)
483 int xirq = irq[dev]; 483 int xirq = irq[dev];
484 int xdma = dma[dev]; 484 int xdma = dma[dev];
485 struct snd_card *card; 485 struct snd_card *card;
486 struct snd_ad1848 *chip; 486 struct snd_wss *chip;
487 struct snd_opl3 *opl3; 487 struct snd_opl3 *opl3;
488 char __iomem *vport; 488 char __iomem *vport;
489 char __iomem *vmss_port; 489 char __iomem *vmss_port;
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index a07274ecb149..879c00c566ba 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -180,7 +180,7 @@ AD1848_DOUBLE("Aux Playback Switch", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 7
180AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0) 180AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0)
181}; 181};
182 182
183static int __devinit snd_sgalaxy_mixer(struct snd_ad1848 *chip) 183static int __devinit snd_sgalaxy_mixer(struct snd_wss *chip)
184{ 184{
185 struct snd_card *card = chip->card; 185 struct snd_card *card = chip->card;
186 struct snd_ctl_elem_id id1, id2; 186 struct snd_ctl_elem_id id1, id2;
@@ -237,7 +237,7 @@ static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev)
237 static int possible_dmas[] = {1, 3, 0, -1}; 237 static int possible_dmas[] = {1, 3, 0, -1};
238 int err, xirq, xdma1; 238 int err, xirq, xdma1;
239 struct snd_card *card; 239 struct snd_card *card;
240 struct snd_ad1848 *chip; 240 struct snd_wss *chip;
241 241
242 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 242 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
243 if (card == NULL) 243 if (card == NULL)
@@ -312,7 +312,7 @@ static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n,
312 pm_message_t state) 312 pm_message_t state)
313{ 313{
314 struct snd_card *card = dev_get_drvdata(pdev); 314 struct snd_card *card = dev_get_drvdata(pdev);
315 struct snd_ad1848 *chip = card->private_data; 315 struct snd_wss *chip = card->private_data;
316 316
317 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 317 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
318 chip->suspend(chip); 318 chip->suspend(chip);
@@ -322,7 +322,7 @@ static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n,
322static int snd_sgalaxy_resume(struct device *pdev, unsigned int n) 322static int snd_sgalaxy_resume(struct device *pdev, unsigned int n)
323{ 323{
324 struct snd_card *card = dev_get_drvdata(pdev); 324 struct snd_card *card = dev_get_drvdata(pdev);
325 struct snd_ad1848 *chip = card->private_data; 325 struct snd_wss *chip = card->private_data;
326 326
327 chip->resume(chip); 327 chip->resume(chip);
328 snd_ad1848_out(chip, SGALAXY_AUXC_LEFT, chip->image[SGALAXY_AUXC_LEFT]); 328 snd_ad1848_out(chip, SGALAXY_AUXC_LEFT, chip->image[SGALAXY_AUXC_LEFT]);