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:
7 added
7 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

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

    r464 r598  
    6868MODULE_PARM_DESC(mmap_valid, "Support OSS mmap.");
    6969
    70 static struct pci_device_id snd_cs46xx_ids[] = {
     70static DEFINE_PCI_DEVICE_TABLE(snd_cs46xx_ids) = {
    7171        { PCI_VDEVICE(CIRRUS, 0x6001), 0, },   /* CS4280 */
    7272        { PCI_VDEVICE(CIRRUS, 0x6003), 0, },   /* CS4612 */
  • GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx_lib.c

    r426 r598  
    22392239        /* set the desired CODEC mode */
    22402240        if (ac97->num == CS46XX_PRIMARY_CODEC_INDEX) {
    2241                 snd_printdd("cs46xx: CODOEC1 mode %04x\n",0x0);
    2242                 snd_cs46xx_ac97_write(ac97,AC97_CSR_ACMODE,0x0);
     2241                snd_printdd("cs46xx: CODEC1 mode %04x\n", 0x0);
     2242                snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x0);
    22432243        } else if (ac97->num == CS46XX_SECONDARY_CODEC_INDEX) {
    2244                 snd_printdd("cs46xx: CODOEC2 mode %04x\n",0x3);
    2245                 snd_cs46xx_ac97_write(ac97,AC97_CSR_ACMODE,0x3);
     2244                snd_printdd("cs46xx: CODEC2 mode %04x\n", 0x3);
     2245                snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x3);
    22462246        } else {
    22472247                snd_BUG(); /* should never happen ... */
     
    22672267
    22682268                /* test if we can write to the record gain volume register */
    2269                 snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x8a05);
     2269                snd_ac97_write(ac97, AC97_REC_GAIN, 0x8a05);
    22702270                if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05)
    22712271                        return;
     
    26582658 */
    26592659
    2660 static long snd_cs46xx_io_read(struct snd_info_entry *entry, void *file_private_data,
    2661                                struct file *file, char __user *buf,
    2662                                unsigned long count, unsigned long pos)
    2663 {
    2664         long size;
     2660static ssize_t snd_cs46xx_io_read(struct snd_info_entry *entry,
     2661                                  void *file_private_data,
     2662                                  struct file *file, char __user *buf,
     2663                                  size_t count, loff_t pos)
     2664{
    26652665        struct snd_cs46xx_region *region = entry->private_data;
    26662666       
    2667         size = count;
    2668         if (pos + (size_t)size > region->size)
    2669                 size = region->size - pos;
    2670         if (size > 0) {
    2671                 if (copy_to_user_fromio(buf, region->remap_addr + pos, size))
    2672                         return -EFAULT;
    2673         }
    2674         return size;
     2667        if (copy_to_user_fromio(buf, region->remap_addr + pos, count))
     2668                return -EFAULT;
     2669        return count;
    26752670}
    26762671
     
    35983593static unsigned int saved_regs[] = {
    35993594        BA0_ACOSV,
    3600         BA0_ASER_FADDR,
     3595        /*BA0_ASER_FADDR,*/
    36013596        BA0_ASER_MASTER,
    36023597        BA1_PVOL,
     
    36453640        int i;
    36463641#endif
     3642        unsigned int tmp;
    36473643
    36483644        pci_set_power_state(pci, PCI_D0);
     
    36853681        snd_ac97_resume(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]);
    36863682        snd_ac97_resume(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]);
     3683
     3684        /*
     3685         *  Stop capture DMA.
     3686         */
     3687        tmp = snd_cs46xx_peek(chip, BA1_CCTL);
     3688        chip->capt.ctl = tmp & 0x0000ffff;
     3689        snd_cs46xx_poke(chip, BA1_CCTL, tmp & 0xffff0000);
     3690
     3691        mdelay(5);
    36873692
    36883693        /* reset playback/capture */
  • GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx_lib.h

    r426 r598  
    3636
    3737#ifdef CONFIG_SND_CS46XX_NEW_DSP
    38 #define CS46XX_MIN_PERIOD_SIZE 1
     38#define CS46XX_MIN_PERIOD_SIZE 64
    3939#define CS46XX_MAX_PERIOD_SIZE 1024*1024
    4040#else
  • GPL/trunk/alsa-kernel/pci/cs46xx/dsp_spos.c

    r399 r598  
    226226        struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL);
    227227
    228         if (ins == NULL) 
     228        if (ins == NULL)
    229229                return NULL;
    230230
    231231        /* better to use vmalloc for this big table */
    232         ins->symbol_table.nsymbols = 0;
    233232        ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) *
    234233                                            DSP_MAX_SYMBOLS);
    235         ins->symbol_table.highest_frag_index = 0;
    236 
    237         if (ins->symbol_table.symbols == NULL) {
     234        ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL);
     235        ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL);
     236        if (!ins->symbol_table.symbols || !ins->code.data || !ins->modules) {
    238237                cs46xx_dsp_spos_destroy(chip);
    239238                goto error;
    240239        }
    241 
     240        ins->symbol_table.nsymbols = 0;
     241        ins->symbol_table.highest_frag_index = 0;
    242242        ins->code.offset = 0;
    243243        ins->code.size = 0;
    244         ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL);
    245 
    246         if (ins->code.data == NULL) {
    247                 cs46xx_dsp_spos_destroy(chip);
    248                 goto error;
    249         }
    250 
    251244        ins->nscb = 0;
    252245        ins->ntask = 0;
    253 
    254246        ins->nmodules = 0;
    255         ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL);
    256 
    257         if (ins->modules == NULL) {
    258                 cs46xx_dsp_spos_destroy(chip);
    259                 goto error;
    260         }
    261247
    262248        /* default SPDIF input sample rate
     
    272258        /* set left and right validity bits and
    273259           default channel status */
    274         ins->spdif_csuv_default = 
    275                 ins->spdif_csuv_stream = 
     260        ins->spdif_csuv_default =
     261                ins->spdif_csuv_stream =
    276262         /* byte 0 */  ((unsigned int)_wrap_all_bits(  (SNDRV_PCM_DEFAULT_CON_SPDIF        & 0xff)) << 24) |
    277263         /* byte 1 */  ((unsigned int)_wrap_all_bits( ((SNDRV_PCM_DEFAULT_CON_SPDIF >> 8) & 0xff)) << 16) |
     
    282268
    283269error:
     270        kfree(ins->modules);
     271        kfree(ins->code.data);
     272        vfree(ins->symbol_table.symbols);
    284273        kfree(ins);
    285274        return NULL;
     
    299288
    300289                cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) );
     290#ifdef CONFIG_PM
     291                kfree(ins->scbs[i].data);
     292#endif
    301293        }
    302294
     
    975967        index = find_free_scb_index (ins);
    976968
     969        memset(&ins->scbs[index], 0, sizeof(ins->scbs[index]));
    977970        strcpy(ins->scbs[index].scb_name, name);
    978971        ins->scbs[index].address = dest;
    979972        ins->scbs[index].index = index;
    980         ins->scbs[index].proc_info = NULL;
    981973        ins->scbs[index].ref_count = 1;
    982         ins->scbs[index].deleted = 0;
    983         spin_lock_init(&ins->scbs[index].lock);
    984974
    985975        desc = (ins->scbs + index);
     
    10231013}
    10241014
     1015#define SCB_BYTES       (0x10 * 4)
     1016
    10251017struct dsp_scb_descriptor *
    10261018cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 dest)
    10271019{
    10281020        struct dsp_scb_descriptor * desc;
     1021
     1022#ifdef CONFIG_PM
     1023        /* copy the data for resume */
     1024        scb_data = kmemdup(scb_data, SCB_BYTES, GFP_KERNEL);
     1025        if (!scb_data)
     1026                return NULL;
     1027#endif
    10291028
    10301029        desc = _map_scb (chip,name,dest);
     
    10341033        } else {
    10351034                snd_printk(KERN_ERR "dsp_spos: failed to map SCB\n");
     1035#ifdef CONFIG_PM
     1036                kfree(scb_data);
     1037#endif
    10361038        }
    10371039
     
    19891991                _dsp_create_scb(chip, s->data, s->address);
    19901992        }
    1991 
     1993        for (i = 0; i < ins->nscb; i++) {
     1994                struct dsp_scb_descriptor *s = &ins->scbs[i];
     1995                if (s->deleted)
     1996                        continue;
     1997                if (s->updated)
     1998                        cs46xx_dsp_spos_update_scb(chip, s);
     1999                if (s->volume_set)
     2000                        cs46xx_dsp_scb_set_volume(chip, s,
     2001                                                  s->volume[0], s->volume[1]);
     2002        }
     2003        if (ins->spdif_status_out & DSP_SPDIF_STATUS_HW_ENABLED) {
     2004                cs46xx_dsp_enable_spdif_hw(chip);
     2005                snd_cs46xx_poke(chip, (ins->ref_snoop_scb->address + 2) << 2,
     2006                                (OUTPUT_SNOOP_BUFFER + 0x10) << 0x10);
     2007                if (ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN)
     2008                        cs46xx_poke_via_dsp(chip, SP_SPDOUT_CSUV,
     2009                                            ins->spdif_csuv_stream);
     2010        }
     2011        if (chip->dsp_spos_instance->spdif_status_in) {
     2012                cs46xx_poke_via_dsp(chip, SP_ASER_COUNTDOWN, 0x80000005);
     2013                cs46xx_poke_via_dsp(chip, SP_SPDIN_CONTROL, 0x800003ff);
     2014        }
    19922015        return 0;
    19932016}
  • GPL/trunk/alsa-kernel/pci/cs46xx/dsp_spos.h

    r305 r598  
    213213                        (scb->sub_list_ptr->address << 0x10) |
    214214                        (scb->next_scb_ptr->address)); 
     215        scb->updated = 1;
    215216}
    216217
     
    223224        snd_cs46xx_poke(chip, (scb->address + SCBVolumeCtrl) << 2, val);
    224225        snd_cs46xx_poke(chip, (scb->address + SCBVolumeCtrl + 1) << 2, val);
     226        scb->volume_set = 1;
     227        scb->volume[0] = left;
     228        scb->volume[1] = right;
    225229}
    226230#endif /* __DSP_SPOS_H__ */
  • GPL/trunk/alsa-kernel/pci/cs46xx/dsp_spos_scb_lib.c

    r399 r598  
    116116{
    117117        struct dsp_spos_instance * ins = chip->dsp_spos_instance;
    118         unsigned long flags;
    119118
    120119        if ( scb->parent_scb_ptr ) {
     
    154153                }
    155154
    156                 spin_lock_irqsave(&chip->reg_lock, flags);   
    157 
    158155                /* update parent first entry in DSP RAM */
    159156                cs46xx_dsp_spos_update_scb(chip,scb->parent_scb_ptr);
     
    163160
    164161                scb->parent_scb_ptr = NULL;
    165                 spin_unlock_irqrestore(&chip->reg_lock, flags);
    166162        }
    167163}
     
    198194#endif
    199195
    200         spin_lock_irqsave(&scb->lock, flags);
     196        spin_lock_irqsave(&chip->reg_lock, flags);   
    201197        _dsp_unlink_scb (chip,scb);
    202         spin_unlock_irqrestore(&scb->lock, flags);
     198        spin_unlock_irqrestore(&chip->reg_lock, flags);
    203199
    204200        cs46xx_dsp_proc_free_scb_desc(scb);
     
    208204
    209205        ins->scbs[scb->index].deleted = 1;
     206#ifdef CONFIG_PM
     207        kfree(ins->scbs[scb->index].data);
     208        ins->scbs[scb->index].data = NULL;
     209#endif
    210210
    211211        if (scb->index < ins->scb_highest_frag_index)
     
    15091509                return -EIO;
    15101510
    1511         spin_lock(&pcm_channel->src_scb->lock);
    1512 
     1511        spin_lock_irqsave(&chip->reg_lock, flags);
    15131512        if (pcm_channel->unlinked) {
    1514                 spin_unlock(&pcm_channel->src_scb->lock);
     1513                spin_unlock_irqrestore(&chip->reg_lock, flags);
    15151514                return -EIO;
    15161515        }
    15171516
    1518         spin_lock_irqsave(&chip->reg_lock, flags);
    15191517        pcm_channel->unlinked = 1;
     1518
     1519        _dsp_unlink_scb (chip,pcm_channel->pcm_reader_scb);
    15201520        spin_unlock_irqrestore(&chip->reg_lock, flags);
    15211521
    1522         _dsp_unlink_scb (chip,pcm_channel->pcm_reader_scb);
    1523 
    1524         spin_unlock(&pcm_channel->src_scb->lock);
    15251522        return 0;
    15261523}
     
    15341531        unsigned long flags;
    15351532
    1536         spin_lock(&pcm_channel->src_scb->lock);
     1533        spin_lock_irqsave(&chip->reg_lock, flags);
    15371534
    15381535        if (pcm_channel->unlinked == 0) {
    1539                 spin_unlock(&pcm_channel->src_scb->lock);
     1536                spin_unlock_irqrestore(&chip->reg_lock, flags);
    15401537                return -EIO;
    15411538        }
     
    15531550        pcm_channel->pcm_reader_scb->parent_scb_ptr = parent_scb;
    15541551
    1555         spin_lock_irqsave(&chip->reg_lock, flags);
    1556 
    15571552        /* update SCB entry in DSP RAM */
    15581553        cs46xx_dsp_spos_update_scb(chip,pcm_channel->pcm_reader_scb);
     
    15631558        pcm_channel->unlinked = 0;
    15641559        spin_unlock_irqrestore(&chip->reg_lock, flags);
    1565 
    1566         spin_unlock(&pcm_channel->src_scb->lock);
    15671560        return 0;
    15681561}
     
    15971590int cs46xx_src_unlink(struct snd_cs46xx *chip, struct dsp_scb_descriptor * src)
    15981591{
     1592        unsigned long flags;
     1593
    15991594        if (snd_BUG_ON(!src->parent_scb_ptr))
    16001595                return -EINVAL;
     
    16031598        cs46xx_dsp_scb_set_volume (chip,src,0,0);
    16041599
     1600        spin_lock_irqsave(&chip->reg_lock, flags);
    16051601        _dsp_unlink_scb (chip,src);
     1602        spin_unlock_irqrestore(&chip->reg_lock, flags);
    16061603
    16071604        return 0;
Note: See TracChangeset for help on using the changeset viewer.