mtpav.c (f0eef25339f92f7cd4aeea23d9ae97987a5a1e82) mtpav.c (788c6043335590e0a483fdc18f85b1405a157bf9)
1/*
2 * MOTU Midi Timepiece ALSA Main routines
3 * Copyright by Michael T. Mayers (c) Jan 09, 2000
4 * mail: michael@tweakoz.com
5 * Thanks to John Galbraith
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 569 unchanged lines hidden (view full) ---

578 snd_mtpav_read_bytes(mcard);
579 spin_unlock(&mcard->spinlock);
580 return IRQ_HANDLED;
581}
582
583/*
584 * get ISA resources
585 */
1/*
2 * MOTU Midi Timepiece ALSA Main routines
3 * Copyright by Michael T. Mayers (c) Jan 09, 2000
4 * mail: michael@tweakoz.com
5 * Thanks to John Galbraith
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 569 unchanged lines hidden (view full) ---

578 snd_mtpav_read_bytes(mcard);
579 spin_unlock(&mcard->spinlock);
580 return IRQ_HANDLED;
581}
582
583/*
584 * get ISA resources
585 */
586static int __init snd_mtpav_get_ISA(struct mtpav * mcard)
586static int __devinit snd_mtpav_get_ISA(struct mtpav * mcard)
587{
588 if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
589 snd_printk("MTVAP port 0x%lx is busy\n", port);
590 return -EBUSY;
591 }
592 mcard->port = port;
593 if (request_irq(irq, snd_mtpav_irqh, IRQF_DISABLED, "MOTU MTPAV", mcard)) {
594 snd_printk("MTVAP IRQ %d busy\n", irq);

--- 19 unchanged lines hidden (view full) ---

614 .trigger = snd_mtpav_input_trigger,
615};
616
617
618/*
619 * get RAWMIDI resources
620 */
621
587{
588 if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
589 snd_printk("MTVAP port 0x%lx is busy\n", port);
590 return -EBUSY;
591 }
592 mcard->port = port;
593 if (request_irq(irq, snd_mtpav_irqh, IRQF_DISABLED, "MOTU MTPAV", mcard)) {
594 snd_printk("MTVAP IRQ %d busy\n", irq);

--- 19 unchanged lines hidden (view full) ---

614 .trigger = snd_mtpav_input_trigger,
615};
616
617
618/*
619 * get RAWMIDI resources
620 */
621
622static void __init snd_mtpav_set_name(struct mtpav *chip,
622static void __devinit snd_mtpav_set_name(struct mtpav *chip,
623 struct snd_rawmidi_substream *substream)
624{
625 if (substream->number >= 0 && substream->number < chip->num_ports)
626 sprintf(substream->name, "MTP direct %d", (substream->number % chip->num_ports) + 1);
627 else if (substream->number >= 8 && substream->number < chip->num_ports * 2)
628 sprintf(substream->name, "MTP remote %d", (substream->number % chip->num_ports) + 1);
629 else if (substream->number == chip->num_ports * 2)
630 strcpy(substream->name, "MTP computer");
631 else if (substream->number == chip->num_ports * 2 + 1)
632 strcpy(substream->name, "MTP ADAT");
633 else
634 strcpy(substream->name, "MTP broadcast");
635}
636
623 struct snd_rawmidi_substream *substream)
624{
625 if (substream->number >= 0 && substream->number < chip->num_ports)
626 sprintf(substream->name, "MTP direct %d", (substream->number % chip->num_ports) + 1);
627 else if (substream->number >= 8 && substream->number < chip->num_ports * 2)
628 sprintf(substream->name, "MTP remote %d", (substream->number % chip->num_ports) + 1);
629 else if (substream->number == chip->num_ports * 2)
630 strcpy(substream->name, "MTP computer");
631 else if (substream->number == chip->num_ports * 2 + 1)
632 strcpy(substream->name, "MTP ADAT");
633 else
634 strcpy(substream->name, "MTP broadcast");
635}
636
637static int __init snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
637static int __devinit snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
638{
639 int rval;
640 struct snd_rawmidi *rawmidi;
641 struct snd_rawmidi_substream *substream;
642 struct list_head *list;
643
644 if (hwports < 1)
645 hwports = 1;

--- 40 unchanged lines hidden (view full) ---

686 spin_unlock_irqrestore(&crd->spinlock, flags);
687 if (crd->irq >= 0)
688 free_irq(crd->irq, (void *)crd);
689 release_and_free_resource(crd->res_port);
690}
691
692/*
693 */
638{
639 int rval;
640 struct snd_rawmidi *rawmidi;
641 struct snd_rawmidi_substream *substream;
642 struct list_head *list;
643
644 if (hwports < 1)
645 hwports = 1;

--- 40 unchanged lines hidden (view full) ---

686 spin_unlock_irqrestore(&crd->spinlock, flags);
687 if (crd->irq >= 0)
688 free_irq(crd->irq, (void *)crd);
689 release_and_free_resource(crd->res_port);
690}
691
692/*
693 */
694static int __init snd_mtpav_probe(struct platform_device *dev)
694static int __devinit snd_mtpav_probe(struct platform_device *dev)
695{
696 struct snd_card *card;
697 int err;
698 struct mtpav *mtp_card;
699
700 card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card));
701 if (! card)
702 return -ENOMEM;

--- 37 unchanged lines hidden (view full) ---

740 printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port);
741 return 0;
742
743 __error:
744 snd_card_free(card);
745 return err;
746}
747
695{
696 struct snd_card *card;
697 int err;
698 struct mtpav *mtp_card;
699
700 card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card));
701 if (! card)
702 return -ENOMEM;

--- 37 unchanged lines hidden (view full) ---

740 printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port);
741 return 0;
742
743 __error:
744 snd_card_free(card);
745 return err;
746}
747
748static int snd_mtpav_remove(struct platform_device *devptr)
748static int __devexit snd_mtpav_remove(struct platform_device *devptr)
749{
750 snd_card_free(platform_get_drvdata(devptr));
751 platform_set_drvdata(devptr, NULL);
752 return 0;
753}
754
755#define SND_MTPAV_DRIVER "snd_mtpav"
756
757static struct platform_driver snd_mtpav_driver = {
758 .probe = snd_mtpav_probe,
749{
750 snd_card_free(platform_get_drvdata(devptr));
751 platform_set_drvdata(devptr, NULL);
752 return 0;
753}
754
755#define SND_MTPAV_DRIVER "snd_mtpav"
756
757static struct platform_driver snd_mtpav_driver = {
758 .probe = snd_mtpav_probe,
759 .remove = snd_mtpav_remove,
759 .remove = __devexit_p(snd_mtpav_remove),
760 .driver = {
761 .name = SND_MTPAV_DRIVER
762 },
763};
764
765static int __init alsa_card_mtpav_init(void)
766{
767 int err;

--- 24 unchanged lines hidden ---
760 .driver = {
761 .name = SND_MTPAV_DRIVER
762 },
763};
764
765static int __init alsa_card_mtpav_init(void)
766{
767 int err;

--- 24 unchanged lines hidden ---