- Timestamp:
- May 16, 2020, 10:05:07 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-linux-3.2.102/alsa-kernel/pci/ens1370.c
r607 r612 23 23 * for ens1371 only ( FIXME ) 24 24 * derived from cs4281.c, atiixp.c and via82xx.c 25 * using http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ 25 * using http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ 26 26 * by Kurt J. Bosch 27 27 */ 28 29 #ifdef TARGET_OS2 30 #define KBUILD_MODNAME "ens1370" 31 #endif 28 32 29 33 #include <asm/io.h> … … 34 38 #include <linux/slab.h> 35 39 #include <linux/gameport.h> 36 #include <linux/module param.h>40 #include <linux/module.h> 37 41 #include <linux/mutex.h> 38 42 … … 230 234 #define ES_1371_CODEC_RDY (1<<31) /* codec ready */ 231 235 #define ES_1371_CODEC_WIP (1<<30) /* codec register access in progress */ 236 #define EV_1938_CODEC_MAGIC (1<<26) 232 237 #define ES_1371_CODEC_PIRD (1<<23) /* codec read/write select register */ 233 238 #define ES_1371_CODEC_WRITE(a,d) ((((a)&0x7f)<<16)|(((d)&0xffff)<<0)) … … 468 473 {5512, 11025, 22050, 44100}; 469 474 static struct snd_pcm_hw_constraint_list snd_es1370_hw_constraints_rates = { 470 .count = 4, 475 .count = 4, 471 476 .list = snd_es1370_fixed_rates, 472 477 .mask = 0, … … 474 479 static struct snd_ratnum es1370_clock = { 475 480 .num = ES_1370_SRCLOCK, 476 .den_min = 29, 481 .den_min = 29, 477 482 .den_max = 353, 478 483 .den_step = 1, … … 495 500 static struct snd_ratnum es1371_adc_clock = { 496 501 .num = 48000 << 15, 497 .den_min = 32768, 502 .den_min = 32768, 498 503 .den_max = 393216, 499 504 .den_step = 1, … … 604 609 #ifdef CHIP1371 605 610 611 static inline bool is_ev1938(struct ensoniq *ensoniq) 612 { 613 return ensoniq->pci->device == 0x8938; 614 } 615 606 616 static void snd_es1371_codec_write(struct snd_ac97 *ac97, 607 617 unsigned short reg, unsigned short val) 608 618 { 609 619 struct ensoniq *ensoniq = ac97->private_data; 610 unsigned int t, x; 611 620 unsigned int t, x, flag; 621 622 flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0; 612 623 mutex_lock(&ensoniq->src_mutex); 613 624 for (t = 0; t < POLL_COUNT; t++) { … … 631 642 break; 632 643 } 633 outl(ES_1371_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1371_CODEC)); 644 outl(ES_1371_CODEC_WRITE(reg, val) | flag, 645 ES_REG(ensoniq, 1371_CODEC)); 634 646 /* restore SRC reg */ 635 647 snd_es1371_wait_src_ready(ensoniq); … … 648 660 { 649 661 struct ensoniq *ensoniq = ac97->private_data; 650 unsigned int t, x, fail = 0; 651 662 unsigned int t, x, flag, fail = 0; 663 664 flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0; 652 665 __again: 653 666 mutex_lock(&ensoniq->src_mutex); … … 672 685 break; 673 686 } 674 outl(ES_1371_CODEC_READS(reg), ES_REG(ensoniq, 1371_CODEC)); 687 outl(ES_1371_CODEC_READS(reg) | flag, 688 ES_REG(ensoniq, 1371_CODEC)); 675 689 /* restore SRC reg */ 676 690 snd_es1371_wait_src_ready(ensoniq); … … 684 698 for (t = 0; t < POLL_COUNT; t++) { 685 699 if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) { 700 if (is_ev1938(ensoniq)) { 701 for (t = 0; t < 100; t++) 702 inl(ES_REG(ensoniq, CONTROL)); 703 x = inl(ES_REG(ensoniq, 1371_CODEC)); 704 } 686 705 mutex_unlock(&ensoniq->src_mutex); 687 706 return ES_1371_CODEC_READ(x); … … 1055 1074 #else 1056 1075 (SNDRV_PCM_RATE_KNOT | /* 5512Hz rate */ 1057 SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050 | 1076 SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050 | 1058 1077 SNDRV_PCM_RATE_44100), 1059 1078 #endif … … 1074 1093 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1075 1094 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1076 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | 1095 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | 1077 1096 SNDRV_PCM_INFO_SYNC_START), 1078 1097 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, … … 1866 1885 */ 1867 1886 1868 static void snd_ensoniq_proc_read(struct snd_info_entry *entry, 1887 static void snd_ensoniq_proc_read(struct snd_info_entry *entry, 1869 1888 struct snd_info_buffer *buffer) 1870 1889 { … … 2106 2125 ensoniq->port = pci_resource_start(pci, 0); 2107 2126 if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED, 2108 "Ensoniq AudioPCI", ensoniq)) {2127 KBUILD_MODNAME, ensoniq)) { 2109 2128 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2110 2129 snd_ensoniq_free(ensoniq); … … 2479 2498 2480 2499 static struct pci_driver driver = { 2481 .name = DRIVER_NAME,2500 .name = KBUILD_MODNAME, 2482 2501 .id_table = snd_audiopci_ids, 2483 2502 .probe = snd_audiopci_probe,
Note:
See TracChangeset
for help on using the changeset viewer.