Ignore:
Timestamp:
May 16, 2020, 10:05:07 AM (5 years ago)
Author:
Paul Smedley
Message:

Commit 3..102 changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-linux-3.2.102/alsa-kernel/pci/ens1370.c

    r607 r612  
    2323 * for ens1371 only ( FIXME )
    2424 * 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/ 
    2626 * by Kurt J. Bosch
    2727 */
     28
     29#ifdef TARGET_OS2
     30#define KBUILD_MODNAME "ens1370"
     31#endif
    2832
    2933#include <asm/io.h>
     
    3438#include <linux/slab.h>
    3539#include <linux/gameport.h>
    36 #include <linux/moduleparam.h>
     40#include <linux/module.h>
    3741#include <linux/mutex.h>
    3842
     
    230234#define   ES_1371_CODEC_RDY        (1<<31)      /* codec ready */
    231235#define   ES_1371_CODEC_WIP        (1<<30)      /* codec register access in progress */
     236#define   EV_1938_CODEC_MAGIC      (1<<26)
    232237#define   ES_1371_CODEC_PIRD       (1<<23)      /* codec read/write select register */
    233238#define   ES_1371_CODEC_WRITE(a,d) ((((a)&0x7f)<<16)|(((d)&0xffff)<<0))
     
    468473        {5512, 11025, 22050, 44100};
    469474static struct snd_pcm_hw_constraint_list snd_es1370_hw_constraints_rates = {
    470         .count = 4,
     475        .count = 4, 
    471476        .list = snd_es1370_fixed_rates,
    472477        .mask = 0,
     
    474479static struct snd_ratnum es1370_clock = {
    475480        .num = ES_1370_SRCLOCK,
    476         .den_min = 29,
     481        .den_min = 29, 
    477482        .den_max = 353,
    478483        .den_step = 1,
     
    495500static struct snd_ratnum es1371_adc_clock = {
    496501        .num = 48000 << 15,
    497         .den_min = 32768,
     502        .den_min = 32768, 
    498503        .den_max = 393216,
    499504        .den_step = 1,
     
    604609#ifdef CHIP1371
    605610
     611static inline bool is_ev1938(struct ensoniq *ensoniq)
     612{
     613        return ensoniq->pci->device == 0x8938;
     614}
     615
    606616static void snd_es1371_codec_write(struct snd_ac97 *ac97,
    607617                                   unsigned short reg, unsigned short val)
    608618{
    609619        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;
    612623        mutex_lock(&ensoniq->src_mutex);
    613624        for (t = 0; t < POLL_COUNT; t++) {
     
    631642                                        break;
    632643                        }
    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));
    634646                        /* restore SRC reg */
    635647                        snd_es1371_wait_src_ready(ensoniq);
     
    648660{
    649661        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;
    652665      __again:
    653666        mutex_lock(&ensoniq->src_mutex);
     
    672685                                        break;
    673686                        }
    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));
    675689                        /* restore SRC reg */
    676690                        snd_es1371_wait_src_ready(ensoniq);
     
    684698                        for (t = 0; t < POLL_COUNT; t++) {
    685699                                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                                        }
    686705                                        mutex_unlock(&ensoniq->src_mutex);
    687706                                        return ES_1371_CODEC_READ(x);
     
    10551074#else
    10561075                                (SNDRV_PCM_RATE_KNOT |  /* 5512Hz rate */
    1057                                  SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050 |
     1076                                 SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050 | 
    10581077                                 SNDRV_PCM_RATE_44100),
    10591078#endif
     
    10741093        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
    10751094                                 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 | 
    10771096                                 SNDRV_PCM_INFO_SYNC_START),
    10781097        .formats =              SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
     
    18661885 */
    18671886
    1868 static void snd_ensoniq_proc_read(struct snd_info_entry *entry,
     1887static void snd_ensoniq_proc_read(struct snd_info_entry *entry, 
    18691888                                  struct snd_info_buffer *buffer)
    18701889{
     
    21062125        ensoniq->port = pci_resource_start(pci, 0);
    21072126        if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED,
    2108                         "Ensoniq AudioPCI", ensoniq)) {
     2127                        KBUILD_MODNAME, ensoniq)) {
    21092128                snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
    21102129                snd_ensoniq_free(ensoniq);
     
    24792498
    24802499static struct pci_driver driver = {
    2481         .name = DRIVER_NAME,
     2500        .name = KBUILD_MODNAME,
    24822501        .id_table = snd_audiopci_ids,
    24832502        .probe = snd_audiopci_probe,
Note: See TracChangeset for help on using the changeset viewer.