Ignore:
Timestamp:
Apr 3, 2017, 4:51:56 PM (9 years ago)
Author:
David Azarewicz
Message:

Merged/reintegrated v2 branch into trunk. Trunk is now v2

Location:
GPL/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1.c

    r464 r598  
    5959static int enable_ir[SNDRV_CARDS];
    6060static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
     61#ifndef TARGET_OS2
     62static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
     63#else
     64static uint delay_pcm_irq[SNDRV_CARDS] = {2,2,2,2,2,2,2,2};
     65#endif
    6166
    6267module_param_array(index, int, NULL, 0444);
     
    8085module_param_array(subsystem, uint, NULL, 0444);
    8186MODULE_PARM_DESC(subsystem, "Force card subsystem model.");
     87module_param_array(delay_pcm_irq, uint, NULL, 0444);
     88MODULE_PARM_DESC(delay_pcm_irq, "Delay PCM interrupt by specified number of samples (default 0).");
    8289/*
    8390 * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value  Model:SB0400
    8491 */
    85 static struct pci_device_id snd_emu10k1_ids[] = {
     92static DEFINE_PCI_DEVICE_TABLE(snd_emu10k1_ids) = {
    8693        { PCI_VDEVICE(CREATIVE, 0x0002), 0 },   /* EMU10K1 */
    8794        { PCI_VDEVICE(CREATIVE, 0x0004), 1 },   /* Audigy */
     
    134141                goto error;
    135142        card->private_data = emu;
     143        emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f;
    136144        if ((err = snd_emu10k1_pcm(emu, 0, NULL)) < 0)
    137145                goto error;
  • GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1_main.c

    r522 r598  
    17971797                snd_printdd("Sound card name = %s, "
    17981798                        "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. "
    1799                         "Forced to subsytem = 0x%x\n",  c->name,
     1799                        "Forced to subsystem = 0x%x\n", c->name,
    18001800                        pci->vendor, pci->device, emu->serial, c->subsystem);
    18011801        else
  • GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1x.c

    r522 r598  
    115115#define PLAYBACK_LIST_SIZE      0x01            /* Size of list in bytes << 16. E.g. 8 periods -> 0x00380000  */
    116116#define PLAYBACK_LIST_PTR       0x02            /* Pointer to the current period being played */
    117 #define PLAYBACK_DMA_ADDR       0x04            /* Playback DMA addresss */
     117#define PLAYBACK_DMA_ADDR       0x04            /* Playback DMA address */
    118118#define PLAYBACK_PERIOD_SIZE    0x05            /* Playback period size */
    119119#define PLAYBACK_POINTER        0x06            /* Playback period pointer. Sample currently in DAC */
     
    185185 *  - channel 0 is the front channel
    186186 *  - channel 1 is the rear channel
    187  *  - channel 2 is the center/lfe chanel
     187 *  - channel 2 is the center/lfe channel
    188188 * Volume is controlled by the AC97 for the front and rear channels by
    189189 * the PCM Playback Volume, Sigmatel Surround Playback Volume and
     
    10451045                        continue;
    10461046
    1047                 if ((reg < 0x49) /* && (reg >= 0) && (val <= 0xffffffff) && (channel_id >= 0) DAZ */ && (channel_id <= 2) )
     1047                if (reg < 0x49 && /* val <= 0xffffffff && DAZ */ channel_id <= 2)
    10481048                        snd_emu10k1x_ptr_write(emu, reg, channel_id, val);
    10491049        }
     
    16101610
    16111611// PCI IDs
    1612 static struct pci_device_id snd_emu10k1x_ids[] = {
     1612static DEFINE_PCI_DEVICE_TABLE(snd_emu10k1x_ids) = {
    16131613        { PCI_VDEVICE(CREATIVE, 0x0006), 0 },   /* Dell OEM version (EMU10K1) */
    16141614        { 0, }
  • GPL/trunk/alsa-kernel/pci/emu10k1/emufx.c

    r479 r598  
    3636#include <linux/init.h>
    3737#include <linux/mutex.h>
     38#include <linux/moduleparam.h>
    3839
    3940#include <sound/core.h>
     
    5152#define EMU10K1_CENTER_LFE_FROM_FRONT
    5253#endif
     54
     55static bool high_res_gpr_volume;
     56module_param(high_res_gpr_volume, bool, 0444);
     57MODULE_PARM_DESC(high_res_gpr_volume, "GPR mixer controls use 31-bit range.");
    5358
    5459/*
     
    298303/* EMU10k1/EMU10k2 DSP control db gain */
    299304static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1);
     305static const DECLARE_TLV_DB_LINEAR(snd_emu10k1_db_linear, TLV_DB_GAIN_MUTE, 0);
    300306
    301307static const u32 onoff_table[2] = {
     
    10741080        ctl->vcount = ctl->count = 1;
    10751081        ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
    1076         ctl->min = 0;
    1077         ctl->max = 100;
    1078         ctl->tlv = snd_emu10k1_db_scale1;
    1079         ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;   
     1082        if (high_res_gpr_volume) {
     1083                ctl->min = 0;
     1084                ctl->max = 0x7fffffff;
     1085                ctl->tlv = snd_emu10k1_db_linear;
     1086                ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
     1087        } else {
     1088                ctl->min = 0;
     1089                ctl->max = 100;
     1090                ctl->tlv = snd_emu10k1_db_scale1;
     1091                ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
     1092        }
    10801093}
    10811094
     
    10891102        ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
    10901103        ctl->gpr[1] = gpr + 1; ctl->value[1] = defval;
    1091         ctl->min = 0;
    1092         ctl->max = 100;
    1093         ctl->tlv = snd_emu10k1_db_scale1;
    1094         ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
     1104        if (high_res_gpr_volume) {
     1105                ctl->min = 0;
     1106                ctl->max = 0x7fffffff;
     1107                ctl->tlv = snd_emu10k1_db_linear;
     1108                ctl->translation = EMU10K1_GPR_TRANSLATION_NONE;
     1109        } else {
     1110                ctl->min = 0;
     1111                ctl->max = 100;
     1112                ctl->tlv = snd_emu10k1_db_scale1;
     1113                ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100;
     1114        }
    10951115}
    10961116
  • GPL/trunk/alsa-kernel/pci/emu10k1/emumixer.c

    r410 r598  
    18191819                "Master Playback Volume", "Master Capture Volume",
    18201820                "Wave Master Playback Volume", "Master Playback Volume",
    1821                 "PC Speaker Playback Switch", "PC Speaker Capture Switch",
    1822                 "PC Speaker Playback Volume", "PC Speaker Capture Volume",
     1821                "Beep Playback Switch", "Beep Capture Switch",
     1822                "Beep Playback Volume", "Beep Capture Volume",
    18231823                "Phone Playback Switch", "Phone Capture Switch",
    18241824                "Phone Playback Volume", "Phone Capture Volume",
  • GPL/trunk/alsa-kernel/pci/emu10k1/emumpu401.c

    r399 r598  
    322322static void snd_emu10k1_midi_free(struct snd_rawmidi *rmidi)
    323323{
    324         struct snd_emu10k1_midi *midi = (struct snd_emu10k1_midi *)rmidi->private_data;
     324        struct snd_emu10k1_midi *midi = rmidi->private_data;
    325325        midi->interrupt = NULL;
    326326        midi->rmidi = NULL;
  • GPL/trunk/alsa-kernel/pci/emu10k1/emupcm.c

    r464 r598  
    333333                if (extra) {
    334334                        start_addr += ccis;
    335                         end_addr += ccis;
     335                        end_addr += ccis + emu->delay_pcm_irq;
    336336                }
    337337                if (stereo && !extra) {
     
    361361        snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]);
    362362        snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24));
    363         snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24));
     363        snd_emu10k1_ptr_write(emu, PSST, voice,
     364                        (start_addr + (extra ? emu->delay_pcm_irq : 0)) |
     365                        (send_amount[2] << 24));
    364366        if (emu->card_capabilities->emu_model)
    365367                pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */
     
    733735}
    734736
     737static inline void snd_emu10k1_playback_mangle_extra(struct snd_emu10k1 *emu,
     738                struct snd_emu10k1_pcm *epcm,
     739                struct snd_pcm_substream *substream,
     740                struct snd_pcm_runtime *runtime)
     741{
     742        unsigned int ptr, period_pos;
     743
     744        /* try to sychronize the current position for the interrupt
     745           source voice */
     746        period_pos = runtime->status->hw_ptr - runtime->hw_ptr_interrupt;
     747        period_pos %= runtime->period_size;
     748        ptr = snd_emu10k1_ptr_read(emu, CCCA, epcm->extra->number);
     749        ptr &= ~0x00ffffff;
     750        ptr |= epcm->ccca_start_addr + period_pos;
     751        snd_emu10k1_ptr_write(emu, CCCA, epcm->extra->number, ptr);
     752}
     753
    735754static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,
    736755                                        int cmd)
     
    754773        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
    755774        case SNDRV_PCM_TRIGGER_RESUME:
     775                if (cmd == SNDRV_PCM_TRIGGER_PAUSE_RELEASE)
     776                        snd_emu10k1_playback_mangle_extra(emu, epcm, substream, runtime);
    756777                mix = &emu->pcm_mixer[substream->number];
    757778                snd_emu10k1_playback_prepare_voice(emu, epcm->voices[0], 1, 0, mix);
     
    870891        /*
    871892        printk(KERN_DEBUG
    872                "ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n",
    873                ptr, runtime->buffer_size, runtime->period_size);
     893               "ptr = 0x%lx, buffer_size = 0x%lx, period_size = 0x%lx\n",
     894               (long)ptr, (long)runtime->buffer_size,
     895               (long)runtime->period_size);
    874896        */
    875897        return ptr;
  • GPL/trunk/alsa-kernel/pci/emu10k1/emuproc.c

    r399 r598  
    342342#define A_TOTAL_SIZE_CODE       (0x400*8)
    343343
    344 static long snd_emu10k1_fx8010_read(struct snd_info_entry *entry,
    345                                     void *file_private_data,
    346                                     struct file *file, char __user *buf,
    347                                     unsigned long count, unsigned long pos)
    348 {
    349         long size;
     344static ssize_t snd_emu10k1_fx8010_read(struct snd_info_entry *entry,
     345                                       void *file_private_data,
     346                                       struct file *file, char __user *buf,
     347                                       size_t count, loff_t pos)
     348{
    350349        struct snd_emu10k1 *emu = entry->private_data;
    351350        unsigned int offset;
    352351        int tram_addr = 0;
     352        unsigned int *tmp;
     353        long res;
     354        unsigned int idx;
    353355       
    354356        if (!strcmp(entry->name, "fx8010_tram_addr")) {
     
    362364                offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE;
    363365        }
    364         size = count;
    365         if (pos + size > entry->size)
    366                 size = (long)entry->size - pos;
    367         if (size > 0) {
    368                 unsigned int *tmp;
    369                 long res;
    370                 unsigned int idx;
    371                 if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL)
    372                         return -ENOMEM;
    373                 for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++)
    374                         if (tram_addr && emu->audigy) {
    375                                 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0) >> 11;
    376                                 tmp[idx] |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20;
    377                         } else
    378                                 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0);
    379                 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size))
    380                         res = -EFAULT;
    381                 else {
    382                         res = size;
     366
     367        tmp = kmalloc(count + 8, GFP_KERNEL);
     368        if (!tmp)
     369                return -ENOMEM;
     370        for (idx = 0; idx < ((pos & 3) + count + 3) >> 2; idx++) {
     371                unsigned int val;
     372                val = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0);
     373                if (tram_addr && emu->audigy) {
     374                        val >>= 11;
     375                        val |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20;
    383376                }
    384                 kfree(tmp);
    385                 return res;
    386         }
    387         return 0;
     377                tmp[idx] = val;
     378        }
     379        if (copy_to_user(buf, ((char *)tmp) + (pos & 3), count))
     380                res = -EFAULT;
     381        else
     382                res = count;
     383        kfree(tmp);
     384        return res;
    388385}
    389386
     
    452449                if (sscanf(line, "%x %x", &reg, &val) != 2)
    453450                        continue;
    454                 if ((reg < 0x40) && (reg >= 0) && (val <= 0xffffffff) ) {
     451                if (reg < 0x40 && val <= 0xffffffff) {
    455452                        spin_lock_irqsave(&emu->emu_lock, flags);
    456453                        outl(val, emu->port + (reg & 0xfffffffc));
     
    528525                if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
    529526                        continue;
    530                 if ((reg < 0xa0) && (reg >= 0) && (val <= 0xffffffff) && (channel_id >= 0) && (channel_id <= 3) )
     527                if (reg < 0xa0 && val <= 0xffffffff && channel_id <= 3)
    531528                        snd_ptr_write(emu, iobase, reg, channel_id, val);
    532529        }
  • GPL/trunk/alsa-kernel/pci/emu10k1/memory.c

    r522 r598  
    2323
    2424#include <linux/pci.h>
     25#include <linux/gfp.h>
    2526#include <linux/time.h>
    2627#include <linux/mutex.h>
     
    310311                return NULL;
    311312
     313        idx = runtime->period_size >= runtime->buffer_size ?
     314                                        (emu->delay_pcm_irq * 2) : 0;
    312315        mutex_lock(&hdr->block_mutex);
    313         blk = search_empty(emu, runtime->dma_bytes);
     316        blk = search_empty(emu, runtime->dma_bytes + idx);
    314317        if (blk == NULL) {
    315318                mutex_unlock(&hdr->block_mutex);
  • GPL/trunk/alsa-kernel/pci/emu10k1/p16v.h

    r305 r598  
    9797#define PLAYBACK_LIST_PTR       0x02            /* Pointer to the current period being played */
    9898#define PLAYBACK_UNKNOWN3       0x03            /* Not used */
    99 #define PLAYBACK_DMA_ADDR       0x04            /* Playback DMA addresss */
     99#define PLAYBACK_DMA_ADDR       0x04            /* Playback DMA address */
    100100#define PLAYBACK_PERIOD_SIZE    0x05            /* Playback period size. win2000 uses 0x04000000 */
    101101#define PLAYBACK_POINTER        0x06            /* Playback period pointer. Used with PLAYBACK_LIST_PTR to determine buffer position currently in DAC */
Note: See TracChangeset for help on using the changeset viewer.