Ignore:
Timestamp:
Jul 14, 2007, 7:13:46 AM (18 years ago)
Author:
Brendan Oakley
Message:

Merged to Alsa 0.9.0rc5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/alsa-resync1/alsa-kernel/drivers/mtpav.c

    r207 r212  
    22 *      MOTU Midi Timepiece ALSA Main routines
    33 *      Copyright by Michael T. Mayers (c) Jan 09, 2000
    4  *      mail: tweakoz@pacbell.net
     4 *      mail: michael@tweakoz.com
    55 *      Thanks to John Galbraith
    66 *
     
    4545 *      - Recoded & debugged
    4646 *      - Added timer interrupt for midi outputs
    47  *      - snd_hwports is between 1 and 8, which specifies the number of hardware ports.
     47 *      - hwports is between 1 and 8, which specifies the number of hardware ports.
    4848 *        The three global ports, computer, adat and broadcast ports, are created
    4949 *        always after h/w and remote ports.
     
    5555#include <linux/init.h>
    5656#include <linux/slab.h>
     57#include <linux/ioport.h>
    5758#include <sound/core.h>
    5859#define SNDRV_GET_ID
     
    7576#define MTPAV_MAX_PORTS         8
    7677
    77 static int snd_index = SNDRV_DEFAULT_IDX1;
    78 static char *snd_id = SNDRV_DEFAULT_STR1;
    79 static long snd_port = MTPAV_IOBASE;    /* 0x378, 0x278 */
    80 static int snd_irq = MTPAV_IRQ;         /* 7, 5 */
    81 static int snd_hwports = MTPAV_MAX_PORTS;       /* use hardware ports 1-8 */
    82 
    83 MODULE_PARM(snd_index, "i");
    84 MODULE_PARM_DESC(snd_index, "Index value for MotuMTPAV MIDI.");
    85 MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
    86 MODULE_PARM(snd_id, "s");
    87 MODULE_PARM_DESC(snd_id, "ID string for MotuMTPAV MIDI.");
    88 MODULE_PARM_SYNTAX(snd_id, SNDRV_ID_DESC);
    89 MODULE_PARM(snd_port, "l");
    90 MODULE_PARM_DESC(snd_port, "Parallel port # for MotuMTPAV MIDI.");
    91 MODULE_PARM_SYNTAX(snd_port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list");
    92 MODULE_PARM(snd_irq, "i");
    93 MODULE_PARM_DESC(snd_irq, "Parallel IRQ # for MotuMTPAV MIDI.");
    94 MODULE_PARM_SYNTAX(snd_irq,  SNDRV_ENABLED ",allows:{{7},{5}},dialog:list");
    95 MODULE_PARM(snd_hwports, "i");
    96 MODULE_PARM_DESC(snd_hwports, "Hardware ports # for MotuMTPAV MIDI.");
    97 MODULE_PARM_SYNTAX(snd_hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list");
     78static int index = SNDRV_DEFAULT_IDX1;
     79static char *id = SNDRV_DEFAULT_STR1;
     80static long port = MTPAV_IOBASE;        /* 0x378, 0x278 */
     81static int irq = MTPAV_IRQ;             /* 7, 5 */
     82static int hwports = MTPAV_MAX_PORTS;   /* use hardware ports 1-8 */
     83
     84MODULE_PARM(index, "i");
     85MODULE_PARM_DESC(index, "Index value for MotuMTPAV MIDI.");
     86MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
     87MODULE_PARM(id, "s");
     88MODULE_PARM_DESC(id, "ID string for MotuMTPAV MIDI.");
     89MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
     90MODULE_PARM(port, "l");
     91MODULE_PARM_DESC(port, "Parallel port # for MotuMTPAV MIDI.");
     92MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list");
     93MODULE_PARM(irq, "i");
     94MODULE_PARM_DESC(irq, "Parallel IRQ # for MotuMTPAV MIDI.");
     95MODULE_PARM_SYNTAX(irq,  SNDRV_ENABLED ",allows:{{7},{5}},dialog:list");
     96MODULE_PARM(hwports, "i");
     97MODULE_PARM_DESC(hwports, "Hardware ports # for MotuMTPAV MIDI.");
     98MODULE_PARM_SYNTAX(hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list");
    9899
    99100/*
     
    421422}
    422423
     424/* spinlock held! */
    423425static void snd_mtpav_add_output_timer(mtpav_t *chip)
    424426{
    425         unsigned long flags;
    426 
    427         spin_lock_irqsave(&chip->spinlock, flags);
    428427        chip->timer.function = snd_mtpav_output_timer;
    429428        chip->timer.data = (unsigned long) mtp_card;
    430429        chip->timer.expires = 1 + jiffies;
    431430        add_timer(&chip->timer);
    432         spin_unlock_irqrestore(&chip->spinlock, flags);
    433 }
    434 
     431}
     432
     433/* spinlock held! */
    435434static void snd_mtpav_remove_output_timer(mtpav_t *chip)
    436435{
    437         unsigned long flags;
    438 
    439         spin_lock_irqsave(&chip->spinlock, flags);
    440436        del_timer(&chip->timer);
    441         spin_unlock_irqrestore(&chip->spinlock, flags);
    442437}
    443438
     
    510505
    511506        port = &mcrd->ports[mcrd->inmidiport];
    512         if (port->mode & MTPAV_MODE_INPUT_TRIGGERED)
     507        if (port->mode & MTPAV_MODE_INPUT_TRIGGERED) {
     508                spin_unlock(&mcrd->spinlock);
    513509                snd_rawmidi_receive(port->input, &inbyte, 1);
     510                spin_lock(&mcrd->spinlock);
     511        }
    514512}
    515513
     
    589587static int snd_mtpav_get_ISA(mtpav_t * mcard)
    590588{
    591         if ((mcard->res_port = request_region(snd_port, 3, "MotuMTPAV MIDI")) == NULL) {
    592                 snd_printk("MTVAP port 0x%lx is busy\n", snd_port);
     589        if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
     590                snd_printk("MTVAP port 0x%lx is busy\n", port);
    593591                return -EBUSY;
    594592        }
    595         mcard->port = snd_port;
    596         if (request_irq(snd_irq, snd_mtpav_irqh, SA_INTERRUPT, "MOTU MTPAV", (void *)mcard)) {
    597                 snd_printk("MTVAP IRQ %d busy\n", snd_irq);
     593        mcard->port = port;
     594        if (request_irq(irq, snd_mtpav_irqh, SA_INTERRUPT, "MOTU MTPAV", (void *)mcard)) {
     595                snd_printk("MTVAP IRQ %d busy\n", irq);
    598596                return -EBUSY;
    599597        }
    600         mcard->irq = snd_irq;
     598        mcard->irq = irq;
    601599        return 0;
    602600}
     
    606604 */
    607605
    608 #ifdef TARGET_OS2
    609606static snd_rawmidi_ops_t snd_mtpav_output = {
    610         snd_mtpav_output_open,
    611         snd_mtpav_output_close,
    612         snd_mtpav_output_trigger,
    613         0
     607        .open =         snd_mtpav_output_open,
     608        .close =        snd_mtpav_output_close,
     609        .trigger =      snd_mtpav_output_trigger,
    614610};
    615611
    616612static snd_rawmidi_ops_t snd_mtpav_input = {
    617         snd_mtpav_input_open,
    618         snd_mtpav_input_close,
    619         snd_mtpav_input_trigger,
    620         0
     613        .open =         snd_mtpav_input_open,
     614        .close =        snd_mtpav_input_close,
     615        .trigger =      snd_mtpav_input_trigger,
    621616};
    622 #else
    623 static snd_rawmidi_ops_t snd_mtpav_output = {
    624         open:           snd_mtpav_output_open,
    625         close:          snd_mtpav_output_close,
    626         trigger:        snd_mtpav_output_trigger,
    627 };
    628 
    629 static snd_rawmidi_ops_t snd_mtpav_input = {
    630         open:           snd_mtpav_input_open,
    631         close:          snd_mtpav_input_close,
    632         trigger:        snd_mtpav_input_trigger,
    633 };
    634 #endif
     617
    635618
    636619/*
     
    661644        //printk("entering snd_mtpav_get_RAWMIDI\n");
    662645
    663         if (snd_hwports < 1)
     646        if (hwports < 1)
    664647                mcard->num_ports = 1;
    665         else if (snd_hwports > 8)
     648        else if (hwports > 8)
    666649                mcard->num_ports = 8;
    667650        else
    668                 mcard->num_ports = snd_hwports;
     651                mcard->num_ports = hwports;
    669652
    670653        if ((rval = snd_rawmidi_new(mcard->card, "MotuMIDI", 0,
     
    746729                return -ENOMEM;
    747730
    748         mtp_card->card = snd_card_new(snd_index, snd_id, THIS_MODULE, 0);
     731        mtp_card->card = snd_card_new(index, id, THIS_MODULE, 0);
    749732        if (mtp_card->card == NULL) {
    750733                free_mtpav(mtp_card);
     
    776759        snd_mtpav_portscan(mtp_card);
    777760
    778         printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port);
     761        printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port);
    779762
    780763        return 0;
     
    806789#ifndef MODULE
    807790
    808 /* format is: snd-mtpav=snd_enable,snd_index,snd_id,
    809                              snd_port,snd_irq,snd_hwports */
     791/* format is: snd-mtpav=snd_enable,index,id,
     792                        port,irq,hwports */
    810793
    811794static int __init alsa_card_mtpav_setup(char *str)
     
    814797
    815798        (void)(get_option(&str,&enable) == 2 &&
    816                get_option(&str,&snd_index) == 2 &&
    817                get_id(&str,&snd_id) == 2 &&
    818                get_option(&str,(int *)&snd_port) == 2 &&
    819                get_option(&str,&snd_irq) == 2 &&
    820                get_option(&str,&snd_hwports) == 2);
     799               get_option(&str,&index) == 2 &&
     800               get_id(&str,&id) == 2 &&
     801               get_option(&str,(int *)&port) == 2 &&
     802               get_option(&str,&irq) == 2 &&
     803               get_option(&str,&hwports) == 2);
    821804        return 1;
    822805}
Note: See TracChangeset for help on using the changeset viewer.