Lines Matching +full:chip +full:- +full:to +full:- +full:chip

1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * Rewritted from card-es1938.c source.
18 * A working Maestro setup contains the Maestro chip wired to a
25 * to release docs on. Thankfully it isn't required on the Maestro
27 * encoding. The codecs are almost always AC-97 compliant codecs,
29 * part?) wired to them. The only real difference in the Maestro
36 * mixers in the codecs. There are 64 APUs. We assign 6 to each
41 * 3 basic functions. For playback we use them to convert PCM
43 * is handed to the codec. One APU for mono, and a pair for stereo.
52 * to have a 512 byte buffer sitting around in wavecache/memory.
57 * It claims to fetch from 4 regions of PCI space, each 4 meg in length.
59 * allocations have to be in 4meg of each other. Booo. Hiss.
61 * the number of dsps to provide. All their buffer space is allocated
63 * power of 2 buffers, so we have all those next to each other, then
67 * just how to coerce the WP into doing what we want.
69 * The indirection of the various registers means we have to spinlock
76 * paths and it makes the code far easier to follow. Interrupts are
77 * blocked while holding the locks because the int handler has to
88 #include <linux/dma-mapping.h>
102 #include <media/drv-intf/tea575x.h>
115 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */
118 static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 };
119 static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 };
120 static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 };
122 static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
123 static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
127 static int radio_nr[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
142 MODULE_PARM_DESC(clock, "Clock on " CARD_NAME " soundcard. (0 = auto-detect)");
144 MODULE_PARM_DESC(use_pm, "Toggle power-management. (0 = off, 1 = on, 2 = auto)");
296 /* APU Modes: reg 0x00, bit 4-7 */
300 #define ESM_APU_16BITLINEAR 0x01 /* 16-Bit Linear Sample Player */
301 #define ESM_APU_16BITSTEREO 0x02 /* 16-Bit Stereo Sample Player */
302 #define ESM_APU_8BITLINEAR 0x03 /* 8-Bit Linear Sample Player */
303 #define ESM_APU_8BITSTEREO 0x04 /* 8-Bit Stereo Sample Player */
304 #define ESM_APU_8BITDIFF 0x05 /* 8-Bit Differential Sample Playrer */
311 #define ESM_APU_16BITPINGPONG 0x0C /* 16-Bit Ping-Pong Sample Player */
351 /* reg 0x05 - wave start offset */
352 /* reg 0x06 - wave end offset */
353 /* reg 0x07 - wave loop length */
364 /* bit 0-7 amplitude dest? */
434 /* chip type */
502 int do_pm; /* power-management enabled */
568 static void __maestro_write(struct es1968 *chip, u16 reg, u16 data)
570 outw(reg, chip->io_port + ESM_INDEX);
571 outw(data, chip->io_port + ESM_DATA);
572 chip->maestro_map[reg] = data;
575 static inline void maestro_write(struct es1968 *chip, u16 reg, u16 data)
577 guard(spinlock_irqsave)(&chip->reg_lock);
578 __maestro_write(chip, reg, data);
582 static u16 __maestro_read(struct es1968 *chip, u16 reg)
585 outw(reg, chip->io_port + ESM_INDEX);
586 chip->maestro_map[reg] = inw(chip->io_port + ESM_DATA);
588 return chip->maestro_map[reg];
591 static inline u16 maestro_read(struct es1968 *chip, u16 reg)
593 guard(spinlock_irqsave)(&chip->reg_lock);
594 return __maestro_read(chip, reg);
597 /* Wait for the codec bus to be free */
598 static int snd_es1968_ac97_wait(struct es1968 *chip)
602 while (timeout-- > 0) {
603 if (!(inb(chip->io_port + ESM_AC97_INDEX) & 1))
607 dev_dbg(chip->card->dev, "ac97 timeout\n");
611 static int snd_es1968_ac97_wait_poll(struct es1968 *chip)
615 while (timeout-- > 0) {
616 if (!(inb(chip->io_port + ESM_AC97_INDEX) & 1))
619 dev_dbg(chip->card->dev, "ac97 timeout\n");
625 struct es1968 *chip = ac97->private_data;
627 snd_es1968_ac97_wait(chip);
630 outw(val, chip->io_port + ESM_AC97_DATA);
632 outb(reg, chip->io_port + ESM_AC97_INDEX);
639 struct es1968 *chip = ac97->private_data;
641 snd_es1968_ac97_wait(chip);
643 outb(reg | 0x80, chip->io_port + ESM_AC97_INDEX);
646 if (!snd_es1968_ac97_wait_poll(chip)) {
647 data = inw(chip->io_port + ESM_AC97_DATA);
655 static void apu_index_set(struct es1968 *chip, u16 index)
658 __maestro_write(chip, IDR1_CRAM_POINTER, index);
660 if (__maestro_read(chip, IDR1_CRAM_POINTER) == index)
662 dev_dbg(chip->card->dev, "APU register select failed. (Timeout)\n");
666 static void apu_data_set(struct es1968 *chip, u16 data)
670 if (__maestro_read(chip, IDR0_DATA_PORT) == data)
672 __maestro_write(chip, IDR0_DATA_PORT, data);
674 dev_dbg(chip->card->dev, "APU register set probably failed (Timeout)!\n");
678 static void __apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 data)
682 chip->apu_map[channel][reg] = data;
684 apu_index_set(chip, reg);
685 apu_data_set(chip, data);
688 static void apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 data)
690 guard(spinlock_irqsave)(&chip->reg_lock);
691 __apu_set_register(chip, channel, reg, data);
694 static u16 __apu_get_register(struct es1968 *chip, u16 channel, u8 reg)
699 apu_index_set(chip, reg);
700 return __maestro_read(chip, IDR0_DATA_PORT);
703 static u16 apu_get_register(struct es1968 *chip, u16 channel, u8 reg)
705 guard(spinlock_irqsave)(&chip->reg_lock);
706 return __apu_get_register(chip, channel, reg);
711 static void assp_set_register(struct es1968 *chip, u32 reg, u32 value)
713 guard(spinlock_irqsave),(&chip->reg_lock);
714 outl(reg, chip->io_port + ASSP_INDEX);
715 outl(value, chip->io_port + ASSP_DATA);
718 static u32 assp_get_register(struct es1968 *chip, u32 reg)
720 guard(spinlock_irqsave)(&chip->reg_lock);
721 outl(reg, chip->io_port + ASSP_INDEX);
722 return inl(chip->io_port + ASSP_DATA);
727 static void wave_set_register(struct es1968 *chip, u16 reg, u16 value)
729 guard(spinlock_irqsave)(&chip->reg_lock);
730 outw(reg, chip->io_port + WC_INDEX);
731 outw(value, chip->io_port + WC_DATA);
734 static u16 wave_get_register(struct es1968 *chip, u16 reg)
736 guard(spinlock_irqsave)(&chip->reg_lock);
737 outw(reg, chip->io_port + WC_INDEX);
738 return inw(chip->io_port + WC_DATA);
745 static void snd_es1968_bob_stop(struct es1968 *chip)
749 reg = __maestro_read(chip, 0x11);
751 __maestro_write(chip, 0x11, reg);
752 reg = __maestro_read(chip, 0x17);
754 __maestro_write(chip, 0x17, reg);
757 static void snd_es1968_bob_start(struct es1968 *chip)
763 /* first, find best prescaler value to match freq */
765 if (chip->bob_freq > (ESS_SYSCLK >> (prescale + 9)))
771 prescale--;
776 /* now fine-tune the divider for best match */
778 if (chip->bob_freq >
785 prescale--;
787 divide--;
789 __maestro_write(chip, 6, 0x9000 | (prescale << 5) | divide); /* set reg */
792 __maestro_write(chip, 0x11, __maestro_read(chip, 0x11) | 1);
793 __maestro_write(chip, 0x17, __maestro_read(chip, 0x17) | 1);
797 static void snd_es1968_bob_inc(struct es1968 *chip, int freq)
799 chip->bobclient++;
800 if (chip->bobclient == 1) {
801 chip->bob_freq = freq;
802 snd_es1968_bob_start(chip);
803 } else if (chip->bob_freq < freq) {
804 snd_es1968_bob_stop(chip);
805 chip->bob_freq = freq;
806 snd_es1968_bob_start(chip);
811 static void snd_es1968_bob_dec(struct es1968 *chip)
813 chip->bobclient--;
814 if (chip->bobclient <= 0)
815 snd_es1968_bob_stop(chip);
816 else if (chip->bob_freq > ESM_BOB_FREQ) {
820 list_for_each_entry(es, &chip->substream_list, list) {
821 if (max_freq < es->bob_freq)
822 max_freq = es->bob_freq;
824 if (max_freq != chip->bob_freq) {
825 snd_es1968_bob_stop(chip);
826 chip->bob_freq = max_freq;
827 snd_es1968_bob_start(chip);
833 snd_es1968_calc_bob_rate(struct es1968 *chip, struct esschan *es,
837 int freq = runtime->rate * 4;
838 if (es->fmt & ESS_FMT_STEREO)
840 if (es->fmt & ESS_FMT_16BIT)
842 freq /= es->frag_size;
855 static u32 snd_es1968_compute_rate(struct es1968 *chip, u32 freq)
857 u32 rate = (freq << 16) / chip->clock;
867 snd_es1968_get_dma_ptr(struct es1968 *chip, struct esschan *es)
871 offset = apu_get_register(chip, es->apu[0], 5);
873 offset -= es->base[0];
878 static void snd_es1968_apu_set_freq(struct es1968 *chip, int apu, int freq)
880 apu_set_register(chip, apu, 2,
881 (apu_get_register(chip, apu, 2) & 0x00FF) |
883 apu_set_register(chip, apu, 3, freq >> 8);
895 static void snd_es1968_pcm_start(struct es1968 *chip, struct esschan *es)
897 guard(spinlock)(&chip->reg_lock);
898 __apu_set_register(chip, es->apu[0], 5, es->base[0]);
899 snd_es1968_trigger_apu(chip, es->apu[0], es->apu_mode[0]);
900 if (es->mode == ESM_MODE_CAPTURE) {
901 __apu_set_register(chip, es->apu[2], 5, es->base[2]);
902 snd_es1968_trigger_apu(chip, es->apu[2], es->apu_mode[2]);
904 if (es->fmt & ESS_FMT_STEREO) {
905 __apu_set_register(chip, es->apu[1], 5, es->base[1]);
906 snd_es1968_trigger_apu(chip, es->apu[1], es->apu_mode[1]);
907 if (es->mode == ESM_MODE_CAPTURE) {
908 __apu_set_register(chip, es->apu[3], 5, es->base[3]);
909 snd_es1968_trigger_apu(chip, es->apu[3], es->apu_mode[3]);
914 static void snd_es1968_pcm_stop(struct es1968 *chip, struct esschan *es)
916 guard(spinlock)(&chip->reg_lock);
917 snd_es1968_trigger_apu(chip, es->apu[0], 0);
918 snd_es1968_trigger_apu(chip, es->apu[1], 0);
919 if (es->mode == ESM_MODE_CAPTURE) {
920 snd_es1968_trigger_apu(chip, es->apu[2], 0);
921 snd_es1968_trigger_apu(chip, es->apu[3], 0);
926 static void snd_es1968_program_wavecache(struct es1968 *chip, struct esschan *es,
929 u32 tmpval = (addr - 0x10) & 0xFFF8;
932 if (!(es->fmt & ESS_FMT_16BIT))
934 if (es->fmt & ESS_FMT_STEREO)
939 wave_set_register(chip, es->apu[channel] << 3, tmpval);
941 es->wc_map[channel] = tmpval;
945 static void snd_es1968_playback_setup(struct es1968 *chip, struct esschan *es,
954 size = es->dma_size >> es->wav_shift;
956 if (es->fmt & ESS_FMT_STEREO)
960 apu = es->apu[channel];
962 snd_es1968_program_wavecache(chip, es, channel, es->memory->buf.addr, 0);
964 /* Offset to PCMBAR */
965 pa = es->memory->buf.addr;
966 pa -= chip->dma.addr;
971 if (es->fmt & ESS_FMT_STEREO) {
975 if (es->fmt & ESS_FMT_16BIT)
981 es->base[channel] = pa & 0xFFFF;
984 apu_set_register(chip, apu, i, 0x0000);
987 apu_set_register(chip, apu, 4, ((pa >> 16) & 0xFF) << 8);
988 apu_set_register(chip, apu, 5, pa & 0xFFFF);
989 apu_set_register(chip, apu, 6, (pa + size) & 0xFFFF);
991 apu_set_register(chip, apu, 7, size);
994 apu_set_register(chip, apu, 8, 0x0000);
995 /* set amp now to 0xd0 (?), low byte is 'amplitude dest'? */
996 apu_set_register(chip, apu, 9, 0xD000);
999 apu_set_register(chip, apu, 11, 0x0000);
1000 /* dma on, no envelopes, filter to all 1s) */
1001 apu_set_register(chip, apu, 0, 0x400F);
1003 if (es->fmt & ESS_FMT_16BIT)
1004 es->apu_mode[channel] = ESM_APU_16BITLINEAR;
1006 es->apu_mode[channel] = ESM_APU_8BITLINEAR;
1008 if (es->fmt & ESS_FMT_STEREO) {
1012 to the SPDif Link. Perhaps you have to change this
1013 and not the APU Regs 4-5. */
1014 apu_set_register(chip, apu, 10,
1016 es->apu_mode[channel] += 1; /* stereo */
1018 apu_set_register(chip, apu, 10, 0x8F08);
1021 scoped_guard(spinlock_irqsave, &chip->reg_lock) {
1023 outw(1, chip->io_port + 0x04);
1025 outw(inw(chip->io_port + ESM_PORT_HOST_IRQ) | ESM_HIRQ_DSIE, chip->io_port + ESM_PORT_HOST_IRQ);
1028 freq = runtime->rate;
1036 if (!(es->fmt & ESS_FMT_16BIT) && !(es->fmt & ESS_FMT_STEREO))
1039 freq = snd_es1968_compute_rate(chip, freq);
1042 snd_es1968_apu_set_freq(chip, es->apu[0], freq);
1043 snd_es1968_apu_set_freq(chip, es->apu[1], freq);
1047 static void init_capture_apu(struct es1968 *chip, struct esschan *es, int channel,
1051 int i, apu = es->apu[channel];
1053 es->apu_mode[channel] = mode;
1056 snd_es1968_program_wavecache(chip, es, channel, pa, 1);
1058 /* Offset to PCMBAR */
1059 pa -= chip->dma.addr;
1064 es->base[channel] = pa & 0xFFFF;
1065 pa |= 0x00400000; /* bit 22 -> System RAM */
1069 apu_set_register(chip, apu, i, 0x0000);
1071 /* need to enable subgroups.. and we should probably
1073 apu_set_register(chip, apu, 2, 0x8);
1076 apu_set_register(chip, apu, 4, ((pa >> 16) & 0xFF) << 8);
1077 apu_set_register(chip, apu, 5, pa & 0xFFFF);
1078 apu_set_register(chip, apu, 6, (pa + bsize) & 0xFFFF);
1079 apu_set_register(chip, apu, 7, bsize);
1081 apu_set_register(chip, apu, 8, 0x00F0);
1083 apu_set_register(chip, apu, 9, 0x0000);
1085 apu_set_register(chip, apu, 10, 0x8F08);
1087 apu_set_register(chip, apu, 11, route);
1088 /* dma on, no envelopes, filter to all 1s) */
1089 apu_set_register(chip, apu, 0, 0x400F);
1092 static void snd_es1968_capture_setup(struct es1968 *chip, struct esschan *es,
1098 size = es->dma_size >> es->wav_shift;
1106 /* data seems to flow from the codec, through an apu into
1108 and out to the real 'buffer'. ok. sure. */
1111 /* parallel in crap, see maestro reg 0xC [8-11] */
1112 init_capture_apu(chip, es, 2,
1113 es->mixbuf->buf.addr, ESM_MIXBUF_SIZE/4, /* in words */
1116 init_capture_apu(chip, es, 0, es->memory->buf.addr, size,
1117 ESM_APU_SRCONVERTOR, es->apu[2]);
1118 if (es->fmt & ESS_FMT_STEREO) {
1120 init_capture_apu(chip, es, 3,
1121 es->mixbuf->buf.addr + ESM_MIXBUF_SIZE/2,
1125 init_capture_apu(chip, es, 1,
1126 es->memory->buf.addr + size*2, size,
1127 ESM_APU_SRCONVERTOR, es->apu[3]);
1130 freq = runtime->rate;
1137 freq = snd_es1968_compute_rate(chip, freq);
1140 snd_es1968_apu_set_freq(chip, es->apu[0], freq);
1141 snd_es1968_apu_set_freq(chip, es->apu[1], freq);
1145 snd_es1968_apu_set_freq(chip, es->apu[2], freq);
1146 snd_es1968_apu_set_freq(chip, es->apu[3], freq);
1148 guard(spinlock_irqsave)(&chip->reg_lock);
1150 outw(1, chip->io_port + 0x04);
1152 outw(inw(chip->io_port + ESM_PORT_HOST_IRQ) | ESM_HIRQ_DSIE, chip->io_port + ESM_PORT_HOST_IRQ);
1161 struct es1968 *chip = snd_pcm_substream_chip(substream);
1162 struct snd_pcm_runtime *runtime = substream->runtime;
1163 struct esschan *es = runtime->private_data;
1165 es->dma_size = snd_pcm_lib_buffer_bytes(substream);
1166 es->frag_size = snd_pcm_lib_period_bytes(substream);
1168 es->wav_shift = 1; /* maestro handles always 16bit */
1169 es->fmt = 0;
1170 if (snd_pcm_format_width(runtime->format) == 16)
1171 es->fmt |= ESS_FMT_16BIT;
1172 if (runtime->channels > 1) {
1173 es->fmt |= ESS_FMT_STEREO;
1174 if (es->fmt & ESS_FMT_16BIT) /* 8bit is already word shifted */
1175 es->wav_shift++;
1177 es->bob_freq = snd_es1968_calc_bob_rate(chip, es, runtime);
1179 switch (es->mode) {
1181 snd_es1968_playback_setup(chip, es, runtime);
1184 snd_es1968_capture_setup(chip, es, runtime);
1193 struct es1968 *chip = snd_pcm_substream_chip(substream);
1194 struct esschan *es = substream->runtime->private_data;
1196 guard(spinlock)(&chip->substream_lock);
1200 if (es->running)
1202 snd_es1968_bob_inc(chip, es->bob_freq);
1203 es->count = 0;
1204 es->hwptr = 0;
1205 snd_es1968_pcm_start(chip, es);
1206 es->running = 1;
1210 if (! es->running)
1212 snd_es1968_pcm_stop(chip, es);
1213 es->running = 0;
1214 snd_es1968_bob_dec(chip);
1222 struct es1968 *chip = snd_pcm_substream_chip(substream);
1223 struct esschan *es = substream->runtime->private_data;
1226 ptr = snd_es1968_get_dma_ptr(chip, es) << es->wav_shift;
1228 return bytes_to_frames(substream->runtime, ptr % es->dma_size);
1277 /* Because the Maestro can only take addresses relative to the PCM base address
1280 static int calc_available_memory_size(struct es1968 *chip)
1285 guard(mutex)(&chip->memory_mutex);
1286 list_for_each_entry(buf, &chip->buf_list, list) {
1287 if (buf->empty && buf->buf.bytes > max_size)
1288 max_size = buf->buf.bytes;
1296 static struct esm_memory *snd_es1968_new_memory(struct es1968 *chip, int size)
1301 guard(mutex)(&chip->memory_mutex);
1302 list_for_each_entry(buf, &chip->buf_list, list) {
1303 if (buf->empty && buf->buf.bytes >= size)
1309 if (buf->buf.bytes > size) {
1313 chunk->buf = buf->buf;
1314 chunk->buf.bytes -= size;
1315 chunk->buf.area += size;
1316 chunk->buf.addr += size;
1317 chunk->empty = 1;
1318 buf->buf.bytes = size;
1319 list_add(&chunk->list, &buf->list);
1321 buf->empty = 0;
1326 static void snd_es1968_free_memory(struct es1968 *chip, struct esm_memory *buf)
1330 guard(mutex)(&chip->memory_mutex);
1331 buf->empty = 1;
1332 if (buf->list.prev != &chip->buf_list) {
1333 chunk = list_entry(buf->list.prev, struct esm_memory, list);
1334 if (chunk->empty) {
1335 chunk->buf.bytes += buf->buf.bytes;
1336 list_del(&buf->list);
1341 if (buf->list.next != &chip->buf_list) {
1342 chunk = list_entry(buf->list.next, struct esm_memory, list);
1343 if (chunk->empty) {
1344 buf->buf.bytes += chunk->buf.bytes;
1345 list_del(&chunk->list);
1351 static void snd_es1968_free_dmabuf(struct es1968 *chip)
1355 if (! chip->dma.area)
1357 snd_dma_free_pages(&chip->dma);
1358 while ((p = chip->buf_list.next) != &chip->buf_list) {
1366 snd_es1968_init_dmabuf(struct es1968 *chip)
1372 &chip->pci->dev,
1373 chip->total_bufsize, &chip->dma);
1374 if (err < 0 || ! chip->dma.area) {
1375 dev_err(chip->card->dev,
1377 chip->total_bufsize);
1378 return -ENOMEM;
1380 if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) {
1381 snd_dma_free_pages(&chip->dma);
1382 dev_err(chip->card->dev, "DMA buffer beyond 256MB.\n");
1383 return -ENOMEM;
1386 INIT_LIST_HEAD(&chip->buf_list);
1390 snd_es1968_free_dmabuf(chip);
1391 return -ENOMEM;
1393 memset(chip->dma.area, 0, ESM_MEM_ALIGN);
1394 chunk->buf = chip->dma;
1395 chunk->buf.area += ESM_MEM_ALIGN;
1396 chunk->buf.addr += ESM_MEM_ALIGN;
1397 chunk->buf.bytes -= ESM_MEM_ALIGN;
1398 chunk->empty = 1;
1399 list_add(&chunk->list, &chip->buf_list);
1405 /* buffer is extracted from the pre-allocated memory chunk */
1409 struct es1968 *chip = snd_pcm_substream_chip(substream);
1410 struct snd_pcm_runtime *runtime = substream->runtime;
1411 struct esschan *chan = runtime->private_data;
1414 if (chan->memory) {
1415 if (chan->memory->buf.bytes >= size) {
1416 runtime->dma_bytes = size;
1419 snd_es1968_free_memory(chip, chan->memory);
1421 chan->memory = snd_es1968_new_memory(chip, size);
1422 if (chan->memory == NULL) {
1423 dev_dbg(chip->card->dev,
1425 return -ENOMEM;
1427 snd_pcm_set_runtime_buffer(substream, &chan->memory->buf);
1434 struct es1968 *chip = snd_pcm_substream_chip(substream);
1435 struct snd_pcm_runtime *runtime = substream->runtime;
1438 if (runtime->private_data == NULL)
1440 chan = runtime->private_data;
1441 if (chan->memory) {
1442 snd_es1968_free_memory(chip, chan->memory);
1443 chan->memory = NULL;
1452 static int snd_es1968_alloc_apu_pair(struct es1968 *chip, int type)
1457 if (chip->apu[apu] == ESM_APU_FREE &&
1458 chip->apu[apu + 1] == ESM_APU_FREE) {
1459 chip->apu[apu] = chip->apu[apu + 1] = type;
1463 return -EBUSY;
1469 static void snd_es1968_free_apu_pair(struct es1968 *chip, int apu)
1471 chip->apu[apu] = chip->apu[apu + 1] = ESM_APU_FREE;
1481 struct es1968 *chip = snd_pcm_substream_chip(substream);
1482 struct snd_pcm_runtime *runtime = substream->runtime;
1487 apu1 = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY);
1493 snd_es1968_free_apu_pair(chip, apu1);
1494 return -ENOMEM;
1497 es->apu[0] = apu1;
1498 es->apu[1] = apu1 + 1;
1499 es->apu_mode[0] = 0;
1500 es->apu_mode[1] = 0;
1501 es->running = 0;
1502 es->substream = substream;
1503 es->mode = ESM_MODE_PLAY;
1505 runtime->private_data = es;
1506 runtime->hw = snd_es1968_playback;
1507 runtime->hw.buffer_bytes_max = runtime->hw.period_bytes_max =
1508 calc_available_memory_size(chip);
1510 guard(spinlock_irq)(&chip->substream_lock);
1511 list_add(&es->list, &chip->substream_list);
1518 struct snd_pcm_runtime *runtime = substream->runtime;
1519 struct es1968 *chip = snd_pcm_substream_chip(substream);
1523 apu1 = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_CAPTURE);
1526 apu2 = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_RATECONV);
1528 snd_es1968_free_apu_pair(chip, apu1);
1534 snd_es1968_free_apu_pair(chip, apu1);
1535 snd_es1968_free_apu_pair(chip, apu2);
1536 return -ENOMEM;
1539 es->apu[0] = apu1;
1540 es->apu[1] = apu1 + 1;
1541 es->apu[2] = apu2;
1542 es->apu[3] = apu2 + 1;
1543 es->apu_mode[0] = 0;
1544 es->apu_mode[1] = 0;
1545 es->apu_mode[2] = 0;
1546 es->apu_mode[3] = 0;
1547 es->running = 0;
1548 es->substream = substream;
1549 es->mode = ESM_MODE_CAPTURE;
1552 es->mixbuf = snd_es1968_new_memory(chip, ESM_MIXBUF_SIZE);
1553 if (!es->mixbuf) {
1554 snd_es1968_free_apu_pair(chip, apu1);
1555 snd_es1968_free_apu_pair(chip, apu2);
1557 return -ENOMEM;
1559 memset(es->mixbuf->buf.area, 0, ESM_MIXBUF_SIZE);
1561 runtime->private_data = es;
1562 runtime->hw = snd_es1968_capture;
1563 runtime->hw.buffer_bytes_max = runtime->hw.period_bytes_max =
1564 calc_available_memory_size(chip) - 1024; /* keep MIXBUF size */
1569 guard(spinlock_irq)(&chip->substream_lock);
1570 list_add(&es->list, &chip->substream_list);
1577 struct es1968 *chip = snd_pcm_substream_chip(substream);
1580 if (substream->runtime->private_data == NULL)
1582 es = substream->runtime->private_data;
1583 scoped_guard(spinlock_irq, &chip->substream_lock) {
1584 list_del(&es->list);
1586 snd_es1968_free_apu_pair(chip, es->apu[0]);
1594 struct es1968 *chip = snd_pcm_substream_chip(substream);
1597 if (substream->runtime->private_data == NULL)
1599 es = substream->runtime->private_data;
1600 scoped_guard(spinlock_irq, &chip->substream_lock) {
1601 list_del(&es->list);
1603 snd_es1968_free_memory(chip, es->mixbuf);
1604 snd_es1968_free_apu_pair(chip, es->apu[0]);
1605 snd_es1968_free_apu_pair(chip, es->apu[2]);
1637 static void es1968_measure_clock(struct es1968 *chip)
1645 if (chip->clock == 0)
1646 chip->clock = 48000; /* default clock value */
1649 apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY);
1651 dev_err(chip->card->dev, "Hmm, cannot find empty APU pair!?\n");
1654 memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE);
1656 dev_warn(chip->card->dev,
1657 "cannot allocate dma buffer - using default clock %d\n",
1658 chip->clock);
1659 snd_es1968_free_apu_pair(chip, apu);
1663 memset(memory->buf.area, 0, CLOCK_MEASURE_BUFSIZE);
1665 wave_set_register(chip, apu << 3, (memory->buf.addr - 0x10) & 0xfff8);
1667 pa = (unsigned int)((memory->buf.addr - chip->dma.addr) >> 1);
1672 apu_set_register(chip, apu, i, 0x0000);
1674 apu_set_register(chip, apu, 0, 0x400f);
1675 apu_set_register(chip, apu, 4, ((pa >> 16) & 0xff) << 8);
1676 apu_set_register(chip, apu, 5, pa & 0xffff);
1677 apu_set_register(chip, apu, 6, (pa + CLOCK_MEASURE_BUFSIZE/2) & 0xffff);
1678 apu_set_register(chip, apu, 7, CLOCK_MEASURE_BUFSIZE/2);
1679 apu_set_register(chip, apu, 8, 0x0000);
1680 apu_set_register(chip, apu, 9, 0xD000);
1681 apu_set_register(chip, apu, 10, 0x8F08);
1682 apu_set_register(chip, apu, 11, 0x0000);
1683 scoped_guard(spinlock_irq, &chip->reg_lock) {
1684 outw(1, chip->io_port + 0x04); /* clear WP interrupts */
1685 outw(inw(chip->io_port + ESM_PORT_HOST_IRQ) | ESM_HIRQ_DSIE, chip->io_port + ESM_PORT_HOST_IRQ); /* enable WP ints */
1688 snd_es1968_apu_set_freq(chip, apu, ((unsigned int)48000 << 16) / chip->clock); /* 48000 Hz */
1690 chip->in_measurement = 1;
1691 chip->measure_apu = apu;
1692 scoped_guard(spinlock_irq, &chip->reg_lock) {
1693 snd_es1968_bob_inc(chip, ESM_BOB_FREQ);
1694 __apu_set_register(chip, apu, 5, pa & 0xffff);
1695 snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR);
1699 scoped_guard(spinlock_irq, &chip->reg_lock) {
1700 offset = __apu_get_register(chip, apu, 5);
1702 snd_es1968_trigger_apu(chip, apu, 0); /* stop */
1703 snd_es1968_bob_dec(chip);
1704 chip->in_measurement = 0;
1708 offset -= (pa & 0xffff);
1710 offset += chip->measure_count * (CLOCK_MEASURE_BUFSIZE/2);
1715 dev_err(chip->card->dev, "?? calculation error..\n");
1721 chip->clock = (chip->clock * offset) / 48000;
1723 dev_info(chip->card->dev, "clocking to %d\n", chip->clock);
1725 snd_es1968_free_memory(chip, memory);
1726 snd_es1968_free_apu_pair(chip, apu);
1735 struct es1968 *esm = pcm->private_data;
1737 esm->pcm = NULL;
1741 snd_es1968_pcm(struct es1968 *chip, int device)
1747 err = snd_es1968_init_dmabuf(chip);
1752 wave_set_register(chip, 0x01FC, chip->dma.addr >> 12);
1753 wave_set_register(chip, 0x01FD, chip->dma.addr >> 12);
1754 wave_set_register(chip, 0x01FE, chip->dma.addr >> 12);
1755 wave_set_register(chip, 0x01FF, chip->dma.addr >> 12);
1757 err = snd_pcm_new(chip->card, "ESS Maestro", device,
1758 chip->playback_streams,
1759 chip->capture_streams, &pcm);
1763 pcm->private_data = chip;
1764 pcm->private_free = snd_es1968_pcm_free;
1769 pcm->info_flags = 0;
1771 strscpy(pcm->name, "ESS Maestro");
1773 chip->pcm = pcm;
1780 static void snd_es1968_suppress_jitter(struct es1968 *chip, struct esschan *es)
1786 cp1 = __apu_get_register(chip, 0, 5);
1787 cp2 = __apu_get_register(chip, 1, 5);
1788 diff = (cp1 > cp2 ? cp1 - cp2 : cp2 - cp1);
1791 __maestro_write(chip, IDR0_DATA_PORT, cp1);
1797 static void snd_es1968_update_pcm(struct es1968 *chip, struct esschan *es)
1801 struct snd_pcm_substream *subs = es->substream;
1803 if (subs == NULL || !es->running)
1806 hwptr = snd_es1968_get_dma_ptr(chip, es) << es->wav_shift;
1807 hwptr %= es->dma_size;
1809 diff = (es->dma_size + hwptr - es->hwptr) % es->dma_size;
1811 es->hwptr = hwptr;
1812 es->count += diff;
1814 if (es->count > es->frag_size) {
1815 spin_unlock(&chip->substream_lock);
1817 spin_lock(&chip->substream_lock);
1818 es->count %= es->frag_size;
1823 (without wrap around) in response to volume button presses and then
1824 generating an interrupt. The pair of counters is stored in bits 1-3 and 5-7
1828 struct es1968 *chip = container_of(work, struct es1968, hwvol_work);
1834 x = inb(chip->io_port + 0x1c) & 0xee;
1836 outb(0x88, chip->io_port + 0x1c);
1837 outb(0x88, chip->io_port + 0x1d);
1838 outb(0x88, chip->io_port + 0x1e);
1839 outb(0x88, chip->io_port + 0x1f);
1841 if (chip->in_suspend)
1845 if (! chip->master_switch || ! chip->master_volume)
1848 val = snd_ac97_read(chip->ac97, AC97_MASTER);
1857 val--;
1859 val -= 0x0100;
1869 if (snd_ac97_update(chip->ac97, AC97_MASTER, val))
1870 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
1871 &chip->master_volume->id);
1873 if (!chip->input_dev)
1880 interrupt. According to tests run by various people this
1885 /* counters increased by 1 -> volume up */
1889 /* counters decreased by 1 -> volume down */
1895 input_report_key(chip->input_dev, val, 1);
1896 input_sync(chip->input_dev);
1897 input_report_key(chip->input_dev, val, 0);
1898 input_sync(chip->input_dev);
1908 struct es1968 *chip = dev_id;
1911 event = inb(chip->io_port + 0x1A);
1915 outw(inw(chip->io_port + 4) & 1, chip->io_port + 4);
1918 schedule_work(&chip->hwvol_work);
1921 outb(0xFF, chip->io_port + 0x1A);
1923 if ((event & ESM_MPU401_IRQ) && chip->rmidi) {
1924 snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data);
1929 scoped_guard(spinlock, &chip->substream_lock) {
1930 list_for_each_entry(es, &chip->substream_list, list) {
1931 if (es->running) {
1932 snd_es1968_update_pcm(chip, es);
1933 if (es->fmt & ESS_FMT_STEREO)
1934 snd_es1968_suppress_jitter(chip, es);
1938 if (chip->in_measurement) {
1939 unsigned int curp = __apu_get_register(chip, chip->measure_apu, 5);
1940 if (curp < chip->measure_lastpos)
1941 chip->measure_count++;
1942 chip->measure_lastpos = curp;
1954 snd_es1968_mixer(struct es1968 *chip)
1964 err = snd_ac97_bus(chip->card, 0, &ops, NULL, &pbus);
1967 pbus->no_vra = 1; /* ES1968 doesn't need VRA */
1970 ac97.private_data = chip;
1971 err = snd_ac97_mixer(pbus, &ac97, &chip->ac97);
1977 chip->master_switch = snd_ctl_find_id_mixer(chip->card,
1979 chip->master_volume = snd_ctl_find_id_mixer(chip->card,
1990 static void snd_es1968_ac97_reset(struct es1968 *chip)
1992 unsigned long ioaddr = chip->io_port;
2003 /* set command/status address i/o to 1st codec */
2010 pci_read_config_word(chip->pci, 0x58, &w); /* something magical with gpio and bus arb. */
2011 pci_read_config_dword(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend);
2016 outw(0x0000, ioaddr + 0x60); /* write 0 to gpio 0 */
2018 outw(0x0001, ioaddr + 0x60); /* write 1 to gpio 1 */
2032 outw(0x0001, ioaddr + 0x60); /* write 1 to gpio */
2034 outw(0x0009, ioaddr + 0x60); /* write 9 to gpio */
2040 #if 0 /* the loop here needs to be much better if we want it.. */
2041 dev_info(chip->card->dev, "trying software reset\n");
2083 /* Turn on the 978 docking chip.
2085 then set most of the playback volume control registers to max. */
2095 static void snd_es1968_reset(struct es1968 *chip)
2099 chip->io_port + ESM_PORT_HOST_IRQ);
2101 outw(0x0000, chip->io_port + ESM_PORT_HOST_IRQ);
2106 * initialize maestro chip
2108 static void snd_es1968_chip_init(struct es1968 *chip)
2110 struct pci_dev *pci = chip->pci;
2112 unsigned long iobase = chip->io_port;
2116 /* We used to muck around with pci config space that
2118 * about the machine to know which DMA mode is appropriate,
2120 * them unhappy. We now trust in the BIOS to do things right,
2135 /* XXX huh? claims to be reserved.. */
2137 seems to only have effect on SB
2148 /* XXX how do we know which to use? */
2153 w |= DEBOUNCE; /* Debounce off: easier to push the HW buttons */
2159 w &= ~IRQ_TO_ISA; /* IRQ to ISA off (undoc) */
2181 /* Set up 978 docking control chip. */
2190 snd_es1968_reset(chip);
2196 /* setup usual 0x34 stuff.. 0x36 may be chip specific */
2206 snd_es1968_ac97_reset(chip);
2215 /* Set hardware volume control registers to midpoints.
2233 /* Write 0 into the buffer area 0x1E0->1EF */
2237 /* The 1.10 test program seem to write 0 into the buffer area
2238 * 0x1D0-0x1DF too.*/
2242 wave_set_register(chip, IDR7_WAVE_ROMRAM,
2243 (wave_get_register(chip, IDR7_WAVE_ROMRAM) & 0xFF00));
2244 wave_set_register(chip, IDR7_WAVE_ROMRAM,
2245 wave_get_register(chip, IDR7_WAVE_ROMRAM) | 0x100);
2246 wave_set_register(chip, IDR7_WAVE_ROMRAM,
2247 wave_get_register(chip, IDR7_WAVE_ROMRAM) & ~0x200);
2248 wave_set_register(chip, IDR7_WAVE_ROMRAM,
2249 wave_get_register(chip, IDR7_WAVE_ROMRAM) | ~0x400);
2252 maestro_write(chip, IDR2_CRAM_DATA, 0x0000);
2253 /* Now back to the DirectSound stuff */
2255 maestro_write(chip, 0x08, 0xB004);
2256 maestro_write(chip, 0x09, 0x001B);
2257 maestro_write(chip, 0x0A, 0x8000);
2258 maestro_write(chip, 0x0B, 0x3F37);
2259 maestro_write(chip, 0x0C, 0x0098);
2261 /* parallel in, has something to do with recording :) */
2262 maestro_write(chip, 0x0C,
2263 (maestro_read(chip, 0x0C) & ~0xF000) | 0x8000);
2265 maestro_write(chip, 0x0C,
2266 (maestro_read(chip, 0x0C) & ~0x0F00) | 0x0500);
2268 maestro_write(chip, 0x0D, 0x7632);
2270 /* Wave cache control on - test off, sg off,
2275 w &= ~0xFA00; /* Seems to be reserved? I don't know */
2278 Seems to crash the Computer if enabled... */
2293 apu_set_register(chip, i, w, 0);
2299 static void snd_es1968_start_irq(struct es1968 *chip)
2303 if (chip->rmidi)
2305 outb(w, chip->io_port + 0x1A);
2306 outw(w, chip->io_port + ESM_PORT_HOST_IRQ);
2315 struct es1968 *chip = card->private_data;
2317 if (! chip->do_pm)
2320 chip->in_suspend = 1;
2321 cancel_work_sync(&chip->hwvol_work);
2323 snd_ac97_suspend(chip->ac97);
2324 snd_es1968_bob_stop(chip);
2331 struct es1968 *chip = card->private_data;
2334 if (! chip->do_pm)
2337 snd_es1968_chip_init(chip);
2339 /* need to restore the base pointers.. */
2340 if (chip->dma.addr) {
2342 wave_set_register(chip, 0x01FC, chip->dma.addr >> 12);
2345 snd_es1968_start_irq(chip);
2348 snd_ac97_resume(chip->ac97);
2350 list_for_each_entry(es, &chip->substream_list, list) {
2351 switch (es->mode) {
2353 snd_es1968_playback_setup(chip, es, es->substream->runtime);
2356 snd_es1968_capture_setup(chip, es, es->substream->runtime);
2362 if (chip->bobclient)
2363 snd_es1968_bob_start(chip);
2366 chip->in_suspend = 0;
2374 static int snd_es1968_create_gameport(struct es1968 *chip, int dev)
2381 return -ENODEV;
2383 r = devm_request_region(&chip->pci->dev, JOYSTICK_ADDR, 8,
2386 return -EBUSY;
2388 chip->gameport = gp = gameport_allocate_port();
2390 dev_err(chip->card->dev,
2392 return -ENOMEM;
2395 pci_read_config_word(chip->pci, ESM_LEGACY_AUDIO_CONTROL, &val);
2396 pci_write_config_word(chip->pci, ESM_LEGACY_AUDIO_CONTROL, val | 0x04);
2399 gameport_set_phys(gp, "pci%s/gameport0", pci_name(chip->pci));
2400 gameport_set_dev_parent(gp, &chip->pci->dev);
2401 gp->io = JOYSTICK_ADDR;
2408 static void snd_es1968_free_gameport(struct es1968 *chip)
2410 if (chip->gameport) {
2411 gameport_unregister_port(chip->gameport);
2412 chip->gameport = NULL;
2416 static inline int snd_es1968_create_gameport(struct es1968 *chip, int dev) { return -ENOSYS; }
2417 static inline void snd_es1968_free_gameport(struct es1968 *chip) { }
2421 static int snd_es1968_input_register(struct es1968 *chip)
2426 input_dev = devm_input_allocate_device(&chip->pci->dev);
2428 return -ENOMEM;
2430 snprintf(chip->phys, sizeof(chip->phys), "pci-%s/input0",
2431 pci_name(chip->pci));
2433 input_dev->name = chip->card->driver;
2434 input_dev->phys = chip->phys;
2435 input_dev->id.bustype = BUS_PCI;
2436 input_dev->id.vendor = chip->pci->vendor;
2437 input_dev->id.product = chip->pci->device;
2438 input_dev->dev.parent = &chip->pci->dev;
2440 __set_bit(EV_KEY, input_dev->evbit);
2441 __set_bit(KEY_MUTE, input_dev->keybit);
2442 __set_bit(KEY_VOLUMEDOWN, input_dev->keybit);
2443 __set_bit(KEY_VOLUMEUP, input_dev->keybit);
2449 chip->input_dev = input_dev;
2457 bits 1=unmask write to given bit */
2461 /* GPIO to TEA575x maps */
2468 { .data = 6, .clk = 7, .wren = 8, .most = 9, .name = "SF64-PCE2" },
2472 #define get_tea575x_gpio(chip) \
2473 (&snd_es1968_tea575x_gpios[(chip)->tea575x_tuner])
2478 struct es1968 *chip = tea->private_data;
2479 struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip);
2486 outw(val, chip->io_port + GPIO_DATA);
2491 struct es1968 *chip = tea->private_data;
2492 struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip);
2493 u16 val = inw(chip->io_port + GPIO_DATA);
2506 struct es1968 *chip = tea->private_data;
2507 unsigned long io = chip->io_port + GPIO_DATA;
2509 struct snd_es1968_tea575x_gpio gpio = *get_tea575x_gpio(chip);
2533 struct es1968 *chip = card->private_data;
2535 cancel_work_sync(&chip->hwvol_work);
2537 if (chip->io_port) {
2538 outw(1, chip->io_port + 0x04); /* clear WP interrupts */
2539 outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */
2543 snd_tea575x_exit(&chip->tea);
2544 v4l2_device_unregister(&chip->v4l2_dev);
2547 snd_es1968_free_gameport(chip);
2551 unsigned short type; /* chip type */
2563 { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */
2579 struct es1968 *chip = card->private_data;
2586 /* check, if we can restrict PCI DMA transfers to 28 bits */
2587 if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(28))) {
2588 dev_err(card->dev,
2590 return -ENXIO;
2594 chip->type = chip_type;
2595 spin_lock_init(&chip->reg_lock);
2596 spin_lock_init(&chip->substream_lock);
2597 INIT_LIST_HEAD(&chip->buf_list);
2598 INIT_LIST_HEAD(&chip->substream_list);
2599 mutex_init(&chip->memory_mutex);
2600 INIT_WORK(&chip->hwvol_work, es1968_update_hw_volume);
2601 chip->card = card;
2602 chip->pci = pci;
2603 chip->irq = -1;
2604 chip->total_bufsize = total_bufsize; /* in bytes */
2605 chip->playback_streams = play_streams;
2606 chip->capture_streams = capt_streams;
2611 chip->io_port = pci_resource_start(pci, 0);
2612 if (devm_request_irq(&pci->dev, pci->irq, snd_es1968_interrupt,
2613 IRQF_SHARED, KBUILD_MODNAME, chip)) {
2614 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2615 return -EBUSY;
2617 chip->irq = pci->irq;
2618 card->sync_irq = chip->irq;
2619 card->private_free = snd_es1968_free;
2623 chip->maestro_map[i] = 0;
2627 chip->apu[i] = ESM_APU_FREE;
2629 /* just to be sure */
2633 /* disable power-management if not on the allowlist */
2635 pci_read_config_word(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend);
2637 if (chip->type == pm_allowlist[i].type &&
2645 dev_info(card->dev, "not attempting power management.\n");
2649 chip->do_pm = do_pm;
2651 snd_es1968_chip_init(chip);
2655 if (chip->pci->subsystem_vendor != 0x125d)
2657 err = v4l2_device_register(&pci->dev, &chip->v4l2_dev);
2660 chip->tea.v4l2_dev = &chip->v4l2_dev;
2661 chip->tea.private_data = chip;
2662 chip->tea.radio_nr = radio_nr;
2663 chip->tea.ops = &snd_es1968_tea_ops;
2664 sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci));
2666 chip->tea575x_tuner = i;
2667 if (!snd_tea575x_init(&chip->tea, THIS_MODULE)) {
2668 dev_info(card->dev, "detected TEA575x radio type %s\n",
2669 get_tea575x_gpio(chip)->name);
2670 strscpy(chip->tea.card, get_tea575x_gpio(chip)->name,
2671 sizeof(chip->tea.card));
2687 struct es1968 *chip;
2692 return -ENODEV;
2695 return -ENOENT;
2698 err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
2699 sizeof(*chip), &card);
2702 chip = card->private_data;
2712 pci_id->driver_data,
2718 switch (chip->type) {
2720 strscpy(card->driver, "ES1978");
2721 strscpy(card->shortname, "ESS ES1978 (Maestro 2E)");
2724 strscpy(card->driver, "ES1968");
2725 strscpy(card->shortname, "ESS ES1968 (Maestro 2)");
2728 strscpy(card->driver, "ESM1");
2729 strscpy(card->shortname, "ESS Maestro 1");
2733 err = snd_es1968_pcm(chip, 0);
2737 err = snd_es1968_mixer(chip);
2744 pci_read_config_word(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend);
2746 if (chip->type == mpu_denylist[i].type &&
2755 chip->io_port + ESM_MPU401_PORT,
2758 -1, &chip->rmidi);
2760 dev_warn(card->dev, "skipping MPU-401 MIDI support..\n");
2763 snd_es1968_create_gameport(chip, dev);
2766 err = snd_es1968_input_register(chip);
2768 dev_warn(card->dev,
2772 snd_es1968_start_irq(chip);
2774 chip->clock = clock[dev];
2775 if (! chip->clock)
2776 es1968_measure_clock(chip);
2778 sprintf(card->longname, "%s at 0x%lx, irq %i",
2779 card->shortname, chip->io_port, chip->irq);
2792 return snd_card_free_on_error(&pci->dev, __snd_es1968_probe(pci, pci_id));