Lines Matching refs:chip

18  * - The chip has one half duplex pcm (with very limited full duplex support).
88 unsigned long port; /* port of ESS chip */
89 unsigned long ctrl_port; /* Control port of ESS chip */
93 int irq; /* IRQ number of ESS chip */
96 unsigned short version; /* version of ESS chip */
162 static int snd_es18xx_dsp_command(struct snd_es18xx *chip, unsigned char val)
167 if ((inb(chip->port + 0x0C) & 0x80) == 0) {
168 outb(val, chip->port + 0x0C);
175 static int snd_es18xx_dsp_get_byte(struct snd_es18xx *chip)
180 if (inb(chip->port + 0x0C) & 0x40)
181 return inb(chip->port + 0x0A);
183 chip->port + 0x0A, inb(chip->port + 0x0A));
189 static int snd_es18xx_write(struct snd_es18xx *chip,
195 spin_lock_irqsave(&chip->reg_lock, flags);
196 ret = snd_es18xx_dsp_command(chip, reg);
199 ret = snd_es18xx_dsp_command(chip, data);
201 spin_unlock_irqrestore(&chip->reg_lock, flags);
208 static int snd_es18xx_read(struct snd_es18xx *chip, unsigned char reg)
212 spin_lock_irqsave(&chip->reg_lock, flags);
213 ret = snd_es18xx_dsp_command(chip, 0xC0);
216 ret = snd_es18xx_dsp_command(chip, reg);
219 data = snd_es18xx_dsp_get_byte(chip);
225 spin_unlock_irqrestore(&chip->reg_lock, flags);
230 static int snd_es18xx_bits(struct snd_es18xx *chip, unsigned char reg,
236 spin_lock_irqsave(&chip->reg_lock, flags);
237 ret = snd_es18xx_dsp_command(chip, 0xC0);
240 ret = snd_es18xx_dsp_command(chip, reg);
243 ret = snd_es18xx_dsp_get_byte(chip);
250 ret = snd_es18xx_dsp_command(chip, reg);
254 ret = snd_es18xx_dsp_command(chip, new);
264 spin_unlock_irqrestore(&chip->reg_lock, flags);
268 static inline void snd_es18xx_mixer_write(struct snd_es18xx *chip,
272 spin_lock_irqsave(&chip->mixer_lock, flags);
273 outb(reg, chip->port + 0x04);
274 outb(data, chip->port + 0x05);
275 spin_unlock_irqrestore(&chip->mixer_lock, flags);
281 static inline int snd_es18xx_mixer_read(struct snd_es18xx *chip, unsigned char reg)
285 spin_lock_irqsave(&chip->mixer_lock, flags);
286 outb(reg, chip->port + 0x04);
287 data = inb(chip->port + 0x05);
288 spin_unlock_irqrestore(&chip->mixer_lock, flags);
296 static inline int snd_es18xx_mixer_bits(struct snd_es18xx *chip, unsigned char reg,
301 spin_lock_irqsave(&chip->mixer_lock, flags);
302 outb(reg, chip->port + 0x04);
303 old = inb(chip->port + 0x05);
307 outb(new, chip->port + 0x05);
313 spin_unlock_irqrestore(&chip->mixer_lock, flags);
317 static inline int snd_es18xx_mixer_writable(struct snd_es18xx *chip, unsigned char reg,
322 spin_lock_irqsave(&chip->mixer_lock, flags);
323 outb(reg, chip->port + 0x04);
324 old = inb(chip->port + 0x05);
326 outb(expected, chip->port + 0x05);
327 new = inb(chip->port + 0x05);
328 spin_unlock_irqrestore(&chip->mixer_lock, flags);
337 static int snd_es18xx_reset(struct snd_es18xx *chip)
340 outb(0x03, chip->port + 0x06);
341 inb(chip->port + 0x06);
342 outb(0x00, chip->port + 0x06);
343 for(i = 0; i < MILLISECOND && !(inb(chip->port + 0x0E) & 0x80); i++);
344 if (inb(chip->port + 0x0A) != 0xAA)
349 static int snd_es18xx_reset_fifo(struct snd_es18xx *chip)
351 outb(0x02, chip->port + 0x06);
352 inb(chip->port + 0x06);
353 outb(0x00, chip->port + 0x06);
398 static void snd_es18xx_rate_set(struct snd_es18xx *chip,
404 if (chip->caps & ES18XX_NEW_RATE) {
419 if ((chip->caps & ES18XX_PCM2) && mode == DAC2) {
420 snd_es18xx_mixer_write(chip, 0x70, bits);
425 snd_es18xx_write(chip, 0xA2, div0);
426 snd_es18xx_mixer_write(chip, 0x72, div0);
428 snd_es18xx_write(chip, 0xA1, bits);
429 snd_es18xx_write(chip, 0xA2, div0);
436 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
445 if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
446 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
447 (chip->capture_a_substream) &&
452 chip->dma2_shift = shift;
454 chip->dma1_shift = shift;
459 static int snd_es18xx_playback1_prepare(struct snd_es18xx *chip,
466 snd_es18xx_rate_set(chip, substream, DAC2);
470 snd_es18xx_mixer_write(chip, 0x74, count & 0xff);
471 snd_es18xx_mixer_write(chip, 0x76, count >> 8);
474 snd_es18xx_mixer_bits(chip, 0x7A, 0x07,
480 snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
485 static int snd_es18xx_playback1_trigger(struct snd_es18xx *chip,
492 if (chip->active & DAC2)
494 chip->active |= DAC2;
496 if (chip->dma2 >= 4)
497 snd_es18xx_mixer_write(chip, 0x78, 0xb3);
499 snd_es18xx_mixer_write(chip, 0x78, 0x93);
503 if (chip->caps & ES18XX_PCM2)
505 snd_es18xx_mixer_write(chip, 0x7C, chip->audio2_vol);
508 snd_es18xx_dsp_command(chip, 0xD1);
513 if (!(chip->active & DAC2))
515 chip->active &= ~DAC2;
517 snd_es18xx_mixer_write(chip, 0x78, 0x00);
520 if (chip->caps & ES18XX_PCM2)
522 snd_es18xx_mixer_write(chip, 0x7C, 0);
525 snd_es18xx_dsp_command(chip, 0xD3);
538 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
542 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
543 chip->playback_a_substream &&
552 chip->dma1_shift = shift;
558 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
563 snd_es18xx_reset_fifo(chip);
566 snd_es18xx_bits(chip, 0xA8, 0x03, runtime->channels == 1 ? 0x02 : 0x01);
568 snd_es18xx_rate_set(chip, substream, ADC1);
572 snd_es18xx_write(chip, 0xA4, count & 0xff);
573 snd_es18xx_write(chip, 0xA5, count >> 8);
580 snd_es18xx_write(chip, 0xB7,
582 snd_es18xx_write(chip, 0xB7, 0x90 |
588 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
596 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
601 if (chip->active & ADC1)
603 chip->active |= ADC1;
605 snd_es18xx_write(chip, 0xB8, 0x0f);
609 if (!(chip->active & ADC1))
611 chip->active &= ~ADC1;
613 snd_es18xx_write(chip, 0xB8, 0x00);
622 static int snd_es18xx_playback2_prepare(struct snd_es18xx *chip,
629 snd_es18xx_reset_fifo(chip);
632 snd_es18xx_bits(chip, 0xA8, 0x03, runtime->channels == 1 ? 0x02 : 0x01);
634 snd_es18xx_rate_set(chip, substream, DAC1);
638 snd_es18xx_write(chip, 0xA4, count & 0xff);
639 snd_es18xx_write(chip, 0xA5, count >> 8);
642 snd_es18xx_write(chip, 0xB6,
644 snd_es18xx_write(chip, 0xB7,
646 snd_es18xx_write(chip, 0xB7, 0x90 |
652 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
657 static int snd_es18xx_playback2_trigger(struct snd_es18xx *chip,
664 if (chip->active & DAC1)
666 chip->active |= DAC1;
668 snd_es18xx_write(chip, 0xB8, 0x05);
673 snd_es18xx_dsp_command(chip, 0xD1);
678 if (!(chip->active & DAC1))
680 chip->active &= ~DAC1;
682 snd_es18xx_write(chip, 0xB8, 0x00);
687 snd_es18xx_dsp_command(chip, 0xD3);
699 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
700 if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
701 return snd_es18xx_playback1_prepare(chip, substream);
703 return snd_es18xx_playback2_prepare(chip, substream);
709 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
710 if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
711 return snd_es18xx_playback1_trigger(chip, substream, cmd);
713 return snd_es18xx_playback2_trigger(chip, substream, cmd);
719 struct snd_es18xx *chip = card->private_data;
722 if (chip->caps & ES18XX_CONTROL) {
724 status = inb(chip->ctrl_port + 6);
727 status = snd_es18xx_mixer_read(chip, 0x7f) >> 4;
732 if (inb(chip->port + 0x0C) & 0x01)
734 if (snd_es18xx_mixer_read(chip, 0x7A) & 0x80)
736 if ((chip->caps & ES18XX_HWV) &&
737 snd_es18xx_mixer_read(chip, 0x64) & 0x10)
744 if (chip->active & DAC2)
745 snd_pcm_period_elapsed(chip->playback_a_substream);
747 snd_es18xx_mixer_bits(chip, 0x7A, 0x80, 0x00);
751 if (chip->active & ADC1)
752 snd_pcm_period_elapsed(chip->capture_a_substream);
754 else if (chip->active & DAC1)
755 snd_pcm_period_elapsed(chip->playback_b_substream);
757 inb(chip->port + 0x0E);
761 if ((status & MPU_IRQ) && chip->rmidi)
762 snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data);
767 if (chip->caps & ES18XX_HWV) {
768 split = snd_es18xx_mixer_read(chip, 0x64) & 0x80;
770 &chip->hw_switch->id);
772 &chip->hw_volume->id);
776 &chip->master_switch->id);
778 &chip->master_volume->id);
781 snd_es18xx_mixer_write(chip, 0x66, 0x00);
788 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
792 if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
793 if (!(chip->active & DAC2))
795 pos = snd_dma_pointer(chip->dma2, size);
796 return pos >> chip->dma2_shift;
798 if (!(chip->active & DAC1))
800 pos = snd_dma_pointer(chip->dma1, size);
801 return pos >> chip->dma1_shift;
807 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
811 if (!(chip->active & ADC1))
813 pos = snd_dma_pointer(chip->dma1, size);
814 return pos >> chip->dma1_shift;
860 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
862 if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
863 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
864 chip->capture_a_substream &&
865 chip->capture_a_substream->runtime->channels != 1)
867 chip->playback_a_substream = substream;
869 if (chip->capture_a_substream)
871 chip->playback_b_substream = substream;
878 (chip->caps & ES18XX_NEW_RATE) ? &new_hw_constraints_clocks : &old_hw_constraints_clocks);
885 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
887 if (chip->playback_b_substream)
889 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
890 chip->playback_a_substream &&
891 chip->playback_a_substream->runtime->channels != 1)
893 chip->capture_a_substream = substream;
896 (chip->caps & ES18XX_NEW_RATE) ? &new_hw_constraints_clocks : &old_hw_constraints_clocks);
902 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
904 if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
905 chip->playback_a_substream = NULL;
907 chip->playback_b_substream = NULL;
914 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
916 chip->capture_a_substream = NULL;
949 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
951 switch (chip->version) {
969 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
970 int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07;
971 if (!(chip->version == 0x1869 || chip->version == 0x1879)) {
974 (chip->version == 0x1887 || chip->version == 0x1888) &&
975 (snd_es18xx_mixer_read(chip, 0x7a) & 0x08)
986 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
990 switch (chip->version) {
997 retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x08) != 0x08;
1000 retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00;
1018 return (snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val) || retVal;
1025 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1026 unsigned char val = snd_es18xx_mixer_read(chip, 0x50);
1033 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1037 oval = snd_es18xx_mixer_read(chip, 0x50) & 0x0c;
1040 snd_es18xx_mixer_write(chip, 0x50, nval & ~0x04);
1041 snd_es18xx_mixer_write(chip, 0x50, nval);
1057 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1058 ucontrol->value.integer.value[0] = snd_es18xx_mixer_read(chip, 0x61) & 0x3f;
1059 ucontrol->value.integer.value[1] = snd_es18xx_mixer_read(chip, 0x63) & 0x3f;
1067 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1068 ucontrol->value.integer.value[0] = !(snd_es18xx_mixer_read(chip, 0x61) & 0x40);
1069 ucontrol->value.integer.value[1] = !(snd_es18xx_mixer_read(chip, 0x63) & 0x40);
1075 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1076 chip->master_volume = NULL;
1077 chip->master_switch = NULL;
1078 chip->hw_volume = NULL;
1079 chip->hw_switch = NULL;
1082 static int snd_es18xx_reg_bits(struct snd_es18xx *chip, unsigned char reg,
1086 return snd_es18xx_mixer_bits(chip, reg, mask, val);
1088 return snd_es18xx_bits(chip, reg, mask, val);
1091 static int snd_es18xx_reg_read(struct snd_es18xx *chip, unsigned char reg)
1094 return snd_es18xx_mixer_read(chip, reg);
1096 return snd_es18xx_read(chip, reg);
1121 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1130 val = inb(chip->port + ES18XX_PM);
1132 val = snd_es18xx_reg_read(chip, reg);
1141 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1155 unsigned char cur = inb(chip->port + ES18XX_PM);
1159 outb((cur & ~mask) | val, chip->port + ES18XX_PM);
1163 return snd_es18xx_reg_bits(chip, reg, mask, val) != val;
1185 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1194 left = snd_es18xx_reg_read(chip, left_reg);
1196 right = snd_es18xx_reg_read(chip, right_reg);
1210 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1232 if (snd_es18xx_reg_bits(chip, left_reg, mask1, val1) != val1)
1234 if (snd_es18xx_reg_bits(chip, right_reg, mask2, val2) != val2)
1237 change = (snd_es18xx_reg_bits(chip, left_reg, mask1 | mask2,
1348 static int snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg)
1352 outb(reg, chip->ctrl_port);
1353 data = inb(chip->ctrl_port + 1);
1357 static void snd_es18xx_config_write(struct snd_es18xx *chip,
1362 outb(reg, chip->ctrl_port);
1363 outb(data, chip->ctrl_port + 1);
1369 static int snd_es18xx_initialize(struct snd_es18xx *chip,
1376 snd_es18xx_dsp_command(chip, 0xC6);
1378 snd_es18xx_mixer_write(chip, 0x00, 0x00);
1381 snd_es18xx_write(chip, 0xB9, 2);
1382 if (chip->caps & ES18XX_CONTROL) {
1384 snd_es18xx_config_write(chip, 0x27, chip->irq);
1387 snd_es18xx_config_write(chip, 0x62, fm_port >> 8);
1388 snd_es18xx_config_write(chip, 0x63, fm_port & 0xff);
1392 snd_es18xx_config_write(chip, 0x64, mpu_port >> 8);
1393 snd_es18xx_config_write(chip, 0x65, mpu_port & 0xff);
1395 snd_es18xx_config_write(chip, 0x28, chip->irq);
1398 snd_es18xx_config_write(chip, 0x70, chip->irq);
1400 snd_es18xx_config_write(chip, 0x72, chip->irq);
1402 snd_es18xx_config_write(chip, 0x74, chip->dma1);
1404 snd_es18xx_config_write(chip, 0x75, chip->dma2);
1407 snd_es18xx_write(chip, 0xB1, 0x50);
1409 snd_es18xx_mixer_write(chip, 0x7A, 0x40);
1411 snd_es18xx_write(chip, 0xB2, 0x50);
1413 snd_es18xx_mixer_write(chip, 0x64, 0x42);
1415 snd_es18xx_mixer_bits(chip, 0x48, 0x10, 0x10);
1419 switch (chip->irq) {
1434 snd_printk(KERN_ERR "invalid irq %d\n", chip->irq);
1437 switch (chip->dma1) {
1448 snd_printk(KERN_ERR "invalid dma1 %d\n", chip->dma1);
1451 switch (chip->dma2) {
1465 snd_printk(KERN_ERR "invalid dma2 %d\n", chip->dma2);
1470 snd_es18xx_write(chip, 0xB1, 0x50 | (irqmask << 2));
1472 snd_es18xx_write(chip, 0xB2, 0x50 | (dma1mask << 2));
1474 snd_es18xx_mixer_bits(chip, 0x7d, 0x07, 0x04 | dma2mask);
1477 snd_es18xx_mixer_write(chip, 0x7A, 0x68);
1479 snd_es18xx_mixer_write(chip, 0x64, 0x06);
1484 snd_es18xx_mixer_write(chip, 0x40,
1487 snd_es18xx_mixer_write(chip, 0x7f, ((irqmask + 1) << 1) | 0x01);
1489 if (chip->caps & ES18XX_NEW_RATE) {
1493 snd_es18xx_mixer_write(chip, 0x71, 0x32);
1495 if (!(chip->caps & ES18XX_PCM2)) {
1497 snd_es18xx_write(chip, 0xB7, 0x80);
1499 if (chip->caps & ES18XX_SPATIALIZER) {
1501 snd_es18xx_mixer_write(chip, 0x54, 0x8f);
1502 snd_es18xx_mixer_write(chip, 0x56, 0x95);
1503 snd_es18xx_mixer_write(chip, 0x58, 0x94);
1504 snd_es18xx_mixer_write(chip, 0x5a, 0x80);
1507 switch (chip->version) {
1511 //snd_es18xx_mixer_bits(chip, 0x71, 0x40, 0x40);
1514 snd_es18xx_config_write(chip, 0x29, snd_es18xx_config_read(chip, 0x29) | 0x40);
1518 if (chip->caps & ES18XX_MUTEREC)
1520 if (chip->caps & ES18XX_RECMIX)
1521 snd_es18xx_mixer_write(chip, 0x1c, 0x05 | mask);
1523 snd_es18xx_mixer_write(chip, 0x1c, 0x00 | mask);
1524 snd_es18xx_write(chip, 0xb4, 0x00);
1528 snd_es18xx_dsp_command(chip, 0xD1);
1534 static int snd_es18xx_identify(struct snd_es18xx *chip)
1539 if (snd_es18xx_reset(chip) < 0) {
1540 snd_printk(KERN_ERR "reset at 0x%lx failed!!!\n", chip->port);
1544 snd_es18xx_dsp_command(chip, 0xe7);
1545 hi = snd_es18xx_dsp_get_byte(chip);
1549 lo = snd_es18xx_dsp_get_byte(chip);
1554 chip->version = 0x488;
1561 chip->version = 0x688;
1565 outb(0x40, chip->port + 0x04);
1567 hi = inb(chip->port + 0x05);
1569 lo = inb(chip->port + 0x05);
1571 chip->version = hi << 8 | lo;
1572 chip->ctrl_port = inb(chip->port + 0x05) << 8;
1574 chip->ctrl_port += inb(chip->port + 0x05);
1576 if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) {
1577 snd_printk(KERN_ERR PFX "unable go grab port 0x%lx\n", chip->ctrl_port);
1585 if (snd_es18xx_mixer_writable(chip, 0x64, 0x04)) {
1587 if (snd_es18xx_mixer_writable(chip, 0x70, 0x7f)) {
1589 if (snd_es18xx_mixer_writable(chip, 0x64, 0x20)) {
1590 chip->version = 0x1887;
1592 chip->version = 0x1888;
1595 chip->version = 0x1788;
1599 chip->version = 0x1688;
1603 static int snd_es18xx_probe(struct snd_es18xx *chip,
1607 if (snd_es18xx_identify(chip) < 0) {
1608 snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port);
1612 switch (chip->version) {
1614 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL | ES18XX_GPO_2BIT;
1617 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV | ES18XX_GPO_2BIT;
1620 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL;
1623 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV;
1627 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_GPO_2BIT;
1630 snd_printk(KERN_ERR "[0x%lx] unsupported chip ES%x\n",
1631 chip->port, chip->version);
1635 snd_printd("[0x%lx] ESS%x chip found\n", chip->port, chip->version);
1637 if (chip->dma1 == chip->dma2)
1638 chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME);
1640 return snd_es18xx_initialize(chip, mpu_port, fm_port);
1663 struct snd_es18xx *chip = card->private_data;
1668 sprintf(str, "ES%x", chip->version);
1669 if (chip->caps & ES18XX_PCM2)
1680 pcm->private_data = chip;
1682 if (chip->caps & ES18XX_DUPLEX_SAME)
1684 if (! (chip->caps & ES18XX_PCM2))
1686 sprintf(pcm->name, "ESS AudioDrive ES%x", chip->version);
1687 chip->pcm = pcm;
1691 chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
1699 struct snd_es18xx *chip = card->private_data;
1704 chip->pm_reg = (unsigned char)snd_es18xx_read(chip, ES18XX_PM);
1705 chip->pm_reg |= (ES18XX_PM_FM | ES18XX_PM_SUS);
1706 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg);
1707 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_SUS);
1714 struct snd_es18xx *chip = card->private_data;
1717 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM);
1726 struct snd_es18xx *chip = card->private_data;
1728 release_and_free_resource(chip->res_port);
1729 release_and_free_resource(chip->res_ctrl_port);
1730 release_and_free_resource(chip->res_mpu_port);
1731 if (chip->irq >= 0)
1732 free_irq(chip->irq, (void *) card);
1733 if (chip->dma1 >= 0) {
1734 disable_dma(chip->dma1);
1735 free_dma(chip->dma1);
1737 if (chip->dma2 >= 0 && chip->dma1 != chip->dma2) {
1738 disable_dma(chip->dma2);
1739 free_dma(chip->dma2);
1755 struct snd_es18xx *chip = card->private_data;
1761 spin_lock_init(&chip->reg_lock);
1762 spin_lock_init(&chip->mixer_lock);
1763 chip->port = port;
1764 chip->irq = -1;
1765 chip->dma1 = -1;
1766 chip->dma2 = -1;
1767 chip->audio2_vol = 0x00;
1768 chip->active = 0;
1770 chip->res_port = request_region(port, 16, "ES18xx");
1771 if (chip->res_port == NULL) {
1783 chip->irq = irq;
1784 card->sync_irq = chip->irq;
1791 chip->dma1 = dma1;
1798 chip->dma2 = dma2;
1800 if (snd_es18xx_probe(chip, mpu_port, fm_port) < 0) {
1804 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
1814 struct snd_es18xx *chip = card->private_data;
1818 strcpy(card->mixername, chip->pcm->name);
1822 kctl = snd_ctl_new1(&snd_es18xx_base_controls[idx], chip);
1823 if (chip->caps & ES18XX_HWV) {
1826 chip->master_volume = kctl;
1830 chip->master_switch = kctl;
1838 if (chip->caps & ES18XX_PCM2) {
1840 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm2_controls[idx], chip))) < 0)
1845 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm1_controls[idx], chip))) < 0)
1850 if (chip->caps & ES18XX_RECMIX) {
1852 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0)
1856 switch (chip->version) {
1858 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre1_control, chip))) < 0)
1863 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre2_control, chip))) < 0)
1867 if (chip->caps & ES18XX_SPATIALIZER) {
1869 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_spatializer_controls[idx], chip))) < 0)
1873 if (chip->caps & ES18XX_HWV) {
1876 kctl = snd_ctl_new1(&snd_es18xx_hw_volume_controls[idx], chip);
1878 chip->hw_volume = kctl;
1880 chip->hw_switch = kctl;
1889 if (chip->version != 0x1868) {
1891 chip));
1895 if (chip->version == 0x1869) {
1899 chip));
1903 } else if (chip->version == 0x1878) {
1905 chip));
1908 } else if (chip->version == 0x1879) {
1912 chip));
1917 if (chip->caps & ES18XX_GPO_2BIT) {
1921 chip));
2025 static int snd_audiodrive_pnp(int dev, struct snd_es18xx *chip,
2028 chip->dev = pdev;
2029 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0)
2055 static int snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip,
2059 chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
2060 if (chip->dev == NULL)
2063 chip->devc = pnp_request_card_device(card, id->devs[1].id, NULL);
2064 if (chip->devc == NULL)
2068 if (pnp_activate_dev(chip->devc) < 0) {
2073 (unsigned long long)pnp_port_start(chip->devc, 0));
2074 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0)
2096 struct snd_es18xx *chip = card->private_data;
2106 sprintf(card->driver, "ES%x", chip->version);
2108 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
2112 chip->port,
2117 chip->port,
2144 -1, &chip->rmidi);