Changeset 300


Ignore:
Timestamp:
Feb 24, 2008, 8:18:08 PM (17 years ago)
Author:
Brendan Oakley
Message:

Merged to ALSA 1.0.3

Location:
GPL/branches/alsa-resync1/alsa-kernel
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/alsa-resync1/alsa-kernel/core/info.c

    r260 r300  
    105105        return 0;
    106106    va_start(args, fmt);
    107         res = vsnprintf(sbuffer, sizeof(sbuffer), fmt, args);
     107        res = vscnprintf(sbuffer, sizeof(sbuffer), fmt, args);
    108108    va_end(args);
    109109    if (buffer->size + res >= buffer->len) {
  • GPL/branches/alsa-resync1/alsa-kernel/core/misc.c

    r299 r300  
    4646}
    4747
     48#ifdef CONFIG_SND_VERBOSE_PRINTK
     49void snd_verbose_printk(const char *file, int line, const char *format, ...)
     50{
     51        va_list args;
     52        char tmpbuf[512];
     53       
     54        if (format[0] == '<' && format[1] >= '0' && format[1] <= '9' && format[2] == '>') {
     55                char tmp[] = "<0>";
     56                tmp[1] = format[1];
     57                printk("%sALSA %s:%d: ", tmp, file, line);
     58                format += 3;
     59        } else {
     60                printk("ALSA %s:%d: ", file, line);
     61        }
     62        va_start(args, format);
     63        vsnprintf(tmpbuf, sizeof(tmpbuf), format, args);
     64        va_end(args);
     65        printk(tmpbuf);
     66}
     67#endif
     68
     69#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK)
     70void snd_verbose_printd(const char *file, int line, const char *format, ...)
     71{
     72        va_list args;
     73        char tmpbuf[512];
     74       
     75        if (format[0] == '<' && format[1] >= '0' && format[1] <= '9' && format[2] == '>') {
     76                char tmp[] = "<0>";
     77                tmp[1] = format[1];
     78                printk("%sALSA %s:%d: ", tmp, file, line);
     79                format += 3;
     80        } else {
     81                printk(KERN_DEBUG "ALSA %s:%d: ", file, line);
     82        }
     83        va_start(args, format);
     84        vsnprintf(tmpbuf, sizeof(tmpbuf), format, args);
     85        va_end(args);
     86        printk(tmpbuf);
     87
     88}
     89#endif
     90
    4891/**
    4992 * snd_pci_quirk_lookup - look up a PCI SSID quirk list
  • GPL/branches/alsa-resync1/alsa-kernel/core/pcm.c

    r92 r300  
    329329        snd_iprintf(buffer, "OSS period bytes: %lu\n", (unsigned long)runtime->oss.period_bytes);
    330330        snd_iprintf(buffer, "OSS periods: %u\n", runtime->oss.periods);
     331                snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames);
    331332    }
    332333#endif
  • GPL/branches/alsa-resync1/alsa-kernel/core/rawmidi.c

    r262 r300  
    928928            memcpy(buf + result, runtime->buffer + runtime->appl_ptr, count1);
    929929        } else {
    930             if (copy_to_user(buf + result, runtime->buffer + runtime->appl_ptr, count1)) {
    931930                spin_unlock_irqrestore(&runtime->lock, flags);
     931                        if (copy_to_user(buf + result, runtime->buffer + runtime->appl_ptr, count1)) {
    932932                return result > 0 ? result : -EFAULT;
    933933            }
     934                        spin_lock_irqsave(&runtime->lock, flags);
    934935        }
    935936        runtime->appl_ptr += count1;
     
    11551156            memcpy(runtime->buffer + runtime->appl_ptr, buf, count1);
    11561157        } else {
     1158                        spin_unlock_irqrestore(&runtime->lock, flags);
    11571159            if (copy_from_user(runtime->buffer + runtime->appl_ptr, buf, count1)) {
     1160                                spin_lock_irqsave(&runtime->lock, flags);
    11581161                result = result > 0 ? result : -EFAULT;
    11591162                goto __end;
    11601163            }
     1164                        spin_lock_irqsave(&runtime->lock, flags);
    11611165        }
    11621166        runtime->appl_ptr += count1;
  • GPL/branches/alsa-resync1/alsa-kernel/core/seq/seq_clientmgr.c

    r278 r300  
    567567
    568568/*
     569 * expand a quoted event.
     570 */
     571static int expand_quoted_event(snd_seq_event_t *event)
     572{
     573        snd_seq_event_t *quoted;
     574
     575        quoted = event->data.quote.event;
     576        if (quoted == NULL) {
     577                snd_printd("seq: quoted event is NULL\n");
     578                return -EINVAL;
     579        }
     580
     581        event->type = quoted->type;
     582        event->tag = quoted->tag;
     583        event->source = quoted->source;
     584        /* don't use quoted destination */
     585        event->data = quoted->data;
     586        /* use quoted timestamp only if subscription/port didn't update it */
     587        if (event->queue == SNDRV_SEQ_QUEUE_DIRECT) {
     588                event->flags = quoted->flags;
     589                event->queue = quoted->queue;
     590                event->time = quoted->time;
     591        } else {
     592                event->flags = (event->flags & SNDRV_SEQ_TIME_STAMP_MASK)
     593                        | (quoted->flags & ~SNDRV_SEQ_TIME_STAMP_MASK);
     594        }
     595        return 0;
     596}
     597
     598/*
    569599 * deliver an event to the specified destination.
    570600 * if filter is non-zero, client filter bitmap is tested.
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h

    r299 r300  
    195195#define vsnprintf(buf,size,fmt,args) snd_compat_vsnprintf(buf,size,fmt,args)
    196196#endif
     197
     198#ifndef TARGET_OS2
     199#ifndef CONFIG_HAVE_SCNPRINTF
     200#define scnprintf(buf,size,fmt,args...) snprintf(buf,size,fmt,##args)
     201#define vscnprintf(buf,size,fmt,args) vsnprintf(buf,size,fmt,args)
     202#endif
     203#endif /* !TARGET_OS2 */
    197204
    198205#if defined(__alpha__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 14)
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/pcm_oss.h

    r281 r300  
    5151        unsigned int subdivision;               /* requested subdivision */
    5252        size_t period_bytes;                    /* requested period size */
     53        size_t period_frames;                   /* period frames for poll */
    5354        size_t period_ptr;                      /* actual write pointer to period */
    5455        unsigned int periods;
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/version.h

    r290 r300  
    11/* include/version.h.  Generated by configure.  */
    2 #define CONFIG_SND_VERSION "1.0.2"
     2#define CONFIG_SND_VERSION "1.0.3"
    33#define CONFIG_SND_DATE ""
  • GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c

    r290 r300  
    148148        }
    149149
    150         if (xmpu_irq >= 0) {
     150        if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) {
    151151                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
    152152                                               chip->mpu_port, 0,
  • GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c

    r290 r300  
    164164        /* Panasonic PCA761AW Audio Card */
    165165        { .id = "ADV55ff", .devs = { { .id = "ADV0010" } } },
     166        /* InterWave STB without TEA6330T */
     167        { .id = "ADV550a", .devs = { { .id = "ADV0010" } } },
    166168#else
    167169        /* InterWave STB with TEA6330T */
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ac97/ac97_pcm.c

    r77 r300  
    230230                }
    231231                ac97->spdif_status = sbits;
     232                /* update the internal spdif bits */
     233                spin_lock(&ac97->reg_lock);
     234                sbits = ac97->spdif_status;
     235                if (sbits & IEC958_AES0_PROFESSIONAL) {
     236                        sbits &= ~IEC958_AES0_PRO_FS;
     237                        switch (rate) {
     238                        case 44100: sbits |= IEC958_AES0_PRO_FS_44100; break;
     239                        case 48000: sbits |= IEC958_AES0_PRO_FS_48000; break;
     240                        case 32000: sbits |= IEC958_AES0_PRO_FS_32000; break;
     241                        }
     242                } else {
     243                        sbits &= ~(IEC958_AES3_CON_FS << 24);
     244                        switch (rate) {
     245                        case 44100: sbits |= IEC958_AES3_CON_FS_44100<<24; break;
     246                        case 48000: sbits |= IEC958_AES3_CON_FS_48000<<24; break;
     247                        case 32000: sbits |= IEC958_AES3_CON_FS_32000<<24; break;
     248                        }
     249                }
     250                ac97->spdif_status = sbits;
     251                spin_unlock(&ac97->reg_lock);
    232252        }
    233253        snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/als4000.c

    r290 r300  
    100100MODULE_PARM_DESC(enable, "Enable ALS4000 soundcard.");
    101101MODULE_PARM_SYNTAX(enable, SNDRV_INDEX_DESC);
     102#ifdef SUPPORT_JOYSTICK
    102103MODULE_PARM(joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
    103104MODULE_PARM_DESC(joystick_port, "Joystick port address for ALS4000 soundcard. (0 = disabled)");
    104105MODULE_PARM_SYNTAX(joystick_port, SNDRV_ENABLED);
     106#endif
    105107
    106108typedef struct {
  • GPL/branches/alsa-resync1/alsa-kernel/pci/cmipci.c

    r290 r300  
    29842984        if (joystick_port[dev] > 0) {
    29852985                if (joystick_port[dev] == 1) { /* auto-detect */
    2986                         static int ports[] = { 0x200, 0x201, 0 };
     2986                        static int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */
    29872987                        int i;
    29882988                        for (i = 0; ports[i]; i++) {
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/aureon.h

    r250 r300  
    3434
    3535/* GPIO bits */
    36 #define AUREON_CS8415_CS        (1 << 23)
    37 #define AUREON_CS8415_CDTO      (1 << 22)
     36#define AUREON_CS8415_CS        (1 << 22)
     37#define AUREON_CS8415_CDTO      (1 << 21)
    3838#define AUREON_WM_RESET         (1 << 20)
    3939#define AUREON_WM_CLK           (1 << 19)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/delta.c

    r281 r300  
    33 *
    44 *   Lowlevel functions for M-Audio Delta 1010, 44, 66, Dio2496, Audiophile
     5 *                          Digigram VX442
    56 *
    67 *      Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>
     
    8485        unsigned char tmp;
    8586        tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
    86         if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010LT) {
     87        switch (ice->eeprom.subvendor) {
     88        case ICE1712_SUBDEVICE_DELTA1010LT:
    8789                tmp &= ~ICE1712_DELTA_1010LT_CS;
    8890                tmp |= ICE1712_DELTA_1010LT_CCLK | ICE1712_DELTA_1010LT_CS_CS8427;
    89         } else { /* Audiophile */
     91                break;
     92        case ICE1712_SUBDEVICE_AUDIOPHILE:
    9093                tmp |= ICE1712_DELTA_AP_CCLK | ICE1712_DELTA_AP_CS_CODEC;
    9194                tmp &= ~ICE1712_DELTA_AP_CS_DIGITAL;
     95                break;
     96        case ICE1712_SUBDEVICE_VX442:
     97                tmp |= ICE1712_VX442_CCLK | ICE1712_VX442_CODEC_CHIP_A | ICE1712_VX442_CODEC_CHIP_B;
     98                tmp &= ~ICE1712_VX442_CS_DIGITAL;
     99                break;
    92100        }
    93101        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
     
    99107static void ap_cs8427_codec_deassert(ice1712_t *ice, unsigned char tmp)
    100108{
    101         if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010LT) {
     109        switch (ice->eeprom.subvendor) {
     110        case ICE1712_SUBDEVICE_DELTA1010LT:
    102111                tmp &= ~ICE1712_DELTA_1010LT_CS;
    103112                tmp |= ICE1712_DELTA_1010LT_CS_NONE;
    104         } else { /* Audiophile */
     113                break;
     114        case ICE1712_SUBDEVICE_AUDIOPHILE:
    105115                tmp |= ICE1712_DELTA_AP_CS_DIGITAL;
     116                break;
     117        case ICE1712_SUBDEVICE_VX442:
     118                tmp |= ICE1712_VX442_CS_DIGITAL;
     119                break;
    106120        }
    107121        snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
     
    258272
    259273/*
     274 * AK4528 on VX442 to choose the chip mask
     275 */
     276static void vx442_ak4524_lock(akm4xxx_t *ak, int chip)
     277{
     278        struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
     279        ice1712_t *ice = ak->private_data[0];
     280
     281        snd_ice1712_save_gpio_status(ice);
     282        priv->cs_mask =
     283        priv->cs_addr = chip == 0 ? ICE1712_VX442_CODEC_CHIP_A :
     284                                    ICE1712_VX442_CODEC_CHIP_B;
     285}
     286
     287/*
    260288 * change the DFS bit according rate for Delta1010
    261289 */
     
    307335        up(&ice->gpio_mutex);
    308336        snd_akm4xxx_reset(ak, 0);
     337}
     338
     339/*
     340 * change the rate of AK4524 on VX442
     341 */
     342static void vx442_ak4524_set_rate_val(akm4xxx_t *ak, unsigned int rate)
     343{
     344        unsigned char val;
     345
     346        val = (rate > 48000) ? 0x65 : 0x60;
     347        if (snd_akm4xxx_get(ak, 0, 0x02) != val ||
     348            snd_akm4xxx_get(ak, 1, 0x02) != val) {
     349                snd_akm4xxx_reset(ak, 1);
     350                snd_akm4xxx_write(ak, 0, 0x02, val);
     351                snd_akm4xxx_write(ak, 1, 0x02, val);
     352                snd_akm4xxx_reset(ak, 0);
     353        }
    309354}
    310355
     
    436481};
    437482
     483static akm4xxx_t akm_vx442 __devinitdata = {
     484        .type = SND_AK4524,
     485        .num_adcs = 4,
     486        .num_dacs = 4,
     487        .ops = {
     488                .lock = vx442_ak4524_lock,
     489                .set_rate_val = vx442_ak4524_set_rate_val
     490        }
     491};
     492
     493static struct snd_ak4xxx_private akm_vx442_priv __devinitdata = {
     494        .caddr = 2,
     495        .cif = 0,
     496        .data_mask = ICE1712_VX442_DOUT,
     497        .clk_mask = ICE1712_VX442_CCLK,
     498        .cs_mask = 0,
     499        .cs_addr = 0, /* set later */
     500        .cs_none = 0,
     501        .add_flags = 0,
     502        .mask_flags = 0,
     503};
     504
    438505static int __devinit snd_ice1712_delta_init(ice1712_t *ice)
    439506{
     
    457524                ice->num_total_dacs = 8;
    458525                break;
     526        case ICE1712_SUBDEVICE_VX442:
     527                ice->num_total_dacs = 4;
     528                break;
    459529        }
    460530
     
    464534        case ICE1712_SUBDEVICE_DELTA410:
    465535        case ICE1712_SUBDEVICE_DELTA1010LT:
     536        case ICE1712_SUBDEVICE_VX442:
    466537                if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
    467538                        snd_printk("unable to create I2C bus\n");
     
    518589                err = snd_ice1712_akm4xxx_init(ak, &akm_delta44, &akm_delta44_priv, ice);
    519590                break;
     591        case ICE1712_SUBDEVICE_VX442:
     592                err = snd_ice1712_akm4xxx_init(ak, &akm_vx442, &akm_vx442_priv, ice);
     593                break;
    520594        default:
    521595                snd_BUG();
     
    598672        case ICE1712_SUBDEVICE_DELTA44:
    599673        case ICE1712_SUBDEVICE_DELTA66:
     674        case ICE1712_SUBDEVICE_VX442:
    600675                err = snd_ice1712_akm4xxx_build_controls(ice);
    601676                if (err < 0)
     
    603678                break;
    604679        }
     680
    605681        return 0;
    606682}
     
    654730                snd_ice1712_delta_add_controls,
    655731        },
     732        {
     733                ICE1712_SUBDEVICE_VX442,
     734                "Digigram VX442",
     735                snd_ice1712_delta_init,
     736                snd_ice1712_delta_add_controls,
     737                1, /* NO MPU */
     738        },
    656739        { } /* terminator */
    657740};
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/delta.h

    r215 r300  
    66 *
    77 *   Lowlevel functions for M-Audio Delta 1010, 44, 66, Dio2496, Audiophile
     8 *                          Digigram VX442
    89 *
    910 *      Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>
     
    3132                "{MidiMan M Audio,Delta 66},"\
    3233                "{MidiMan M Audio,Delta 44},"\
    33                 "{MidiMan M Audio,Audiophile 24/96},"
     34                "{MidiMan M Audio,Audiophile 24/96},"\
     35                "{Digigram,VX442},"
    3436
    3537#define ICE1712_SUBDEVICE_DELTA1010     0x121430d6
     
    4042#define ICE1712_SUBDEVICE_DELTA410      0x121438d6
    4143#define ICE1712_SUBDEVICE_DELTA1010LT   0x12143bd6
     44#define ICE1712_SUBDEVICE_VX442         0x12143cd6
    4245
    4346/* entry point */
     
    135138#define ICE1712_DELTA_1010LT_WORDCLOCK 0x80     /* sample clock source: 0 = Word Clock Input, 1 = S/PDIF Input ??? */
    136139
     140/* Digigram VX442 definitions */
     141#define ICE1712_VX442_CCLK              0x02    /* SPI clock */
     142#define ICE1712_VX442_DIN               0x04    /* data input */
     143#define ICE1712_VX442_DOUT              0x08    /* data output */
     144#define ICE1712_VX442_CS_DIGITAL        0x10    /* chip select, low = CS8427 */
     145#define ICE1712_VX442_CODEC_CHIP_A      0x20    /* select chip A */
     146#define ICE1712_VX442_CODEC_CHIP_B      0x40    /* select chip B */
     147
    137148#endif /* __SOUND_DELTA_H */
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c

    r290 r300  
    23762376        spin_lock_init(&ice->reg_lock);
    23772377        init_MUTEX(&ice->gpio_mutex);
     2378        init_MUTEX(&ice->open_mutex);
    23782379        ice->gpio.set_mask = snd_ice1712_set_gpio_mask;
    23792380        ice->gpio.set_dir = snd_ice1712_set_gpio_dir;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h

    r281 r300  
    336336        unsigned int cur_rate;          /* current rate */
    337337
     338        struct semaphore open_mutex;
     339        snd_pcm_substream_t *pcm_reserved[4];
     340
    338341        unsigned int akm_codecs;
    339342        akm4xxx_t *akm;
  • GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1724.c

    r290 r300  
    238238                                        snd_pcm_period_elapsed(ice->capture_pro_substream);
    239239                        }
     240                        if (mtstat & VT1724_MULTI_PDMA1) {
     241                                if (ice->playback_con_substream_ds[0])
     242                                        snd_pcm_period_elapsed(ice->playback_con_substream_ds[0]);
     243                        }
     244                        if (mtstat & VT1724_MULTI_PDMA2) {
     245                                if (ice->playback_con_substream_ds[1])
     246                                        snd_pcm_period_elapsed(ice->playback_con_substream_ds[1]);
     247                        }
     248                        if (mtstat & VT1724_MULTI_PDMA3) {
     249                                if (ice->playback_con_substream_ds[2])
     250                                        snd_pcm_period_elapsed(ice->playback_con_substream_ds[2]);
     251                        }
    240252                        if (mtstat & VT1724_MULTI_PDMA4) {
    241253                                if (ice->playback_con_substream)
     
    283295};
    284296
    285 static unsigned int hw_channels[] = {
    286         2, 4, 6, 8
    287 };
    288 
    289 static snd_pcm_hw_constraint_list_t hw_constraints_channels = {
    290         .count = ARRAY_SIZE(hw_channels),
    291         .list = hw_channels,
    292         .mask = 0,
    293 };
    294 
    295297static int snd_vt1724_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
    296298{
    297299        ice1712_t *ice = snd_pcm_substream_chip(substream);
    298         unsigned int what;
    299         unsigned int old;
     300        unsigned char what;
     301        unsigned char old;
    300302        struct list_head *pos;
    301303        snd_pcm_substream_t *s;
     304
     305        what = 0;
     306        snd_pcm_group_for_each(pos, substream) {
     307                s = snd_pcm_group_substream_entry(pos);
     308                what |= (unsigned long)(s->runtime->private_data);
     309                snd_pcm_trigger_done(s, substream);
     310        }
    302311
    303312        switch (cmd) {
    304313        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
    305314        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
    306                 what = 0;
    307                 snd_pcm_group_for_each(pos, substream) {
    308                         s = snd_pcm_group_substream_entry(pos);
    309                         if (s == ice->playback_pro_substream)
    310                                 what |= VT1724_PDMA0_PAUSE;
    311                         else if (s == ice->capture_pro_substream)
    312                                 what |= VT1724_RDMA0_PAUSE;
    313                         else if (s == ice->playback_con_substream)
    314                                 what |= VT1724_PDMA4_PAUSE;
    315                         else if (s == ice->capture_con_substream)
    316                                 what |= VT1724_RDMA1_PAUSE;
    317                 }
    318315                spin_lock(&ice->reg_lock);
    319                 old = inl(ICEMT1724(ice, DMA_PAUSE));
     316                old = inb(ICEMT1724(ice, DMA_PAUSE));
    320317                if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH)
    321318                        old |= what;
    322319                else
    323320                        old &= ~what;
    324                 outl(old, ICEMT1724(ice, DMA_PAUSE));
     321                outb(old, ICEMT1724(ice, DMA_PAUSE));
    325322                spin_unlock(&ice->reg_lock);
    326323                break;
     
    328325        case SNDRV_PCM_TRIGGER_START:
    329326        case SNDRV_PCM_TRIGGER_STOP:
    330                 what = 0;
    331                 s = substream;
    332                 snd_pcm_group_for_each(pos, substream) {
    333                         s = snd_pcm_group_substream_entry(pos);
    334                         if (s == ice->playback_pro_substream) {
    335                                 what |= VT1724_PDMA0_START;
    336                                 snd_pcm_trigger_done(s, substream);
    337                         } else if (s == ice->capture_pro_substream) {
    338                                 what |= VT1724_RDMA0_START;
    339                                 snd_pcm_trigger_done(s, substream);
    340                         } else if (s == ice->playback_con_substream) {
    341                                 what |= VT1724_PDMA4_START;
    342                                 snd_pcm_trigger_done(s, substream);
    343                         } else if (s == ice->capture_con_substream) {
    344                                 what |= VT1724_RDMA1_START;
    345                                 snd_pcm_trigger_done(s, substream);
    346                         }
    347                 }
    348327                spin_lock(&ice->reg_lock);
    349                 old = inl(ICEMT1724(ice, DMA_CONTROL));
     328                old = inb(ICEMT1724(ice, DMA_CONTROL));
    350329                if (cmd == SNDRV_PCM_TRIGGER_START)
    351330                        old |= what;
    352331                else
    353332                        old &= ~what;
    354                 outl(old, ICEMT1724(ice, DMA_CONTROL));
     333                outb(old, ICEMT1724(ice, DMA_CONTROL));
    355334                spin_unlock(&ice->reg_lock);
    356335                break;
     
    365344 */
    366345
    367 #define DMA_STARTS      (VT1724_RDMA0_START|VT1724_PDMA0_START|VT1724_RDMA1_START|VT1724_PDMA4_START)
    368 #define DMA_PAUSES      (VT1724_RDMA0_PAUSE|VT1724_PDMA0_PAUSE|VT1724_RDMA1_PAUSE|VT1724_PDMA4_PAUSE)
     346#define DMA_STARTS      (VT1724_RDMA0_START|VT1724_PDMA0_START|VT1724_RDMA1_START|\
     347        VT1724_PDMA1_START|VT1724_PDMA2_START|VT1724_PDMA3_START|VT1724_PDMA4_START)
     348#define DMA_PAUSES      (VT1724_RDMA0_PAUSE|VT1724_PDMA0_PAUSE|VT1724_RDMA1_PAUSE|\
     349        VT1724_PDMA1_PAUSE|VT1724_PDMA2_PAUSE|VT1724_PDMA3_PAUSE|VT1724_PDMA4_PAUSE)
    369350
    370351static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force)
     
    449430{
    450431        ice1712_t *ice = snd_pcm_substream_chip(substream);
    451 
     432        int i, chs;
     433
     434        chs = params_channels(hw_params);
     435        down(&ice->open_mutex);
     436        /* mark surround channels */
     437        if (substream == ice->playback_pro_substream) {
     438                chs = chs / 2 - 1;
     439                for (i = 0; i < chs; i++) {
     440                        if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) {
     441                                up(&ice->open_mutex);
     442                                return -EBUSY;
     443                        }
     444                        ice->pcm_reserved[i] = substream;
     445                }
     446                for (; i < 3; i++) {
     447                        if (ice->pcm_reserved[i] == substream)
     448                                ice->pcm_reserved[i] = NULL;
     449                }
     450        } else {
     451                for (i = 0; i < 3; i++) {
     452                        if (ice->playback_con_substream_ds[i] == substream) {
     453                                if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) {
     454                                        up(&ice->open_mutex);
     455                                        return -EBUSY;
     456                                }
     457                                ice->pcm_reserved[i] = substream;
     458                                break;
     459                        }
     460                }
     461        }
     462        up(&ice->open_mutex);
    452463        snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0);
    453464        return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
     
    456467static int snd_vt1724_pcm_hw_free(snd_pcm_substream_t * substream)
    457468{
     469        ice1712_t *ice = snd_pcm_substream_chip(substream);
     470        int i;
     471
     472        down(&ice->open_mutex);
     473        /* unmark surround channels */
     474        for (i = 0; i < 3; i++)
     475                if (ice->pcm_reserved[i] == substream)
     476                        ice->pcm_reserved[i] = NULL;
     477        up(&ice->open_mutex);
    458478        return snd_pcm_lib_free_pages(substream);
    459479}
     
    594614        .channels_min =         2,
    595615        .channels_max =         8,
    596         .buffer_bytes_max =     (1UL << 21),    /* 18bits dword */
     616        .buffer_bytes_max =     (1UL << 21),    /* 19bits dword */
    597617        .period_bytes_min =     8 * 4 * 2,      /* FIXME: constraints needed */
    598618        .period_bytes_max =     (1UL << 21),
    599         .periods_min =          1,
     619        .periods_min =          2,
    600620        .periods_max =          1024,
    601621};
    602622
    603 static snd_pcm_hardware_t snd_vt1724_capture_pro =
     623static snd_pcm_hardware_t snd_vt1724_2ch_stereo =
    604624{
    605625        .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
     
    613633        .channels_min =         2,
    614634        .channels_max =         2,
    615         .buffer_bytes_max =     (256*1024),
     635        .buffer_bytes_max =     (1UL << 18),    /* 16bits dword */
    616636        .period_bytes_min =     2 * 4 * 2,
    617         .period_bytes_max =     (256*1024),
    618         .periods_min =          1,
     637        .period_bytes_max =     (1UL << 18),
     638        .periods_min =          2,
    619639        .periods_max =          1024,
    620640};
     
    629649        snd_pcm_runtime_t *runtime = substream->runtime;
    630650        ice1712_t *ice = snd_pcm_substream_chip(substream);
    631 
     651        int chs;
     652
     653        runtime->private_data = (void*)VT1724_PDMA0_START; /* irq/status/trigger bit */
    632654        ice->playback_pro_substream = substream;
    633655        runtime->hw = snd_vt1724_playback_pro;
     
    640662                snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96);
    641663
    642         snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels);
     664        down(&ice->open_mutex);
     665        /* calculate the currently available channels */
     666        for (chs = 0; chs < 3; chs++) {
     667                if (ice->pcm_reserved[chs])
     668                        break;
     669        }
     670        chs = (chs + 1) * 2;
     671        runtime->hw.channels_max = chs;
     672        if (chs > 2) /* channels must be even */
     673                snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2);
     674        up(&ice->open_mutex);
    643675        snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
    644676                                   VT1724_BUFFER_ALIGN);
     
    653685        snd_pcm_runtime_t *runtime = substream->runtime;
    654686
     687        runtime->private_data = (void*)VT1724_RDMA0_START; /* irq/status/trigger bit */
    655688        ice->capture_pro_substream = substream;
    656         runtime->hw = snd_vt1724_capture_pro;
     689        runtime->hw = snd_vt1724_2ch_stereo;
    657690        snd_pcm_set_sync(substream);
    658691        snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
     
    736769 */
    737770
    738 static snd_pcm_hardware_t snd_vt1724_playback_spdif =
    739 {
    740         .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
    741                                  SNDRV_PCM_INFO_BLOCK_TRANSFER |
    742                                  SNDRV_PCM_INFO_MMAP_VALID |
    743                                  SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_SYNC_START),
    744         .formats =              SNDRV_PCM_FMTBIT_S32_LE,
    745         .rates =                SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_192000,
    746         .rate_min =             4000,
    747         .rate_max =             192000,
    748         .channels_min =         2,
    749         .channels_max =         2,
    750         .buffer_bytes_max =     (256*1024),
    751         .period_bytes_min =     2 * 4 * 2,
    752         .period_bytes_max =     (256*1024),
    753         .periods_min =          1,
    754         .periods_max =          1024,
    755 };
    756 
    757771const static struct vt1724_pcm_reg vt1724_playback_spdif_reg = {
    758772        .addr = VT1724_MT_PDMA4_ADDR,
     
    796810        snd_pcm_runtime_t *runtime = substream->runtime;
    797811
     812        runtime->private_data = (void*)VT1724_PDMA4_START; /* irq/status/trigger bit */
    798813        ice->playback_con_substream = substream;
    799         runtime->hw = snd_vt1724_playback_spdif;
     814        runtime->hw = snd_vt1724_2ch_stereo;
    800815        snd_pcm_set_sync(substream);
    801816        snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
     
    821836        snd_pcm_runtime_t *runtime = substream->runtime;
    822837
     838        runtime->private_data = (void*)VT1724_RDMA1_START; /* irq/status/trigger bit */
    823839        ice->capture_con_substream = substream;
    824         runtime->hw = snd_vt1724_playback_spdif;
     840        runtime->hw = snd_vt1724_2ch_stereo;
    825841        snd_pcm_set_sync(substream);
    826842        snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
     
    898914
    899915        ice->pcm = pcm;
     916
     917        return 0;
     918}
     919
     920
     921/*
     922 * independent surround PCMs
     923 */
     924
     925const static struct vt1724_pcm_reg vt1724_playback_dma_regs[3] = {
     926        {
     927                .addr = VT1724_MT_PDMA1_ADDR,
     928                .size = VT1724_MT_PDMA1_SIZE,
     929                .count = VT1724_MT_PDMA1_COUNT,
     930                .start = VT1724_PDMA1_START,
     931                .pause = VT1724_PDMA1_PAUSE,
     932        },
     933        {
     934                .addr = VT1724_MT_PDMA2_ADDR,
     935                .size = VT1724_MT_PDMA2_SIZE,
     936                .count = VT1724_MT_PDMA2_COUNT,
     937                .start = VT1724_PDMA2_START,
     938                .pause = VT1724_PDMA2_PAUSE,
     939        },
     940        {
     941                .addr = VT1724_MT_PDMA3_ADDR,
     942                .size = VT1724_MT_PDMA3_SIZE,
     943                .count = VT1724_MT_PDMA3_COUNT,
     944                .start = VT1724_PDMA3_START,
     945                .pause = VT1724_PDMA3_PAUSE,
     946        },
     947};
     948
     949static int snd_vt1724_playback_indep_prepare(snd_pcm_substream_t * substream)
     950{
     951        ice1712_t *ice = snd_pcm_substream_chip(substream);
     952        unsigned char val;
     953
     954        spin_lock(&ice->reg_lock);
     955        val = 3 - substream->number;
     956        if (inb(ICEMT1724(ice, BURST)) < val)
     957                outb(val, ICEMT1724(ice, BURST));
     958        spin_unlock(&ice->reg_lock);
     959        return snd_vt1724_pcm_prepare(substream, &vt1724_playback_dma_regs[substream->number]);
     960}
     961
     962static snd_pcm_uframes_t snd_vt1724_playback_indep_pointer(snd_pcm_substream_t * substream)
     963{
     964        return snd_vt1724_pcm_pointer(substream, &vt1724_playback_dma_regs[substream->number]);
     965}
     966
     967static int snd_vt1724_playback_indep_open(snd_pcm_substream_t *substream)
     968{
     969        ice1712_t *ice = snd_pcm_substream_chip(substream);
     970        snd_pcm_runtime_t *runtime = substream->runtime;
     971
     972        down(&ice->open_mutex);
     973        /* already used by PDMA0? */
     974        if (ice->pcm_reserved[substream->number]) {
     975                up(&ice->open_mutex);
     976                return -EBUSY; /* FIXME: should handle blocking mode properly */
     977        }
     978        up(&ice->open_mutex);
     979        runtime->private_data = (void*)(1 << (substream->number + 4));
     980        ice->playback_con_substream_ds[substream->number] = substream;
     981        runtime->hw = snd_vt1724_2ch_stereo;
     982        snd_pcm_set_sync(substream);
     983        snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
     984
     985        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192);
     986        return 0;
     987}
     988
     989static int snd_vt1724_playback_indep_close(snd_pcm_substream_t * substream)
     990{
     991        ice1712_t *ice = snd_pcm_substream_chip(substream);
     992
     993        if (PRO_RATE_RESET)
     994                snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
     995        ice->playback_con_substream_ds[substream->number] = NULL;
     996        ice->pcm_reserved[substream->number] = NULL;
     997
     998        return 0;
     999}
     1000
     1001static snd_pcm_ops_t snd_vt1724_playback_indep_ops = {
     1002        .open =         snd_vt1724_playback_indep_open,
     1003        .close =        snd_vt1724_playback_indep_close,
     1004        .ioctl =        snd_pcm_lib_ioctl,
     1005        .hw_params =    snd_vt1724_pcm_hw_params,
     1006        .hw_free =      snd_vt1724_pcm_hw_free,
     1007        .prepare =      snd_vt1724_playback_indep_prepare,
     1008        .trigger =      snd_vt1724_pcm_trigger,
     1009        .pointer =      snd_vt1724_playback_indep_pointer,
     1010};
     1011
     1012
     1013static int __devinit snd_vt1724_pcm_indep(ice1712_t * ice, int device)
     1014{
     1015        snd_pcm_t *pcm;
     1016        int play;
     1017        int err;
     1018
     1019        play = ice->num_total_dacs / 2 - 1;
     1020        if (play <= 0)
     1021                return 0;
     1022
     1023        err = snd_pcm_new(ice->card, "ICE1724 Surrounds", device, play, 0, &pcm);
     1024        if (err < 0)
     1025                return err;
     1026
     1027        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
     1028                        &snd_vt1724_playback_indep_ops);
     1029
     1030        pcm->private_data = ice;
     1031        pcm->info_flags = 0;
     1032        strcpy(pcm->name, "ICE1724 Surround PCM");
     1033
     1034        snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 64*1024, 64*1024);
     1035
     1036        ice->pcm_ds = pcm;
    9001037
    9011038        return 0;
     
    18091946        spin_lock_init(&ice->reg_lock);
    18101947        init_MUTEX(&ice->gpio_mutex);
     1948        init_MUTEX(&ice->open_mutex);
    18111949        ice->gpio.set_mask = snd_vt1724_set_gpio_mask;
    18121950        ice->gpio.set_dir = snd_vt1724_set_gpio_dir;
     
    19332071        }
    19342072       
     2073        if ((err = snd_vt1724_pcm_indep(ice, pcm_dev++)) < 0) {
     2074                snd_card_free(card);
     2075                return err;
     2076        }
     2077
    19352078        if ((err = snd_vt1724_ac97_mixer(ice)) < 0) {
    19362079                snd_card_free(card);
  • GPL/branches/alsa-resync1/alsa-kernel/pci/intel8x0.c

    r290 r300  
    11871187    struct intel8x0 *chip = snd_pcm_substream_chip(substream);
    11881188    snd_pcm_runtime_t *runtime = substream->runtime;
    1189         static unsigned int i, rates[] = {
    1190                 /* ATTENTION: these values depend on the definition in pcm.h! */
    1191                 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000
    1192         };
    11931189    int err;
    11941190
     
    33523348#ifndef MODULE
    33533349
    3354 /* format is: snd-intel8x0=enable,index,id,ac97_clock,mpu_port,joystick */
     3350/* format is: snd-intel8x0=enable,index,id,ac97_clock,ac97_quirk,mpu_port,joystick */
    33553351
    33563352static int __init alsa_card_intel8x0_setup(char *str)
  • GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c

    r290 r300  
    38123812        int mapped_channel;
    38133813
    3814         snd_assert(channel >= 0 || channel < hdsp->max_channels, return NULL);
     3814        snd_assert(channel >= 0 && channel < hdsp->max_channels, return NULL);
    38153815       
    38163816        if ((mapped_channel = hdsp->channel_map[channel]) < 0) {
Note: See TracChangeset for help on using the changeset viewer.