Lines Matching +full:inverted +full:- +full:tx
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright (c) by Levent Guendogdu <levon@feature-it.com>
9 * - cleanup and rewrite
11 * - source code cleanup
13 * - fixed compilation problem with alsa 1.0.6a (removed MODULE_CLASSES,
17 * - added 2.6 kernel support
19 …* - added parport_unregister_driver to the startup routine if the driver fails to detect a po…
20 * - added support for all 4 output ports in portman_putmidi
22 * - added checks for opened input device in interrupt handler
24 * - ported from alsa 0.5 to 1.0
93 return -ENOMEM; in portman_create()
96 spin_lock_init(&pm->reg_lock); in portman_create()
97 pm->card = card; in portman_create()
98 pm->pardev = pardev; in portman_create()
110 #define PP_STAT_BSY 0x80 /* Busy status. Inverted. */
111 #define PP_STAT_ACK 0x40 /* Acknowledge. Non-Inverted. */
112 #define PP_STAT_POUT 0x20 /* Paper Out. Non-Inverted. */
113 #define PP_STAT_SEL 0x10 /* Select. Non-Inverted. */
114 #define PP_STAT_ERR 0x08 /* Error. Non-Inverted. */
117 #define PP_CMD_IEN 0x10 /* IRQ Enable. Non-Inverted. */
118 #define PP_CMD_SELI 0x08 /* Select Input. Inverted. */
119 #define PP_CMD_INIT 0x04 /* Init Printer. Non-Inverted. */
120 #define PP_CMD_FEED 0x02 /* Auto Feed. Inverted. */
121 #define PP_CMD_STB 0x01 /* Strobe. Inverted. */
152 * --------
156 #define SYNC_STAT PP_STAT_SEL /* Reserved - Sync Status. 0 1 0 */
158 #define TXEMPTY PP_STAT_SEL /* Tx Empty, channel 0. 1 0 0 */
159 // TXEMPTY1 PP_STAT_SEL /* Tx Empty, channel 1. 1 0 1 */
160 // TXEMPTY2 PP_STAT_SEL /* Tx Empty, channel 2. 1 1 0 */
161 // TXEMPTY3 PP_STAT_SEL /* Tx Empty, channel 3. 1 1 1 */
164 * --------
168 #define SYNC_DATA PP_STAT_BSY /* Reserved - Sync Data. 0 1 0 */
182 parport_write_control(pm->pardev->port, value); in portman_write_command()
187 return parport_read_status(pm->pardev->port); in portman_read_status()
192 parport_write_data(pm->pardev->port, value); in portman_write_data()
201 * Set up Tx Channel address field for use with PP Cmd Register. in portman_write_midi()
212 * write the address associated with the current Tx channel to the in portman_write_midi()
245 /* Release strobe and immediately re-allow interrupts. */ in portman_write_midi()
265 * Return -1 if no data
286 return -1; /* No data. */ in portman_read_midi()
335 /* De-assert Strobe and return data. */ in portman_read_midi()
445 return 1; /* CODE 1 - Strobe Failure. */ in portman_probe()
453 return 1; /* CODE 1 - Strobe Failure. */ in portman_probe()
458 /* Check if Tx circuitry is functioning properly. If initialized in portman_probe()
462 parport_write_control(p, TXDATA0); /* Tx channel 0, strobe off. */ in portman_probe()
499 struct portman *pm = substream->rmidi->private_data; in snd_portman_midi_input_trigger()
502 spin_lock_irqsave(&pm->reg_lock, flags); in snd_portman_midi_input_trigger()
504 pm->mode[substream->number] |= PORTMAN2X4_MODE_INPUT_TRIGGERED; in snd_portman_midi_input_trigger()
506 pm->mode[substream->number] &= ~PORTMAN2X4_MODE_INPUT_TRIGGERED; in snd_portman_midi_input_trigger()
507 spin_unlock_irqrestore(&pm->reg_lock, flags); in snd_portman_midi_input_trigger()
513 struct portman *pm = substream->rmidi->private_data; in snd_portman_midi_output_trigger()
517 spin_lock_irqsave(&pm->reg_lock, flags); in snd_portman_midi_output_trigger()
520 portman_write_midi(pm, substream->number, byte); in snd_portman_midi_output_trigger()
522 spin_unlock_irqrestore(&pm->reg_lock, flags); in snd_portman_midi_output_trigger()
540 struct portman *pm = card->private_data; in snd_portman_rawmidi_create()
552 rmidi->private_data = pm; in snd_portman_rawmidi_create()
553 strcpy(rmidi->name, CARD_NAME); in snd_portman_rawmidi_create()
554 rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | in snd_portman_rawmidi_create()
558 pm->rmidi = rmidi; in snd_portman_rawmidi_create()
569 &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams, in snd_portman_rawmidi_create()
571 sprintf(substream->name, in snd_portman_rawmidi_create()
572 "Portman2x4 %d", substream->number+1); in snd_portman_rawmidi_create()
576 &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams, in snd_portman_rawmidi_create()
578 pm->midi_input[substream->number] = substream; in snd_portman_rawmidi_create()
579 sprintf(substream->name, in snd_portman_rawmidi_create()
580 "Portman2x4 %d", substream->number+1); in snd_portman_rawmidi_create()
592 struct portman *pm = ((struct snd_card*)userdata)->private_data; in snd_portman_interrupt()
594 spin_lock(&pm->reg_lock); in snd_portman_interrupt()
604 if (pm->mode[0] & PORTMAN2X4_MODE_INPUT_TRIGGERED) in snd_portman_interrupt()
605 snd_rawmidi_receive(pm->midi_input[0], in snd_portman_interrupt()
615 if (pm->mode[1] & PORTMAN2X4_MODE_INPUT_TRIGGERED) in snd_portman_interrupt()
616 snd_rawmidi_receive(pm->midi_input[1], in snd_portman_interrupt()
622 spin_unlock(&pm->reg_lock); in snd_portman_interrupt()
660 if (strcmp(pardev->name, DRIVER_NAME)) in snd_portman_dev_probe()
661 return -ENODEV; in snd_portman_dev_probe()
679 struct portman *pm = card->private_data; in snd_portman_card_private_free()
680 struct pardevice *pardev = pm->pardev; in snd_portman_card_private_free()
694 int dev = pdev->id; in snd_portman_probe()
709 return -ENODEV; in snd_portman_probe()
711 return -ENOENT; in snd_portman_probe()
713 err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, in snd_portman_probe()
719 strcpy(card->driver, DRIVER_NAME); in snd_portman_probe()
720 strcpy(card->shortname, CARD_NAME); in snd_portman_probe()
721 sprintf(card->longname, "%s at 0x%lx, irq %i", in snd_portman_probe()
722 card->shortname, p->base, p->irq); in snd_portman_probe()
728 pdev->id); /* device number */ in snd_portman_probe()
731 err = -EIO; in snd_portman_probe()
737 snd_printd("Cannot claim parport 0x%lx\n", pardev->port->base); in snd_portman_probe()
738 err = -EIO; in snd_portman_probe()
747 card->private_data = pm; in snd_portman_probe()
748 card->private_free = snd_portman_card_private_free; in snd_portman_probe()
752 err = -EIO; in snd_portman_probe()
776 snd_printk(KERN_INFO "Portman 2x4 on 0x%lx\n", p->base); in snd_portman_probe()
832 return -EIO; in snd_portman_module_init()
837 return -ENODEV; in snd_portman_module_init()