|
14 | 14 | //**************************************************************************
|
15 | 15 | //function: Ensoniq 1371/1373 low level routines (for SB PCI 16/64/128 cards)
|
16 | 16 | //based on ALSA (http://www.alsa-project.org)
|
| 17 | +//v1.7 fix: 5880 variants weren't enabled, since the "enable" bit was set |
| 18 | +//in ES_REG_SERIAL, but has to be set in ES_REG_STATUS (fix by mkarcher). |
17 | 19 |
|
18 | 20 | #include <stdlib.h>
|
19 | 21 | #include <stdint.h>
|
|
28 | 30 | #include "PCIBIOS.H"
|
29 | 31 | #include "AC97MIX.H"
|
30 | 32 |
|
31 |
| -#if 0 |
| 33 | +#if 0 /* v1.7: generally use 512 as default period_size */ |
32 | 34 | #define ES1371_DMABUF_PERIODS 32
|
33 | 35 | #define ES1371_MAX_CHANNELS 2
|
34 | 36 | #define ES1371_MAX_BYTES 4
|
|
37 | 39 | #define ES1371_DMABUF_ALIGN 512
|
38 | 40 | #endif
|
39 | 41 |
|
40 |
| -/* 00-07 interrupt/chip select |
| 42 | +/* v1.7: poll count reduced */ |
| 43 | +//#define POLL_COUNT 0x8000 |
| 44 | +#define POLL_COUNT 0x1000 |
| 45 | + |
| 46 | +/* ports: |
| 47 | + * 00-07 interrupt/chip select |
41 | 48 | * 08-0B UART
|
42 |
| - * 0C-0F host interface - memory page |
| 49 | + * 0C-0F host interface - memory page |
43 | 50 | * 10-13 sample rate converter
|
44 | 51 | * 14-17 codec
|
45 | 52 | * 18-1F legacy
|
46 | 53 | * 20-2F serial interface
|
47 | 54 | * 30-3F host interface - memory
|
48 | 55 | */
|
49 | 56 |
|
50 |
| -#define POLL_COUNT 0x1000 |
51 |
| - |
52 | 57 | #define ES_REG_CONTROL 0x00 /* R/W: Interrupt/Chip select control register */
|
53 | 58 | #define ES_1371_GPIO_OUT(o) (((o)&0x0f)<<16)/* GPIO out [3:0] pins - W/R */
|
54 | 59 | #define ES_1371_SYNC_RES (1<<14) /* Warm AC97 reset */
|
|
187 | 192 |
|
188 | 193 | #define ENSONIQ_CARD_INFOBIT_AC97RESETHACK 0x01
|
189 | 194 |
|
| 195 | +/* sample rate converter (SRC) mask for status check; |
| 196 | + * bits 16-18, although used here, are documented as "undefined"! |
| 197 | + */ |
190 | 198 | #define SRC_MASK 0x870000UL
|
191 | 199 |
|
192 | 200 | struct ensoniq_card_s
|
@@ -228,7 +236,6 @@ static unsigned int snd_es1371_wait_src_rdy(struct ensoniq_card_s *card)
|
228 | 236 | }
|
229 | 237 |
|
230 | 238 | /* read "sample rate converter" data
|
231 |
| - * it's undocumented what purpose bit 16 has ( neither is bit 17/18 explained ) |
232 | 239 | */
|
233 | 240 |
|
234 | 241 | static unsigned short snd_es1371_src_read(struct ensoniq_card_s *card, unsigned short reg)
|
@@ -463,8 +470,9 @@ static unsigned int snd_es1371_buffer_init( struct ensoniq_card_s *card, struct
|
463 | 470 | //////////////////////////////////////////////////////////////////////////////////////////////////////
|
464 | 471 | {
|
465 | 472 | unsigned int bytes_per_sample = 2; // 16 bit
|
| 473 | + /* v1.7: use /PS cmdline option if set */ |
466 | 474 | //card->pcmout_bufsize = MDma_get_max_pcmoutbufsize( aui, 0, ES1371_DMABUF_ALIGN, bytes_per_sample, 0);
|
467 |
| - card->pcmout_bufsize = MDma_get_max_pcmoutbufsize( aui, 0, aui->gvars->period_size ? aui->gvars->period_size : ES1371_DMABUF_ALIGN, bytes_per_sample, 0); |
| 475 | + card->pcmout_bufsize = MDma_get_max_pcmoutbufsize( aui, 0, aui->gvars->period_size ? aui->gvars->period_size : ES1371_DMABUF_ALIGN, bytes_per_sample, 0); |
468 | 476 | card->dm = MDma_alloc_cardmem( card->pcmout_bufsize );
|
469 | 477 | if (!card->dm)
|
470 | 478 | return 0;
|
@@ -566,6 +574,7 @@ static void snd_es1371_prepare_playback( struct ensoniq_card_s *card, struct aud
|
566 | 574 | /* for DAC1: FRAME=port 30h, SIZE=port 34h, COUNT=port 24h */
|
567 | 575 | outl((card->port + ES_REG_DAC_FRAME), (unsigned long) pds_cardmem_physicalptr(card->dm, card->pcmout_buffer));
|
568 | 576 | outl((card->port + ES_REG_DAC_SIZE), (aui->card_dmasize >> 2) - 1);
|
| 577 | + /* v1.7: use /PS cmdline option if set */ |
569 | 578 | //outl((card->port + ES_REG_DAC_COUNT), (aui->card_dmasize >> 2) - 1);
|
570 | 579 | outl((card->port + ES_REG_DAC_COUNT), aui->gvars->period_size ? (aui->gvars->period_size >> 2) - 1 : (512>>2) - 1);
|
571 | 580 |
|
@@ -636,6 +645,7 @@ static int ES1371_adetect( struct audioout_info_s *aui )
|
636 | 645 | || ((card->pci_dev->device_id == 0x5880) && ((card->chiprev == CT5880REV_CT5880_C) || (card->chiprev == CT5880REV_CT5880_D) || (card->chiprev == CT5880REV_CT5880_E)))
|
637 | 646 | ) ) {
|
638 | 647 | card->infobits |= ENSONIQ_CARD_INFOBIT_AC97RESETHACK;
|
| 648 | + /* v1.7 fix: to enable 5880, bit 29 has to be set IN THE STATUS register */ |
639 | 649 | //card->sctrl |= ES_1371_ST_AC97_RST;
|
640 | 650 | card->cssr |= ES_1371_ST_AC97_RST;
|
641 | 651 | dbgprintf(("ES1371_adetect: INFOBIT_AC97RESETHACK set\n"));
|
@@ -680,6 +690,7 @@ static void ES1371_setrate( struct audioout_info_s *aui )
|
680 | 690 | /////////////////////////////////////////////////////////
|
681 | 691 | {
|
682 | 692 | struct ensoniq_card_s *card = aui->card_private_data;
|
| 693 | + /* v1.7: use /PS cmdline option if set */ |
683 | 694 | unsigned int pagesize = aui->gvars->period_size ? aui->gvars->period_size : ES1371_DMABUF_ALIGN;
|
684 | 695 |
|
685 | 696 | dbgprintf(("ES1371_setrate\n"));
|
|
0 commit comments