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 */
90 int irq; /* IRQ number of ESS chip */
93 unsigned short version; /* version of ESS chip */
159 static int snd_es18xx_dsp_command(struct snd_es18xx *chip, unsigned char val)
164 if ((inb(chip->port + 0x0C) & 0x80) == 0) {
165 outb(val, chip->port + 0x0C);
172 static int snd_es18xx_dsp_get_byte(struct snd_es18xx *chip)
177 if (inb(chip->port + 0x0C) & 0x40)
178 return inb(chip->port + 0x0A);
180 chip->port + 0x0A, inb(chip->port + 0x0A));
186 static int snd_es18xx_write(struct snd_es18xx *chip,
192 spin_lock_irqsave(&chip->reg_lock, flags);
193 ret = snd_es18xx_dsp_command(chip, reg);
196 ret = snd_es18xx_dsp_command(chip, data);
198 spin_unlock_irqrestore(&chip->reg_lock, flags);
205 static int snd_es18xx_read(struct snd_es18xx *chip, unsigned char reg)
209 spin_lock_irqsave(&chip->reg_lock, flags);
210 ret = snd_es18xx_dsp_command(chip, 0xC0);
213 ret = snd_es18xx_dsp_command(chip, reg);
216 data = snd_es18xx_dsp_get_byte(chip);
222 spin_unlock_irqrestore(&chip->reg_lock, flags);
227 static int snd_es18xx_bits(struct snd_es18xx *chip, unsigned char reg,
233 spin_lock_irqsave(&chip->reg_lock, flags);
234 ret = snd_es18xx_dsp_command(chip, 0xC0);
237 ret = snd_es18xx_dsp_command(chip, reg);
240 ret = snd_es18xx_dsp_get_byte(chip);
247 ret = snd_es18xx_dsp_command(chip, reg);
251 ret = snd_es18xx_dsp_command(chip, new);
261 spin_unlock_irqrestore(&chip->reg_lock, flags);
265 static inline void snd_es18xx_mixer_write(struct snd_es18xx *chip,
269 spin_lock_irqsave(&chip->mixer_lock, flags);
270 outb(reg, chip->port + 0x04);
271 outb(data, chip->port + 0x05);
272 spin_unlock_irqrestore(&chip->mixer_lock, flags);
278 static inline int snd_es18xx_mixer_read(struct snd_es18xx *chip, unsigned char reg)
282 spin_lock_irqsave(&chip->mixer_lock, flags);
283 outb(reg, chip->port + 0x04);
284 data = inb(chip->port + 0x05);
285 spin_unlock_irqrestore(&chip->mixer_lock, flags);
293 static inline int snd_es18xx_mixer_bits(struct snd_es18xx *chip, unsigned char reg,
298 spin_lock_irqsave(&chip->mixer_lock, flags);
299 outb(reg, chip->port + 0x04);
300 old = inb(chip->port + 0x05);
304 outb(new, chip->port + 0x05);
310 spin_unlock_irqrestore(&chip->mixer_lock, flags);
314 static inline int snd_es18xx_mixer_writable(struct snd_es18xx *chip, unsigned char reg,
319 spin_lock_irqsave(&chip->mixer_lock, flags);
320 outb(reg, chip->port + 0x04);
321 old = inb(chip->port + 0x05);
323 outb(expected, chip->port + 0x05);
324 new = inb(chip->port + 0x05);
325 spin_unlock_irqrestore(&chip->mixer_lock, flags);
334 static int snd_es18xx_reset(struct snd_es18xx *chip)
337 outb(0x03, chip->port + 0x06);
338 inb(chip->port + 0x06);
339 outb(0x00, chip->port + 0x06);
340 for(i = 0; i < MILLISECOND && !(inb(chip->port + 0x0E) & 0x80); i++);
341 if (inb(chip->port + 0x0A) != 0xAA)
346 static int snd_es18xx_reset_fifo(struct snd_es18xx *chip)
348 outb(0x02, chip->port + 0x06);
349 inb(chip->port + 0x06);
350 outb(0x00, chip->port + 0x06);
395 static void snd_es18xx_rate_set(struct snd_es18xx *chip,
401 if (chip->caps & ES18XX_NEW_RATE) {
416 if ((chip->caps & ES18XX_PCM2) && mode == DAC2) {
417 snd_es18xx_mixer_write(chip, 0x70, bits);
422 snd_es18xx_write(chip, 0xA2, div0);
423 snd_es18xx_mixer_write(chip, 0x72, div0);
425 snd_es18xx_write(chip, 0xA1, bits);
426 snd_es18xx_write(chip, 0xA2, div0);
433 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
442 if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
443 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
444 (chip->capture_a_substream) &&
449 chip->dma2_shift = shift;
451 chip->dma1_shift = shift;
456 static int snd_es18xx_playback1_prepare(struct snd_es18xx *chip,
463 snd_es18xx_rate_set(chip, substream, DAC2);
467 snd_es18xx_mixer_write(chip, 0x74, count & 0xff);
468 snd_es18xx_mixer_write(chip, 0x76, count >> 8);
471 snd_es18xx_mixer_bits(chip, 0x7A, 0x07,
477 snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
482 static int snd_es18xx_playback1_trigger(struct snd_es18xx *chip,
489 if (chip->active & DAC2)
491 chip->active |= DAC2;
493 if (chip->dma2 >= 4)
494 snd_es18xx_mixer_write(chip, 0x78, 0xb3);
496 snd_es18xx_mixer_write(chip, 0x78, 0x93);
500 if (chip->caps & ES18XX_PCM2)
502 snd_es18xx_mixer_write(chip, 0x7C, chip->audio2_vol);
505 snd_es18xx_dsp_command(chip, 0xD1);
510 if (!(chip->active & DAC2))
512 chip->active &= ~DAC2;
514 snd_es18xx_mixer_write(chip, 0x78, 0x00);
517 if (chip->caps & ES18XX_PCM2)
519 snd_es18xx_mixer_write(chip, 0x7C, 0);
522 snd_es18xx_dsp_command(chip, 0xD3);
535 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
539 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
540 chip->playback_a_substream &&
549 chip->dma1_shift = shift;
555 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
560 snd_es18xx_reset_fifo(chip);
563 snd_es18xx_bits(chip, 0xA8, 0x03, runtime->channels == 1 ? 0x02 : 0x01);
565 snd_es18xx_rate_set(chip, substream, ADC1);
569 snd_es18xx_write(chip, 0xA4, count & 0xff);
570 snd_es18xx_write(chip, 0xA5, count >> 8);
577 snd_es18xx_write(chip, 0xB7,
579 snd_es18xx_write(chip, 0xB7, 0x90 |
585 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
593 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
598 if (chip->active & ADC1)
600 chip->active |= ADC1;
602 snd_es18xx_write(chip, 0xB8, 0x0f);
606 if (!(chip->active & ADC1))
608 chip->active &= ~ADC1;
610 snd_es18xx_write(chip, 0xB8, 0x00);
619 static int snd_es18xx_playback2_prepare(struct snd_es18xx *chip,
626 snd_es18xx_reset_fifo(chip);
629 snd_es18xx_bits(chip, 0xA8, 0x03, runtime->channels == 1 ? 0x02 : 0x01);
631 snd_es18xx_rate_set(chip, substream, DAC1);
635 snd_es18xx_write(chip, 0xA4, count & 0xff);
636 snd_es18xx_write(chip, 0xA5, count >> 8);
639 snd_es18xx_write(chip, 0xB6,
641 snd_es18xx_write(chip, 0xB7,
643 snd_es18xx_write(chip, 0xB7, 0x90 |
649 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
654 static int snd_es18xx_playback2_trigger(struct snd_es18xx *chip,
661 if (chip->active & DAC1)
663 chip->active |= DAC1;
665 snd_es18xx_write(chip, 0xB8, 0x05);
670 snd_es18xx_dsp_command(chip, 0xD1);
675 if (!(chip->active & DAC1))
677 chip->active &= ~DAC1;
679 snd_es18xx_write(chip, 0xB8, 0x00);
684 snd_es18xx_dsp_command(chip, 0xD3);
696 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
697 if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
698 return snd_es18xx_playback1_prepare(chip, substream);
700 return snd_es18xx_playback2_prepare(chip, substream);
706 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
707 if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
708 return snd_es18xx_playback1_trigger(chip, substream, cmd);
710 return snd_es18xx_playback2_trigger(chip, substream, cmd);
716 struct snd_es18xx *chip = card->private_data;
719 if (chip->caps & ES18XX_CONTROL) {
721 status = inb(chip->ctrl_port + 6);
724 status = snd_es18xx_mixer_read(chip, 0x7f) >> 4;
729 if (inb(chip->port + 0x0C) & 0x01)
731 if (snd_es18xx_mixer_read(chip, 0x7A) & 0x80)
733 if ((chip->caps & ES18XX_HWV) &&
734 snd_es18xx_mixer_read(chip, 0x64) & 0x10)
741 if (chip->active & DAC2)
742 snd_pcm_period_elapsed(chip->playback_a_substream);
744 snd_es18xx_mixer_bits(chip, 0x7A, 0x80, 0x00);
748 if (chip->active & ADC1)
749 snd_pcm_period_elapsed(chip->capture_a_substream);
751 else if (chip->active & DAC1)
752 snd_pcm_period_elapsed(chip->playback_b_substream);
754 inb(chip->port + 0x0E);
758 if ((status & MPU_IRQ) && chip->rmidi)
759 snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data);
764 if (chip->caps & ES18XX_HWV) {
765 split = snd_es18xx_mixer_read(chip, 0x64) & 0x80;
767 &chip->hw_switch->id);
769 &chip->hw_volume->id);
773 &chip->master_switch->id);
775 &chip->master_volume->id);
778 snd_es18xx_mixer_write(chip, 0x66, 0x00);
785 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
789 if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
790 if (!(chip->active & DAC2))
792 pos = snd_dma_pointer(chip->dma2, size);
793 return pos >> chip->dma2_shift;
795 if (!(chip->active & DAC1))
797 pos = snd_dma_pointer(chip->dma1, size);
798 return pos >> chip->dma1_shift;
804 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
808 if (!(chip->active & ADC1))
810 pos = snd_dma_pointer(chip->dma1, size);
811 return pos >> chip->dma1_shift;
857 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
859 if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
860 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
861 chip->capture_a_substream &&
862 chip->capture_a_substream->runtime->channels != 1)
864 chip->playback_a_substream = substream;
866 if (chip->capture_a_substream)
868 chip->playback_b_substream = substream;
875 (chip->caps & ES18XX_NEW_RATE) ? &new_hw_constraints_clocks : &old_hw_constraints_clocks);
882 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
884 if (chip->playback_b_substream)
886 if ((chip->caps & ES18XX_DUPLEX_MONO) &&
887 chip->playback_a_substream &&
888 chip->playback_a_substream->runtime->channels != 1)
890 chip->capture_a_substream = substream;
893 (chip->caps & ES18XX_NEW_RATE) ? &new_hw_constraints_clocks : &old_hw_constraints_clocks);
899 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
901 if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
902 chip->playback_a_substream = NULL;
904 chip->playback_b_substream = NULL;
911 struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
913 chip->capture_a_substream = NULL;
946 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
948 switch (chip->version) {
966 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
967 int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07;
968 if (!(chip->version == 0x1869 || chip->version == 0x1879)) {
971 (chip->version == 0x1887 || chip->version == 0x1888) &&
972 (snd_es18xx_mixer_read(chip, 0x7a) & 0x08)
983 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
987 switch (chip->version) {
994 retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x08) != 0x08;
997 retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00;
1015 return (snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val) || retVal;
1022 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1023 unsigned char val = snd_es18xx_mixer_read(chip, 0x50);
1030 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1034 oval = snd_es18xx_mixer_read(chip, 0x50) & 0x0c;
1037 snd_es18xx_mixer_write(chip, 0x50, nval & ~0x04);
1038 snd_es18xx_mixer_write(chip, 0x50, nval);
1054 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1055 ucontrol->value.integer.value[0] = snd_es18xx_mixer_read(chip, 0x61) & 0x3f;
1056 ucontrol->value.integer.value[1] = snd_es18xx_mixer_read(chip, 0x63) & 0x3f;
1064 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1065 ucontrol->value.integer.value[0] = !(snd_es18xx_mixer_read(chip, 0x61) & 0x40);
1066 ucontrol->value.integer.value[1] = !(snd_es18xx_mixer_read(chip, 0x63) & 0x40);
1072 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1073 chip->master_volume = NULL;
1074 chip->master_switch = NULL;
1075 chip->hw_volume = NULL;
1076 chip->hw_switch = NULL;
1079 static int snd_es18xx_reg_bits(struct snd_es18xx *chip, unsigned char reg,
1083 return snd_es18xx_mixer_bits(chip, reg, mask, val);
1085 return snd_es18xx_bits(chip, reg, mask, val);
1088 static int snd_es18xx_reg_read(struct snd_es18xx *chip, unsigned char reg)
1091 return snd_es18xx_mixer_read(chip, reg);
1093 return snd_es18xx_read(chip, reg);
1118 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1127 val = inb(chip->port + ES18XX_PM);
1129 val = snd_es18xx_reg_read(chip, reg);
1138 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1152 unsigned char cur = inb(chip->port + ES18XX_PM);
1156 outb((cur & ~mask) | val, chip->port + ES18XX_PM);
1160 return snd_es18xx_reg_bits(chip, reg, mask, val) != val;
1182 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1191 left = snd_es18xx_reg_read(chip, left_reg);
1193 right = snd_es18xx_reg_read(chip, right_reg);
1207 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
1229 if (snd_es18xx_reg_bits(chip, left_reg, mask1, val1) != val1)
1231 if (snd_es18xx_reg_bits(chip, right_reg, mask2, val2) != val2)
1234 change = (snd_es18xx_reg_bits(chip, left_reg, mask1 | mask2,
1345 static int snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg)
1347 outb(reg, chip->ctrl_port);
1348 return inb(chip->ctrl_port + 1);
1351 static void snd_es18xx_config_write(struct snd_es18xx *chip,
1356 outb(reg, chip->ctrl_port);
1357 outb(data, chip->ctrl_port + 1);
1363 static int snd_es18xx_initialize(struct snd_es18xx *chip,
1370 snd_es18xx_dsp_command(chip, 0xC6);
1372 snd_es18xx_mixer_write(chip, 0x00, 0x00);
1375 snd_es18xx_write(chip, 0xB9, 2);
1376 if (chip->caps & ES18XX_CONTROL) {
1378 snd_es18xx_config_write(chip, 0x27, chip->irq);
1381 snd_es18xx_config_write(chip, 0x62, fm_port >> 8);
1382 snd_es18xx_config_write(chip, 0x63, fm_port & 0xff);
1386 snd_es18xx_config_write(chip, 0x64, mpu_port >> 8);
1387 snd_es18xx_config_write(chip, 0x65, mpu_port & 0xff);
1389 snd_es18xx_config_write(chip, 0x28, chip->irq);
1392 snd_es18xx_config_write(chip, 0x70, chip->irq);
1394 snd_es18xx_config_write(chip, 0x72, chip->irq);
1396 snd_es18xx_config_write(chip, 0x74, chip->dma1);
1398 snd_es18xx_config_write(chip, 0x75, chip->dma2);
1401 snd_es18xx_write(chip, 0xB1, 0x50);
1403 snd_es18xx_mixer_write(chip, 0x7A, 0x40);
1405 snd_es18xx_write(chip, 0xB2, 0x50);
1407 snd_es18xx_mixer_write(chip, 0x64, 0x42);
1409 snd_es18xx_mixer_bits(chip, 0x48, 0x10, 0x10);
1413 switch (chip->irq) {
1428 snd_printk(KERN_ERR "invalid irq %d\n", chip->irq);
1431 switch (chip->dma1) {
1442 snd_printk(KERN_ERR "invalid dma1 %d\n", chip->dma1);
1445 switch (chip->dma2) {
1459 snd_printk(KERN_ERR "invalid dma2 %d\n", chip->dma2);
1464 snd_es18xx_write(chip, 0xB1, 0x50 | (irqmask << 2));
1466 snd_es18xx_write(chip, 0xB2, 0x50 | (dma1mask << 2));
1468 snd_es18xx_mixer_bits(chip, 0x7d, 0x07, 0x04 | dma2mask);
1471 snd_es18xx_mixer_write(chip, 0x7A, 0x68);
1473 snd_es18xx_mixer_write(chip, 0x64, 0x06);
1478 snd_es18xx_mixer_write(chip, 0x40,
1481 snd_es18xx_mixer_write(chip, 0x7f, ((irqmask + 1) << 1) | 0x01);
1483 if (chip->caps & ES18XX_NEW_RATE) {
1487 snd_es18xx_mixer_write(chip, 0x71, 0x32);
1489 if (!(chip->caps & ES18XX_PCM2)) {
1491 snd_es18xx_write(chip, 0xB7, 0x80);
1493 if (chip->caps & ES18XX_SPATIALIZER) {
1495 snd_es18xx_mixer_write(chip, 0x54, 0x8f);
1496 snd_es18xx_mixer_write(chip, 0x56, 0x95);
1497 snd_es18xx_mixer_write(chip, 0x58, 0x94);
1498 snd_es18xx_mixer_write(chip, 0x5a, 0x80);
1501 switch (chip->version) {
1505 //snd_es18xx_mixer_bits(chip, 0x71, 0x40, 0x40);
1508 snd_es18xx_config_write(chip, 0x29, snd_es18xx_config_read(chip, 0x29) | 0x40);
1512 if (chip->caps & ES18XX_MUTEREC)
1514 if (chip->caps & ES18XX_RECMIX)
1515 snd_es18xx_mixer_write(chip, 0x1c, 0x05 | mask);
1517 snd_es18xx_mixer_write(chip, 0x1c, 0x00 | mask);
1518 snd_es18xx_write(chip, 0xb4, 0x00);
1522 snd_es18xx_dsp_command(chip, 0xD1);
1528 static int snd_es18xx_identify(struct snd_card *card, struct snd_es18xx *chip)
1533 if (snd_es18xx_reset(chip) < 0) {
1534 snd_printk(KERN_ERR "reset at 0x%lx failed!!!\n", chip->port);
1538 snd_es18xx_dsp_command(chip, 0xe7);
1539 hi = snd_es18xx_dsp_get_byte(chip);
1543 lo = snd_es18xx_dsp_get_byte(chip);
1548 chip->version = 0x488;
1555 chip->version = 0x688;
1559 outb(0x40, chip->port + 0x04);
1561 hi = inb(chip->port + 0x05);
1563 lo = inb(chip->port + 0x05);
1565 chip->version = hi << 8 | lo;
1566 chip->ctrl_port = inb(chip->port + 0x05) << 8;
1568 chip->ctrl_port += inb(chip->port + 0x05);
1570 if (!devm_request_region(card->dev, chip->ctrl_port, 8,
1572 snd_printk(KERN_ERR PFX "unable go grab port 0x%lx\n", chip->ctrl_port);
1580 if (snd_es18xx_mixer_writable(chip, 0x64, 0x04)) {
1582 if (snd_es18xx_mixer_writable(chip, 0x70, 0x7f)) {
1584 if (snd_es18xx_mixer_writable(chip, 0x64, 0x20)) {
1585 chip->version = 0x1887;
1587 chip->version = 0x1888;
1590 chip->version = 0x1788;
1594 chip->version = 0x1688;
1599 struct snd_es18xx *chip,
1603 if (snd_es18xx_identify(card, chip) < 0) {
1604 snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port);
1608 switch (chip->version) {
1610 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL | ES18XX_GPO_2BIT;
1613 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV | ES18XX_GPO_2BIT;
1616 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL;
1619 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV;
1623 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_GPO_2BIT;
1626 snd_printk(KERN_ERR "[0x%lx] unsupported chip ES%x\n",
1627 chip->port, chip->version);
1631 snd_printd("[0x%lx] ESS%x chip found\n", chip->port, chip->version);
1633 if (chip->dma1 == chip->dma2)
1634 chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME);
1636 return snd_es18xx_initialize(chip, mpu_port, fm_port);
1659 struct snd_es18xx *chip = card->private_data;
1664 sprintf(str, "ES%x", chip->version);
1665 if (chip->caps & ES18XX_PCM2)
1676 pcm->private_data = chip;
1678 if (chip->caps & ES18XX_DUPLEX_SAME)
1680 if (! (chip->caps & ES18XX_PCM2))
1682 sprintf(pcm->name, "ESS AudioDrive ES%x", chip->version);
1683 chip->pcm = pcm;
1687 chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
1695 struct snd_es18xx *chip = card->private_data;
1700 chip->pm_reg = (unsigned char)snd_es18xx_read(chip, ES18XX_PM);
1701 chip->pm_reg |= (ES18XX_PM_FM | ES18XX_PM_SUS);
1702 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg);
1703 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_SUS);
1710 struct snd_es18xx *chip = card->private_data;
1713 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM);
1726 struct snd_es18xx *chip = card->private_data;
1728 spin_lock_init(&chip->reg_lock);
1729 spin_lock_init(&chip->mixer_lock);
1730 chip->port = port;
1731 chip->irq = -1;
1732 chip->dma1 = -1;
1733 chip->dma2 = -1;
1734 chip->audio2_vol = 0x00;
1735 chip->active = 0;
1747 chip->irq = irq;
1748 card->sync_irq = chip->irq;
1754 chip->dma1 = dma1;
1761 chip->dma2 = dma2;
1763 if (snd_es18xx_probe(card, chip, mpu_port, fm_port) < 0)
1770 struct snd_es18xx *chip = card->private_data;
1774 strcpy(card->mixername, chip->pcm->name);
1778 kctl = snd_ctl_new1(&snd_es18xx_base_controls[idx], chip);
1779 if (chip->caps & ES18XX_HWV) {
1782 chip->master_volume = kctl;
1786 chip->master_switch = kctl;
1795 if (chip->caps & ES18XX_PCM2) {
1797 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm2_controls[idx], chip));
1803 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_pcm1_controls[idx], chip));
1809 if (chip->caps & ES18XX_RECMIX) {
1811 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip));
1816 switch (chip->version) {
1818 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre1_control, chip));
1824 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre2_control, chip));
1829 if (chip->caps & ES18XX_SPATIALIZER) {
1831 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_spatializer_controls[idx], chip));
1836 if (chip->caps & ES18XX_HWV) {
1839 kctl = snd_ctl_new1(&snd_es18xx_hw_volume_controls[idx], chip);
1841 chip->hw_volume = kctl;
1843 chip->hw_switch = kctl;
1853 if (chip->version != 0x1868) {
1855 chip));
1859 if (chip->version == 0x1869) {
1863 chip));
1867 } else if (chip->version == 0x1878) {
1869 chip));
1872 } else if (chip->version == 0x1879) {
1876 chip));
1881 if (chip->caps & ES18XX_GPO_2BIT) {
1885 chip));
1981 static int snd_audiodrive_pnp(int dev, struct snd_es18xx *chip,
1984 chip->dev = pdev;
1985 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0)
2011 static int snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip,
2015 chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
2016 if (chip->dev == NULL)
2019 chip->devc = pnp_request_card_device(card, id->devs[1].id, NULL);
2020 if (chip->devc == NULL)
2024 if (pnp_activate_dev(chip->devc) < 0) {
2029 (unsigned long long)pnp_port_start(chip->devc, 0));
2030 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0)
2052 struct snd_es18xx *chip = card->private_data;
2062 sprintf(card->driver, "ES%x", chip->version);
2064 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
2068 chip->port,
2073 chip->port,
2100 -1, &chip->rmidi);