Ignore:
Timestamp:
Aug 27, 2007, 7:41:50 PM (18 years ago)
Author:
Brendan Oakley
Message:

Merged to ALSA 0.9.5

Location:
GPL/branches/alsa-resync1/alsa-kernel/pci
Files:
2 added
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/alsa-resync1/alsa-kernel/pci/cs4281.c

    r212 r250  
    2727#include <linux/pci.h>
    2828#include <linux/slab.h>
     29#ifndef TARGET_OS2 //TODO: Implement linux/gameport.h
     30#include <linux/gameport.h>
     31#endif /* TARGET_OS2 */
    2932#include <sound/core.h>
    3033#include <sound/control.h>
     
    3639#include <sound/initval.h>
    3740
    38 #ifndef LINUX_2_2
    39 #include <linux/gameport.h>
    40 #endif
    4141
    4242MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    12471247 */
    12481248
    1249 #ifndef LINUX_2_2
     1249#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    12501250
    12511251typedef struct snd_cs4281_gameport {
     
    13421342static int snd_cs4281_free(cs4281_t *chip)
    13431343{
    1344 #ifndef LINUX_2_2
     1344#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    13451345    if (chip->gameport) {
    13461346        gameport_unregister_port(&chip->gameport->info);
     
    17301730    chip->uartm |= CS4281_MODE_OUTPUT;
    17311731    chip->midcr |= BA0_MIDCR_TXE;
    1732     chip->midi_input = substream;
     1732        chip->midi_output = substream;
    17331733    if (!(chip->uartm & CS4281_MODE_INPUT)) {
    17341734        snd_cs4281_midi_reset(chip);
     
    19131913    /* EOI to the PCI part... reenables interrupts */
    19141914    snd_cs4281_pokeBA0(chip, BA0_HICR, BA0_HICR_EOI);
     1915
    19151916    return IRQ_HANDLED;
    19161917
     
    19911992        return err;
    19921993    }
    1993 #ifndef LINUX_2_2
     1994#ifndef TARGET_OS2
    19941995    snd_cs4281_gameport(chip);
    1995 #endif
     1996#endif /* !TARGET_OS2 */
    19961997    strcpy(card->driver, "CS4281");
    19971998    strcpy(card->shortname, "Cirrus Logic CS4281");
  • GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c

    r212 r250  
    667667}
    668668
     669#define big_mdelay(msec) do {\
     670        set_current_state(TASK_UNINTERRUPTIBLE);\
     671        schedule_timeout(((msec) * HZ + 999) / 1000);\
     672} while (0)
     673       
    669674/* Wait for the codec bus to be free */
    670675static int snd_es1968_ac97_wait(es1968_t *chip)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ak4xxx.c

    r246 r250  
    2828#include <linux/init.h>
    2929#include <sound/core.h>
     30#include <sound/initval.h>
    3031#include "ice1712.h"
     32
     33MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     34MODULE_DESCRIPTION("ICEnsemble ICE17xx <-> AK4xxx AD/DA chip interface");
     35MODULE_LICENSE("GPL");
     36MODULE_CLASSES("{sound}");
    3137
    3238static void snd_ice1712_akm4xxx_lock(akm4xxx_t *ak, int chip)
     
    98104        }
    99105
    100         /* save the data */
    101         if (ak->type == SND_AK4524 || ak->type == SND_AK4528) {
    102                 if ((addr != 0x04 && addr != 0x05) || (data & 0x80) == 0)
    103                         ak->images[chip][addr] = data;
    104                 else
    105                         ak->ipga_gain[chip][addr-4] = data;
    106         } else {
    107                 /* AK4529, or else */
    108                 ak->images[chip][addr] = data;
    109         }
    110        
    111106        if (priv->cs_mask == priv->cs_addr) {
    112107                if (priv->cif) {
     
    180175        return 0;
    181176}
     177
     178EXPORT_SYMBOL(snd_ice1712_akm4xxx_init);
     179EXPORT_SYMBOL(snd_ice1712_akm4xxx_free);
     180EXPORT_SYMBOL(snd_ice1712_akm4xxx_build_controls);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ews.c

    r246 r250  
    390390 */
    391391
     392/* 6fire specific */
     393#define PCF9554_REG_INPUT      0
     394#define PCF9554_REG_OUTPUT     1
     395#define PCF9554_REG_POLARITY   2
     396#define PCF9554_REG_CONFIG     3
     397
     398static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char reg, unsigned char data);
     399
    392400static int __devinit snd_ice1712_ews_init(ice1712_t *ice)
    393401{
     
    426434                        return err;
    427435                }
     436                snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80);
    428437                break;
    429438        case ICE1712_SUBDEVICE_EWS88MT:
     
    450459                if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0)
    451460                        return err;
     461                snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
    452462                break;
    453463        case ICE1712_SUBDEVICE_DMX6FIRE:
    454464                if ((err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR)) < 0)
    455465                        return err;
     466                snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
    456467                break;
    457468        case ICE1712_SUBDEVICE_EWS88MT:
     
    750761 * DMX 6Fire specific controls
    751762 */
    752 
    753 #define PCF9554_REG_INPUT       0
    754 #define PCF9554_REG_OUTPUT      1
    755 #define PCF9554_REG_POLARITY    2
    756 #define PCF9554_REG_CONFIG      3
    757763
    758764static int snd_ice1712_6fire_read_pca(ice1712_t *ice, unsigned char reg)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c

    r246 r250  
    119119
    120120/*
    121  *  AK4xxx stuff
    122  */
    123 
    124 #include "ak4xxx.c"
    125 
    126 /*
    127121 *  Basic I/O
    128122 */
     
    305299{
    306300        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, data);
     301        inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */
    307302}
    308303
     
    310305{
    311306        snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data);
     307        inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */
    312308}
    313309
     
    320316{
    321317        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, val);
     318        inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */
    322319}
    323320
     
    667664                return 0;
    668665        ptr = runtime->buffer_size - inw(ice->ddma_port + 4);
     666        if (ptr == runtime->buffer_size)
     667                ptr = 0;
    669668        return bytes_to_frames(substream->runtime, ptr);
    670669}
     
    684683        ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) -
    685684                ice->playback_con_virt_addr[substream->number];
     685        if (ptr == substream->runtime->buffer_size)
     686                ptr = 0;
    686687        return bytes_to_frames(substream->runtime, ptr);
    687688}
     
    695696                return 0;
    696697        ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr;
     698        if (ptr == substream->runtime->buffer_size)
     699                ptr = 0;
    697700        return bytes_to_frames(substream->runtime, ptr);
    698701}
     
    11051108                return 0;
    11061109        ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2);
     1110        if (ptr == substream->runtime->buffer_size)
     1111                ptr = 0;
    11071112        return bytes_to_frames(substream->runtime, ptr);
    11081113}
     
    11161121                return 0;
    11171122        ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2);
     1123        if (ptr == substream->runtime->buffer_size)
     1124                ptr = 0;
    11181125        return bytes_to_frames(substream->runtime, ptr);
    11191126}
     
    21522159{
    21532160        int dev = 0xa0;         /* EEPROM device address */
    2154         unsigned int i;
     2161        unsigned int i, size;
    21552162
    21562163        if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) == 0) {
     
    21632170                                (snd_ice1712_read_i2c(ice, dev, 0x03) << 24);
    21642171        ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04);
    2165         if (ice->eeprom.size > 32) {
     2172        if (ice->eeprom.size < 6)
     2173                ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */
     2174        else if (ice->eeprom.size > 32) {
    21662175                snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size);
    21672176                return -EIO;
     
    21722181                /* return -EIO; */
    21732182        }
    2174         for (i = 0; i < ice->eeprom.size; i++)
     2183        size = ice->eeprom.size - 6;
     2184        for (i = 0; i < size; i++)
    21752185                ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6);
    21762186
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h

    r246 r250  
    457457        int (*build_controls)(ice1712_t *);
    458458        int no_mpu401: 1;
     459        unsigned int eeprom_size;
     460        unsigned char *eeprom_data;
    459461};
    460462
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1724.c

    r246 r250  
    4343#include "amp.h"
    4444#include "revo.h"
     45#include "aureon.h"
    4546
    4647MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
     
    5152               REVO_DEVICE_DESC
    5253               AMP_AUDIO2000_DEVICE_DESC
     54               AUREON_DEVICE_DESC
    5355                "{VIA,VT1724},"
    5456                "{ICEnsemble,Generic ICE1724},"
     
    8991
    9092/*
    91  *  AK4xxx stuff
    92  */
    93 
    94 #include "ak4xxx.c"
    95 
    96 /*
    9793 *  Basic I/O
    9894 */
     
    123119                if (!(old_cmd & VT1724_AC97_READY))
    124120                        continue;
    125                 return 0;
    126         }
     121                return old_cmd;
     122        }
     123        snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n");
    127124        return old_cmd;
    128125}
     
    134131                if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0)
    135132                        return 0;
     133        snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n");
    136134        return -EIO;
    137135}
     
    145143
    146144        old_cmd = snd_vt1724_ac97_ready(ice);
     145        old_cmd &= ~VT1724_AC97_ID_MASK;
     146        old_cmd |= ac97->num;
    147147        outb(reg, ICEMT1724(ice, AC97_INDEX));
    148148        outw(val, ICEMT1724(ice, AC97_DATA));
    149         old_cmd &= ~(VT1724_AC97_PBK_VSR | VT1724_AC97_CAP_VSR);
    150149        outb(old_cmd | VT1724_AC97_WRITE, ICEMT1724(ice, AC97_CMD));
    151150        snd_vt1724_ac97_wait_bit(ice, VT1724_AC97_WRITE);
     
    158157
    159158        old_cmd = snd_vt1724_ac97_ready(ice);
     159        old_cmd &= ~VT1724_AC97_ID_MASK;
     160        old_cmd |= ac97->num;
    160161        outb(reg, ICEMT1724(ice, AC97_INDEX));
    161162        outb(old_cmd | VT1724_AC97_READ, ICEMT1724(ice, AC97_CMD));
     
    174175{
    175176        outl(data, ICEREG1724(ice, GPIO_DIRECTION));
     177        inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */
    176178}
    177179
     
    181183        outw(data, ICEREG1724(ice, GPIO_WRITE_MASK));
    182184        outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22));
     185        inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */
    183186}
    184187
     
    187190        outw(data, ICEREG1724(ice, GPIO_DATA));
    188191        outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22));
     192        inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */
    189193}
    190194
     
    417421                if (val != old) {
    418422                        outb(val, ICEMT1724(ice, I2S_FORMAT));
    419                         /* FIXME: is this revo only? */
    420                         /* assert PRST# to converters; MT05 bit 7 */
    421                         outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
    422                         spin_unlock_irqrestore(&ice->reg_lock, flags);
    423                         mdelay(5);
    424                         spin_lock_irqsave(&ice->reg_lock, flags);
    425                         /* deassert PRST# */
    426                         outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
     423                        if (ice->eeprom.subvendor == VT1724_SUBDEVICE_REVOLUTION71) {
     424                                /* FIXME: is this revo only? */
     425                                /* assert PRST# to converters; MT05 bit 7 */
     426                                outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
     427                                spin_unlock_irqrestore(&ice->reg_lock, flags);
     428                                mdelay(5);
     429                                spin_lock_irqsave(&ice->reg_lock, flags);
     430                                /* deassert PRST# */
     431                                outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
     432                        }
    427433                }
    428434        }
     
    885891        if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) {
    886892                ac97_t ac97;
     893                /* cold reset */
     894                outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
     895                mdelay(5); /* FIXME */
     896                outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
     897
    887898                memset(&ac97, 0, sizeof(ac97));
    888899                ac97.write = snd_vt1724_ac97_write;
     
    15411552 */
    15421553
     1554static struct snd_ice1712_card_info no_matched __devinitdata;
     1555
     1556static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
     1557        snd_vt1724_revo_cards,
     1558        snd_vt1724_amp_cards,
     1559        snd_vt1724_aureon_cards,
     1560        0,
     1561};
     1562
     1563
     1564/*
     1565 */
     1566
    15431567static unsigned char __devinit snd_vt1724_read_i2c(ice1712_t *ice,
    15441568                                                 unsigned char dev,
     
    15561580{
    15571581        int dev = 0xa0;         /* EEPROM device address */
    1558         unsigned int i;
     1582        unsigned int i, size;
     1583        struct snd_ice1712_card_info **tbl, *c;
    15591584
    15601585        if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) {
     
    15661591                                (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) |
    15671592                                (snd_vt1724_read_i2c(ice, dev, 0x03) << 24);
     1593
     1594        /* if the EEPROM is given by the driver, use it */
     1595        for (tbl = card_tables; *tbl; tbl++) {
     1596                for (c = *tbl; c->subvendor; c++) {
     1597                        if (c->subvendor == ice->eeprom.subvendor) {
     1598                                if (! c->eeprom_size || ! c->eeprom_data)
     1599                                        goto found;
     1600                                snd_printdd("using the defined eeprom..\n");
     1601                                ice->eeprom.version = 2;
     1602                                ice->eeprom.size = c->eeprom_size + 6;
     1603                                memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
     1604                                goto read_skipped;
     1605                        }
     1606                }
     1607        }
     1608
     1609 found:
    15681610        ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);
    1569         if (ice->eeprom.size > 32) {
     1611        if (ice->eeprom.size < 6)
     1612                ice->eeprom.size = 32;
     1613        else if (ice->eeprom.size > 32) {
    15701614                snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size);
    15711615                return -EIO;
     
    15761620                // return -EIO;
    15771621        }
    1578         for (i = 0; i < ice->eeprom.size; i++)
     1622        size = ice->eeprom.size - 6;
     1623        for (i = 0; i < size; i++)
    15791624                ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6);
    15801625
     1626 read_skipped:
    15811627        ice->eeprom.gpiomask = eeprom_triple(ice, ICE_EEP2_GPIO_MASK);
    15821628        ice->eeprom.gpiostate = eeprom_triple(ice, ICE_EEP2_GPIO_STATE);
     
    18041850 */
    18051851
    1806 static struct snd_ice1712_card_info no_matched __devinitdata;
    1807 
    1808 static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
    1809         snd_vt1724_revo_cards,
    1810         snd_vt1724_amp_cards,
    1811         0,
    1812 };
    1813 
    1814 
    18151852static int __devinit snd_vt1724_probe(struct pci_dev *pci,
    18161853                                      const struct pci_device_id *pci_id)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/makefile.os2

    r246 r250  
    1515FILE1    = ak4xxx.obj delta.obj ews.obj hoontech.obj ice1712.obj
    1616FILE2    = ice1724.obj revo.obj
    17 FILE3    =
     17FILE3    = aureon.obj
    1818FILE4    =
    1919FILE5    =
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/revo.c

    r246 r250  
    6060                shift = 3;
    6161        }
    62         tmp = ak->images[0][reg];
     62        tmp = snd_akm4xxx_get(ak, 0, reg);
    6363        old = (tmp >> shift) & 0x03;
    6464        if (old == dfs)
     
    6767        /* reset DFS */
    6868        snd_akm4xxx_reset(ak, 1);
    69         tmp = ak->images[0][reg];
     69        tmp = snd_akm4xxx_get(ak, 0, reg);
    7070        tmp &= ~(0x03 << shift);
    7171        tmp |= dfs << shift;
     
    122122{
    123123        akm4xxx_t *ak;
     124        int err;
    124125
    125126        /* determine I2C, DACs and ADCs */
     
    140141        switch (ice->eeprom.subvendor) {
    141142        case VT1724_SUBDEVICE_REVOLUTION71:
    142                 snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice);
    143                 snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice);
     143                if ((err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice)) < 0)
     144                        return err;
     145                if ((err = snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice)) < 0)
     146                        return err;
    144147                /* unmute all codecs */
    145148                snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE, VT1724_REVO_MUTE);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c

    r246 r250  
    11451145
    11461146        if (!doorbellValue)
    1147                 return IRQ_HANDLED;
     1147                return IRQ_NONE;
    11481148
    11491149        spin_lock(&korg1212->lock);
     
    12191219
    12201220        spin_unlock(&korg1212->lock);
     1221
    12211222        return IRQ_HANDLED;
    12221223}
  • GPL/branches/alsa-resync1/alsa-kernel/pci/maestro3.c

    r212 r250  
    4444#include <sound/control.h>
    4545#include <sound/pcm.h>
     46#include <sound/mpu401.h>
    4647#include <sound/ac97_codec.h>
    4748#define SNDRV_GET_ID
     
    10551056 */
    10561057
     1058#define big_mdelay(msec) do {\
     1059        set_current_state(TASK_UNINTERRUPTIBLE);\
     1060        schedule_timeout(((msec) * HZ) / 1000);\
     1061} while (0)
     1062       
    10571063inline static void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg)
    10581064{
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c

    r246 r250  
    807807        switch (mode) {
    808808        case RME96_CLOCKMODE_SLAVE:
     809                /* AutoSync */
    809810                rme96->wcreg &= ~RME96_WCR_MASTER;
    810811                rme96->areg &= ~RME96_AR_WSEL;
    811812                break;
    812813        case RME96_CLOCKMODE_MASTER:
     814                /* Internal */
    813815                rme96->wcreg |= RME96_WCR_MASTER;
    814816                rme96->areg &= ~RME96_AR_WSEL;
     
    13191321
    13201322        runtime->hw = snd_rme96_capture_adat_info;
    1321         if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {
     1323        if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
    13221324                /* makes no sense to use analog input. Note that analog
    13231325                   expension cards AEB4/8-I are RME96_INPUT_INTERNAL */
     
    18631865        }
    18641866        if (rme96->areg & RME96_AR_WSEL) {
    1865                 snd_iprintf(buffer, "  clock mode: word clock\n");
     1867                snd_iprintf(buffer, "  sample clock source: word clock\n");
    18661868        } else if (rme96->wcreg & RME96_WCR_MASTER) {
    1867                 snd_iprintf(buffer, "  clock mode: master\n");
     1869                snd_iprintf(buffer, "  sample clock source: internal\n");
    18681870        } else if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) {
    1869                 snd_iprintf(buffer, "  clock mode: slave (master anyway due to analog input setting)\n");
     1871                snd_iprintf(buffer, "  sample clock source: autosync (internal anyway due to analog input setting)\n");
    18701872        } else if (snd_rme96_capture_getrate(rme96, &n) < 0) {
    1871                 snd_iprintf(buffer, "  clock mode: slave (master anyway due to no valid signal)\n");
     1873                snd_iprintf(buffer, "  sample clock source: autosync (internal anyway due to no valid signal)\n");
    18721874        } else {
    1873                 snd_iprintf(buffer, "  clock mode: slave\n");
     1875                snd_iprintf(buffer, "  sample clock source: autosync\n");
    18741876        }
    18751877        if (rme96->wcreg & RME96_WCR_PRO) {
     
    21022104snd_rme96_info_clockmode_control(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
    21032105{
    2104         static char *texts[3] = { "Slave", "Master", "Wordclock" };
     2106        static char *texts[3] = { "AutoSync", "Internal", "Word" };
    21052107       
    21062108        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
     
    24252427{
    24262428        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
    2427         .name =         "Clock Mode",
     2429        .name =         "Sample Clock Source",
    24282430        .info =         snd_rme96_info_clockmode_control,
    24292431        .get =          snd_rme96_get_clockmode_control,
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c

    r246 r250  
    2323
    2424#include <sound/driver.h>
     25#include <linux/init.h>
    2526#include <linux/delay.h>
    2627#include <linux/interrupt.h>
     
    7677#define MULTIFACE_SS_CHANNELS    18
    7778#define MULTIFACE_DS_CHANNELS    14
     79#define H9652_DS_CHANNELS        26
     80#define H9652_SS_CHANNELS        14
    7881
    7982/* Write registers. These are defined as byte-offsets from the iobase value.
     
    8588#define HDSP_interruptConfirmation      96
    8689#define HDSP_outputEnable               128
    87 #define HDSP_jtagReg                    256
     90#define HDSP_control2Reg                256
    8891#define HDSP_midiDataOut0               352
    8992#define HDSP_midiDataOut1               356
     
    121124#define HDSP_IO_EXTENT     5192
    122125
    123 /* jtag register bits */
     126/* control2 register bits */
    124127
    125128#define HDSP_TMS                0x01
     
    134137#define HDSP_BIGENDIAN_MODE     0x200
    135138#define HDSP_RD_MULTIPLE        0x400
     139#define HDSP_9652_ENABLE_MIXER  0x800
    136140
    137141#define HDSP_S_PROGRAM          (HDSP_PROGRAM|HDSP_CONFIG_MODE_0)
     
    359363        struct tasklet_struct midi_tasklet;
    360364        int                   precise_ptr;
    361         u32                   control_register;          /* cached value */
     365        u32                   control_register;      /* cached value */
     366        u32                   control2_register;     /* cached value */
    362367        u32                   creg_spdif;
    363368        u32                   creg_spdif_stream;
    364         char                 *card_name;                    /* digiface/multiface */
     369        char                 *card_name;             /* digiface/multiface */
    365370        HDSP_IO_Type          io_type;               /* ditto, but for code use */
    366371        unsigned short        firmware_rev;
    367372        unsigned short        state;                 /* stores state bits */
    368373        u32                   firmware_cache[24413]; /* this helps recover from accidental iobox power failure */
    369         size_t                period_bytes;         /* guess what this is */
     374        size_t                period_bytes;          /* guess what this is */
    370375        unsigned char         ds_channels;
    371376        unsigned char         ss_channels;          /* different for multiface/digiface */
     
    434439
    435440#ifdef HDSP_PREALLOCATE_MEMORY
    436 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr);
    437 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr);
     441static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     442{
     443        struct snd_dma_device pdev;
     444        struct snd_dma_buffer dmbuf;
     445
     446        snd_dma_device_pci(&pdev, pci, capture);
     447        dmbuf.bytes = 0;
     448        if (! snd_dma_get_reserved(&pdev, &dmbuf)) {
     449                if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0)
     450                        return NULL;
     451                snd_dma_set_reserved(&pdev, &dmbuf);
     452        }
     453        *addrp = dmbuf.addr;
     454        return dmbuf.area;
     455}
     456
     457static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     458{
     459        struct snd_dma_device dev;
     460        snd_dma_device_pci(&dev, pci, capture);
     461        snd_dma_free_reserved(&dev);
     462}
     463
     464#else
     465static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     466{
     467        return snd_malloc_pci_pages(pci, size, addrp);
     468}
     469
     470static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     471{
     472        snd_free_pci_pages(pci, size, ptr, addr);
     473}
    438474#endif
    439475
     
    453489static int __devinit snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp);
    454490static int __devinit snd_hdsp_create_pcm(snd_card_t *card, hdsp_t *hdsp);
    455 static inline int snd_hdsp_initialize_input_enable (hdsp_t *hdsp);
     491static inline int snd_hdsp_enable_io (hdsp_t *hdsp);
    456492static inline void snd_hdsp_initialize_midi_flush (hdsp_t *hdsp);
    457493static inline void snd_hdsp_initialize_channels (hdsp_t *hdsp);
     
    461497static int snd_hdsp_set_defaults(hdsp_t *hdsp);
    462498
    463 static inline int hdsp_is_9652 (hdsp_t *hdsp)
    464 {
    465         switch (hdsp->firmware_rev) {
    466         case 0x64:
    467         case 0x65:
    468         case 0x68:
    469                 return 1;
    470         default:
    471                 return 0;
    472         }
    473 }
    474 
    475499static inline int hdsp_playback_to_output_key (hdsp_t *hdsp, int in, int out)
    476500{
     
    505529static inline int hdsp_check_for_iobox (hdsp_t *hdsp)
    506530{
     531
     532        if (hdsp->io_type == H9652) return 0;
    507533        if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) {
    508534                snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n");
     
    511537        }
    512538        return 0;
     539
    513540}
    514541
     
    522549                snd_printk ("loading firmware\n");
    523550
    524                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_PROGRAM);
     551                hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM);
    525552                hdsp_write (hdsp, HDSP_fifoData, 0);
    526553               
     
    530557                }
    531558               
    532                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_LOAD);
     559                hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
    533560               
    534561                for (i = 0; i < 24413; ++i) {
     
    545572                }
    546573
    547                 hdsp_write (hdsp, HDSP_jtagReg, 0);
     574#ifdef SNDRV_BIG_ENDIAN
     575                hdsp->control2_register = HDSP_BIGENDIAN_MODE;
     576#else
     577                hdsp->control2_register = 0;
     578#endif
     579                hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
    548580                snd_printk ("finished firmware loading\n");
    549581               
     
    575607        }
    576608
    577         if ((err = snd_hdsp_initialize_input_enable(hdsp)) < 0) {
     609        if ((err = snd_hdsp_enable_io(hdsp)) < 0) {
    578610                return err;
    579611        }
     
    581613        if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
    582614       
    583                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_PROGRAM);
     615                hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM);
    584616                hdsp_write (hdsp, HDSP_fifoData, 0);
    585617                if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) {
     
    587619                }
    588620
    589                 hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_LOAD);
     621                hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
    590622                hdsp_write (hdsp, HDSP_fifoData, 0);
    591623
    592624                if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT)) {
    593625                        hdsp->io_type = Multiface;
    594                         hdsp_write (hdsp, HDSP_jtagReg, HDSP_VERSION_BIT);
    595                         hdsp_write (hdsp, HDSP_jtagReg, HDSP_S_LOAD);
     626                        hdsp_write (hdsp, HDSP_control2Reg, HDSP_VERSION_BIT);
     627                        hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
    596628                        hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT);
    597629                } else {
     
    658690        unsigned int ad;
    659691
    660         if (hdsp_is_9652 (hdsp)) {
    661 
    662                 if ((ad = addr/2) < 676) {
    663 
    664                         /* from martin björnsen:
    665 
    666                            "You can only write dwords to the
    667                            mixer memory which contain two
    668                            mixer values in the low and high
    669                            word. So if you want to change
    670                            value 0 you have to read value 1
    671                            from the cache and write both to
    672                            the first dword in the mixer
    673                            memory."
    674                         */
    675 
    676                         hdsp->mixer_matrix[addr] = data;
    677                         hdsp_write (hdsp, 1024 + ad,
    678                                     (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) +
    679                                     hdsp->mixer_matrix[addr&0x7fe]);
    680                         return 0;
    681                 } else {
    682                         return -1;
    683                 }
     692        if (addr >= HDSP_MATRIX_MIXER_SIZE)
     693                return -1;
    684694               
     695        if (hdsp->io_type == H9652) {
     696
     697                /* from martin björnsen:
     698                   
     699                   "You can only write dwords to the
     700                   mixer memory which contain two
     701                   mixer values in the low and high
     702                   word. So if you want to change
     703                   value 0 you have to read value 1
     704                   from the cache and write both to
     705                   the first dword in the mixer
     706                   memory."
     707                */
     708
     709                hdsp->mixer_matrix[addr] = data;
     710
     711                /* `addr' addresses a 16-bit wide address, but
     712                   the address space accessed via hdsp_write
     713                   uses byte offsets. put another way, addr
     714                   varies from 0 to 1351, but to access the
     715                   corresponding memory location, we need
     716                   to access 0 to 2703 ...
     717                */
     718
     719                hdsp_write (hdsp, 4096 + (addr*2),
     720                            (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) +
     721                            hdsp->mixer_matrix[addr&0x7fe]);
     722               
     723                return 0;
    685724
    686725        } else {
    687                 if (addr >= HDSP_MATRIX_MIXER_SIZE)
    688                         return -1;
    689                
     726
    690727                ad = (addr << 16) + data;
    691728               
     
    830867        int rate_bits;
    831868
     869        /* ASSUMPTION: hdsp->lock is either help, or
     870           there is no need for it (e.g. during module
     871           initialization).
     872        */
     873       
    832874        if (!(hdsp->control_register & HDSP_ClockModeMaster)) {
    833875                if (called_internally) {
     
    861903           is to flag rate changes in the read/write routines.  */
    862904
    863         spin_lock_irq(&hdsp->lock);
    864 
    865905        switch (rate) {
    866906        case 32000:
     
    901941                break;
    902942        default:
    903                 spin_unlock_irq(&hdsp->lock);
    904943                return -EINVAL;
    905944        }
     
    909948                            hdsp->capture_pid,
    910949                            hdsp->playback_pid);
    911                 spin_unlock_irq(&hdsp->lock);
    912950                return -EBUSY;
    913951        }
     
    925963                        break;
    926964                case Digiface:
     965                case H9652:
    927966                        hdsp->channel_map = channel_map_df_ss;
    928967                        break;
     
    939978        }
    940979
    941         spin_unlock_irq(&hdsp->lock);
    942980        return 0;
    943981}
     
    11321170        hdsp_midi_t *hmidi;
    11331171        unsigned long flags;
     1172        u32 ie;
    11341173
    11351174        hmidi = (hdsp_midi_t *) substream->rmidi->private_data;
    11361175        hdsp = hmidi->hdsp;
     1176        ie = hmidi->id ? HDSP_Midi1InterruptEnable : HDSP_Midi0InterruptEnable;
    11371177        spin_lock_irqsave (&hdsp->lock, flags);
    11381178        if (up) {
    1139                 snd_hdsp_flush_midi_input (hdsp, hmidi->id);
    1140                 if (hmidi->id)
    1141                         hdsp->control_register |= HDSP_Midi1InterruptEnable;
    1142                 else
    1143                         hdsp->control_register |= HDSP_Midi0InterruptEnable;
     1179                if (!(hdsp->control_register & ie)) {
     1180                        snd_hdsp_flush_midi_input (hdsp, hmidi->id);
     1181                        hdsp->control_register |= ie;
     1182                }
    11441183        } else {
    1145                 if (hmidi->id)
    1146                         hdsp->control_register &= ~HDSP_Midi1InterruptEnable;
    1147                 else
    1148                         hdsp->control_register &= ~HDSP_Midi0InterruptEnable;
     1184                hdsp->control_register &= ~ie;
    11491185        }
    11501186
     
    20052041        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
    20062042        uinfo->count = 1;
    2007         uinfo->value.enumerated.items = (hdsp->io_type == Digiface) ? 6 : 4;
     2043
     2044        switch (hdsp->io_type) {
     2045        case Digiface:
     2046        case H9652:
     2047                uinfo->value.enumerated.items = 6;
     2048                break;
     2049        case Multiface:
     2050                uinfo->value.enumerated.items = 4;
     2051        default:
     2052                uinfo->value.enumerated.items = 0;
     2053                break;
     2054        }
     2055               
    20082056        if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
    20092057                uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
     
    20292077        if (!snd_hdsp_use_is_exclusive(hdsp))
    20302078                return -EBUSY;
    2031         max = (hdsp->io_type == Digiface) ? 6 : 4;
     2079
     2080        switch (hdsp->io_type) {
     2081        case Digiface:
     2082        case H9652:
     2083                max = 6;
     2084                break;
     2085        case Multiface:
     2086                max = 4;
     2087                break;
     2088        default:
     2089                return -EIO;
     2090        }
     2091
    20322092        val = ucontrol->value.enumerated.item[0] % max;
    20332093        spin_lock_irqsave(&hdsp->lock, flags);
     
    24972557
    24982558        offset = ucontrol->id.index - 1;
    2499         snd_assert(offset >= 0 || offset < ((hdsp->io_type == Digiface) ? 3 : 1), return -EINVAL);
     2559        snd_assert(offset >= 0);
     2560
     2561        switch (hdsp->io_type) {
     2562        case Digiface:
     2563        case H9652:
     2564                if (offset >= 3)
     2565                        return -EINVAL;
     2566                break;
     2567        case Multiface:
     2568                if (offset >= 1)
     2569                        return -EINVAL;
     2570                break;
     2571        default:
     2572                return -EIO;
     2573        }
     2574
    25002575        ucontrol->value.enumerated.item[0] = hdsp_adat_sync_check(hdsp, offset);
    25012576        return 0;
     
    25942669
    25952670        for (idx = 0; idx < HDSP_CONTROLS; idx++) {
    2596                 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0)
     2671                if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) {
    25972672                        return err;
     2673                }
    25982674                if (idx == 1)   /* IEC958 (S/PDIF) Stream */
    25992675                        hdsp->spdif_ctl = kctl;
     
    26032679        snd_hdsp_adat_sync_check.name = "ADAT Lock Status";
    26042680
    2605         if (hdsp->io_type == Digiface) {
     2681        switch (hdsp->io_type) {
     2682        case Digiface:
    26062683                limit = DIGIFACE_SS_CHANNELS;
    2607         } else {
     2684                break;
     2685        case H9652:
     2686                limit = H9652_SS_CHANNELS;
     2687                break;
     2688        case Multiface:
    26082689                limit = MULTIFACE_SS_CHANNELS;
     2690                break;
     2691        default:
     2692                return -EIO;
    26092693        }
    26102694       
     
    26282712                return err;
    26292713        }       
    2630         if (hdsp->io_type == Digiface) {
     2714        if (hdsp->io_type == Digiface || hdsp->io_type == H9652) {
    26312715                for (idx = 1; idx < 3; ++idx) {
    26322716                        snd_hdsp_adat_sync_check.index = idx+1;
     
    26822766                    hdsp->irq, hdsp->port, hdsp->iobase);
    26832767        snd_iprintf(buffer, "Control register: 0x%x\n", hdsp->control_register);
     2768        snd_iprintf(buffer, "Control2 register: 0x%x\n", hdsp->control2_register);
    26842769        snd_iprintf(buffer, "Status register: 0x%x\n", status);
    26852770        snd_iprintf(buffer, "Status2 register: 0x%x\n", status2);
     
    28552940        switch (hdsp->io_type) {
    28562941        case Digiface:
     2942        case H9652:
    28572943                x = status & HDSP_Sync1;
    28582944                if (status & HDSP_Lock1) {
     
    29143000{
    29153001        if (hdsp->capture_buffer_unaligned) {
    2916 #ifndef HDSP_PREALLOCATE_MEMORY
    2917                 snd_free_pci_pages(hdsp->pci,
    2918                                    HDSP_DMA_AREA_BYTES,
    2919                                    hdsp->capture_buffer_unaligned,
    2920                                    hdsp->capture_buffer_addr);
    2921 #else
    2922                 snd_hammerfall_free_buffer(hdsp->pci, hdsp->capture_buffer_unaligned);
    2923 #endif
     3002                snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES,
     3003                                           hdsp->capture_buffer_unaligned,
     3004                                           hdsp->capture_buffer_addr, 1);
    29243005        }
    29253006
    29263007        if (hdsp->playback_buffer_unaligned) {
    2927 #ifndef HDSP_PREALLOCATE_MEMORY
    2928                 snd_free_pci_pages(hdsp->pci,
    2929                                    HDSP_DMA_AREA_BYTES,
    2930                                    hdsp->playback_buffer_unaligned,
    2931                                    hdsp->playback_buffer_addr);
    2932 #else
    2933                 snd_hammerfall_free_buffer(hdsp->pci, hdsp->playback_buffer_unaligned);
    2934 #endif
     3008                snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES,
     3009                                           hdsp->playback_buffer_unaligned,
     3010                                           hdsp->playback_buffer_addr, 0);
    29353011        }
    29363012}
     
    29423018        unsigned long pb_bus, cb_bus;
    29433019
    2944 #ifndef HDSP_PREALLOCATE_MEMORY
    2945         cb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr);
    2946         pb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr);
    2947 #else
    2948         cb = snd_hammerfall_get_buffer(hdsp->pci, &cb_addr);
    2949         pb = snd_hammerfall_get_buffer(hdsp->pci, &pb_addr);
    2950 #endif
     3020        cb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr, 1);
     3021        pb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr, 0);
    29513022
    29523023        if (cb == 0 || pb == 0) {
    29533024                if (cb) {
    2954 #ifdef HDSP_PREALLOCATE_MEMORY
    2955                         snd_hammerfall_free_buffer(hdsp->pci, cb);
    2956 #else
    2957                         snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr);
    2958 #endif
     3025                        snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr, 1);
    29593026                }
    29603027                if (pb) {
    2961 #ifdef HDSP_PREALLOCATE_MEMORY
    2962                         snd_hammerfall_free_buffer(hdsp->pci, pb);
    2963 #else
    2964                         snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr);
    2965 #endif
     3028                        snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr, 0);
    29663029                }
    29673030
     
    30263089        }
    30273090
    3028         for (i = 0; i < (hdsp_is_9652(hdsp) ? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) {
     3091        for (i = 0; i < (hdsp->io_type == H9652 ? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) {
    30293092                if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) {
    30303093                        return -EIO;
     
    30323095        }
    30333096       
    3034         if (!hdsp_is_9652(hdsp) && line_outs_monitor[hdsp->dev]) {
     3097        if ((hdsp->io_type != H9652) && line_outs_monitor[hdsp->dev]) {
    30353098               
    30363099                snd_printk ("sending all inputs and playback streams to line outs.\n");
     
    32923355         */
    32933356
     3357        spin_lock_irq(&hdsp->lock);
    32943358        if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) {
     3359                spin_unlock_irq(&hdsp->lock);
    32953360                _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE);
    32963361                return err;
     3362        } else {
     3363                spin_unlock_irq(&hdsp->lock);
    32973364        }
    32983365
     
    37843851                break;
    37853852        case SNDRV_HDSP_IOCTL_GET_VERSION:
    3786                 if (hdsp_is_9652(hdsp)) return -EINVAL;
     3853                if (hdsp->io_type == H9652) return -EINVAL;
    37873854                if (hdsp->io_type == Undefined) {
    37883855                        if ((err = hdsp_get_iobox_version(hdsp)) < 0) {
     
    37973864                break;
    37983865        case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE:
    3799                 if (hdsp_is_9652(hdsp)) return -EINVAL;
     3866                if (hdsp->io_type == H9652) return -EINVAL;
    38003867                /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */
    38013868                if (hdsp->io_type == Undefined) return -EINVAL;
     
    39053972}
    39063973
    3907 static inline int snd_hdsp_initialize_input_enable (hdsp_t *hdsp)
     3974static inline void snd_hdsp_9652_enable_mixer (hdsp_t *hdsp)
     3975{
     3976        hdsp->control2_register |= HDSP_9652_ENABLE_MIXER;
     3977        hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
     3978}
     3979
     3980static inline void snd_hdsp_9652_disable_mixer (hdsp_t *hdsp)
     3981{
     3982        hdsp->control2_register &= ~HDSP_9652_ENABLE_MIXER;
     3983        hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
     3984}
     3985
     3986static inline int snd_hdsp_enable_io (hdsp_t *hdsp)
    39083987{
    39093988        int i;
     
    39234002static inline void snd_hdsp_initialize_channels(hdsp_t *hdsp)
    39244003{
    3925         if (hdsp->io_type == Digiface) {
     4004        switch (hdsp->io_type) {
     4005        case Digiface:
    39264006                hdsp->card_name = "RME Hammerfall DSP + Digiface";
    39274007                hdsp->ss_channels = DIGIFACE_SS_CHANNELS;
    39284008                hdsp->ds_channels = DIGIFACE_DS_CHANNELS;
    3929         } else {
     4009                break;
     4010
     4011        case H9652:
     4012                hdsp->card_name = "RME Hammerfall HDSP 9652";
     4013                hdsp->ss_channels = H9652_SS_CHANNELS;
     4014                hdsp->ds_channels = H9652_DS_CHANNELS;
     4015                break;
     4016
     4017        case Multiface:
    39304018                hdsp->card_name = "RME Hammerfall DSP + Multiface";
    39314019                hdsp->ss_channels = MULTIFACE_SS_CHANNELS;
    39324020                hdsp->ds_channels = MULTIFACE_DS_CHANNELS;
     4021
     4022        default:
     4023                /* should never get here */
     4024                break;
    39334025        }
    39344026}
     
    39384030        snd_hdsp_flush_midi_input (hdsp, 0);
    39394031        snd_hdsp_flush_midi_input (hdsp, 1);
    3940 
    3941 #ifdef SNDRV_BIG_ENDIAN
    3942         hdsp_write(hdsp, HDSP_jtagReg, HDSP_BIGENDIAN_MODE);
    3943 #endif
    39444032}
    39454033
     
    40024090        int err;
    40034091        int i;
     4092        int is_9652 = 0;
    40044093
    40054094        hdsp->irq = -1;
     
    40284117        strcpy(card->driver, "H-DSP");
    40294118        strcpy(card->mixername, "Xilinx FPGA");
    4030        
     4119
    40314120        switch (hdsp->firmware_rev & 0xff) {
    40324121        case 0xa:
     
    40344123                hdsp->card_name = "RME Hammerfall DSP";
    40354124                break;
     4125
    40364126        case 0x64:
    40374127        case 0x65:
    40384128        case 0x68:
    40394129                hdsp->card_name = "RME HDSP 9652";
    4040                 break;
     4130                is_9652 = 1;
     4131                break;
     4132
    40414133        default:
    40424134                return -ENODEV;
    40434135        }
    40444136
    4045         if ((err = pci_enable_device(pci)) < 0)
     4137        if ((err = pci_enable_device(pci)) < 0) {
    40464138                return err;
     4139        }
    40474140
    40484141        pci_set_master(hdsp->pci);
     
    40724165        }
    40734166       
    4074         if (hdsp_is_9652(hdsp)) {
    4075                
    4076                 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) {
    4077                         return err;
    4078                 }
    4079 
    4080                 hdsp->io_type = Digiface;               
    4081        
    4082                 hdsp->ss_channels = DIGIFACE_SS_CHANNELS;
    4083                 hdsp->ds_channels = DIGIFACE_DS_CHANNELS;
    4084        
    4085                 snd_hdsp_initialize_midi_flush(hdsp);
    4086        
     4167        if (!is_9652 && hdsp_check_for_iobox (hdsp)) {
     4168                /* no iobox connected, we defer initialization */
     4169                snd_printk("card initialization pending : waiting for firmware\n");
    40874170                if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    40884171                        return err;
    40894172                }
    4090 
    4091         } else {
    4092        
    4093                 if (hdsp_check_for_iobox (hdsp)) {
    4094                         /* no iobox connected, we defer initialization */
    4095                         snd_printk("card initialization pending : waiting for firmware\n");
    4096                         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    4097                                 return err;
    4098                         }
    4099                         return 0;
    4100                 }
    4101 
    4102                 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) {
    4103                         return err;
    4104                 }
    4105                
    4106                 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
    4107                         snd_printk("card initialization pending : waiting for firmware\n");
    4108                         if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    4109                                 return err;
    4110                         }
    41114173                return 0;
    4112                 }
    4113                
    4114                 snd_printk("Firmware already loaded, initializing card.\n");
    4115 
    4116                 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) {
    4117                         hdsp->io_type = Multiface;
    4118                 } else {
    4119                         hdsp->io_type = Digiface;
    4120                 }
    4121                
     4174        }
     4175       
     4176        if ((err = snd_hdsp_enable_io(hdsp)) != 0) {
     4177                return err;
     4178        }
     4179       
     4180        if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
     4181                snd_printk("card initialization pending : waiting for firmware\n");
    41224182                if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
    41234183                        return err;
    41244184                }
    4125                
    4126                 snd_hdsp_initialize_channels(hdsp);
    4127                
    4128                 snd_hdsp_initialize_midi_flush(hdsp);
    4129                
    4130         }
    4131        
     4185                return 0;
     4186        }
     4187       
     4188        snd_printk("Firmware already loaded, initializing card.\n");
     4189       
     4190        if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) {
     4191                hdsp->io_type = Multiface;
     4192        } else {
     4193                hdsp->io_type = Digiface;
     4194        }
     4195
     4196        if (is_9652) {
     4197                hdsp->io_type = H9652;
     4198                snd_hdsp_9652_enable_mixer (hdsp);
     4199        }
     4200
     4201        if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {
     4202                return err;
     4203        }
     4204       
     4205        snd_hdsp_initialize_channels(hdsp);
     4206        snd_hdsp_initialize_midi_flush(hdsp);
     4207
    41324208        hdsp->state |= HDSP_FirmwareLoaded;     
    4133        
     4209
    41344210        if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) {
    41354211                return err;
    41364212        }
    4137        
     4213
    41384214        return 0;       
    41394215}
     
    42024278        sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
    42034279                hdsp->port, hdsp->irq);
    4204        
     4280
    42054281        if ((err = snd_card_register(card)) < 0) {
    42064282                snd_card_free(card);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/makefile.os2

    r207 r250  
    1313#
    1414#===================================================================
    15 FILE1    = hammerfall_mem.obj rme9652.obj hdsp.obj
     15FILE1    = rme9652.obj hdsp.obj
    1616FILE2    =
    1717FILE3    =
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c

    r246 r250  
    310310
    311311#ifdef RME9652_PREALLOCATE_MEMORY
    312 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr);
    313 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr);
     312static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     313{
     314        struct snd_dma_device pdev;
     315        struct snd_dma_buffer dmbuf;
     316
     317        snd_dma_device_pci(&pdev, pci, capture);
     318        dmbuf.bytes = 0;
     319        if (! snd_dma_get_reserved(&pdev, &dmbuf)) {
     320                if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0)
     321                        return NULL;
     322                snd_dma_set_reserved(&pdev, &dmbuf);
     323        }
     324        *addrp = dmbuf.addr;
     325        return dmbuf.area;
     326}
     327
     328static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     329{
     330        struct snd_dma_device dev;
     331        snd_dma_device_pci(&dev, pci, capture);
     332        snd_dma_free_reserved(&dev);
     333}
     334
     335#else
     336static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
     337{
     338        return snd_malloc_pci_pages(pci, size, addrp);
     339}
     340
     341static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture)
     342{
     343        snd_free_pci_pages(pci, size, ptr, addr);
     344}
    314345#endif
     346
    315347
    316348static struct pci_device_id snd_rme9652_ids[] __devinitdata = {
     
    18101842{
    18111843        if (rme9652->capture_buffer_unaligned) {
    1812 #ifndef RME9652_PREALLOCATE_MEMORY
    1813                 snd_free_pci_pages(rme9652->pci,
    1814                                    RME9652_DMA_AREA_BYTES,
    1815                                    rme9652->capture_buffer_unaligned,
    1816                                    rme9652->capture_buffer_addr);
    1817 #else
    1818                 snd_hammerfall_free_buffer(rme9652->pci, rme9652->capture_buffer_unaligned);
    1819 #endif
     1844                snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES,
     1845                                           rme9652->capture_buffer_unaligned,
     1846                                           rme9652->capture_buffer_addr, 1);
    18201847        }
    18211848
    18221849        if (rme9652->playback_buffer_unaligned) {
    1823 #ifndef RME9652_PREALLOCATE_MEMORY
    1824                 snd_free_pci_pages(rme9652->pci,
    1825                                    RME9652_DMA_AREA_BYTES,
    1826                                    rme9652->playback_buffer_unaligned,
    1827                                    rme9652->playback_buffer_addr);
    1828 #else
    1829                 snd_hammerfall_free_buffer(rme9652->pci, rme9652->playback_buffer_unaligned);
    1830 #endif
     1850                snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES,
     1851                                           rme9652->playback_buffer_unaligned,
     1852                                           rme9652->playback_buffer_addr, 0);
    18311853        }
    18321854}
     
    18551877        unsigned long pb_bus, cb_bus;
    18561878
    1857 #ifndef RME9652_PREALLOCATE_MEMORY
    1858         cb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr);
    1859         pb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr);
    1860 #else
    1861         cb = snd_hammerfall_get_buffer(rme9652->pci, &cb_addr);
    1862         pb = snd_hammerfall_get_buffer(rme9652->pci, &pb_addr);
    1863 #endif
     1879        cb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr, 1);
     1880        pb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr, 0);
    18641881
    18651882        if (cb == 0 || pb == 0) {
    18661883                if (cb) {
    1867 #ifdef RME9652_PREALLOCATE_MEMORY
    1868                         snd_hammerfall_free_buffer(rme9652->pci, cb);
    1869 #else
    1870                         snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr);
    1871 #endif
     1884                        snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr, 1);
    18721885                }
    18731886                if (pb) {
    1874 #ifdef RME9652_PREALLOCATE_MEMORY
    1875                         snd_hammerfall_free_buffer(rme9652->pci, pb);
    1876 #else
    1877                         snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr);
    1878 #endif
     1887                        snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr, 0);
    18791888                }
    18801889
  • GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c

    r246 r250  
    260260        snd_kcontrol_t *master_volume;
    261261
    262 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
     262#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    263263        struct gameport gameport;
    264264#endif
     
    11941194static int snd_sonicvibes_free(sonicvibes_t *sonic)
    11951195{
    1196 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
     1196#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    11971197        if (sonic->gameport.io)
    11981198                gameport_unregister_port(&sonic->gameport);
     
    14981498                return err;
    14991499        }
    1500 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
     1500#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
    15011501        sonic->gameport.io = sonic->game_port;
    15021502        gameport_register_port(&sonic->gameport);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ymfpci/ymfpci_main.c

    r246 r250  
    23162316    init_waitqueue_head(&chip->interrupt_sleep);
    23172317    atomic_set(&chip->interrupt_sleep_count, 0);
     2318#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
     2319        init_MUTEX(&chip->joystick_mutex);
     2320#endif
    23182321    chip->card = card;
    23192322    chip->pci = pci;
Note: See TracChangeset for help on using the changeset viewer.