Lines Matching +full:non +full:- +full:inverted

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 */
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()
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()
388 dev_warn(pm->card->dev, "%s Won't flush port %i\n", in portman_flush_input()
444 return 1; /* CODE 1 - Strobe Failure. */ in portman_probe()
452 return 1; /* CODE 1 - Strobe Failure. */ in portman_probe()
498 struct portman *pm = substream->rmidi->private_data; in snd_portman_midi_input_trigger()
501 spin_lock_irqsave(&pm->reg_lock, flags); in snd_portman_midi_input_trigger()
503 pm->mode[substream->number] |= PORTMAN2X4_MODE_INPUT_TRIGGERED; in snd_portman_midi_input_trigger()
505 pm->mode[substream->number] &= ~PORTMAN2X4_MODE_INPUT_TRIGGERED; in snd_portman_midi_input_trigger()
506 spin_unlock_irqrestore(&pm->reg_lock, flags); in snd_portman_midi_input_trigger()
512 struct portman *pm = substream->rmidi->private_data; in snd_portman_midi_output_trigger()
516 spin_lock_irqsave(&pm->reg_lock, flags); in snd_portman_midi_output_trigger()
519 portman_write_midi(pm, substream->number, byte); in snd_portman_midi_output_trigger()
521 spin_unlock_irqrestore(&pm->reg_lock, flags); in snd_portman_midi_output_trigger()
539 struct portman *pm = card->private_data; in snd_portman_rawmidi_create()
551 rmidi->private_data = pm; in snd_portman_rawmidi_create()
552 strcpy(rmidi->name, CARD_NAME); in snd_portman_rawmidi_create()
553 rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | in snd_portman_rawmidi_create()
557 pm->rmidi = rmidi; in snd_portman_rawmidi_create()
568 &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams, in snd_portman_rawmidi_create()
570 sprintf(substream->name, in snd_portman_rawmidi_create()
571 "Portman2x4 %d", substream->number+1); in snd_portman_rawmidi_create()
575 &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams, in snd_portman_rawmidi_create()
577 pm->midi_input[substream->number] = substream; in snd_portman_rawmidi_create()
578 sprintf(substream->name, in snd_portman_rawmidi_create()
579 "Portman2x4 %d", substream->number+1); in snd_portman_rawmidi_create()
591 struct portman *pm = ((struct snd_card*)userdata)->private_data; in snd_portman_interrupt()
593 spin_lock(&pm->reg_lock); in snd_portman_interrupt()
603 if (pm->mode[0] & PORTMAN2X4_MODE_INPUT_TRIGGERED) in snd_portman_interrupt()
604 snd_rawmidi_receive(pm->midi_input[0], in snd_portman_interrupt()
614 if (pm->mode[1] & PORTMAN2X4_MODE_INPUT_TRIGGERED) in snd_portman_interrupt()
615 snd_rawmidi_receive(pm->midi_input[1], in snd_portman_interrupt()
621 spin_unlock(&pm->reg_lock); in snd_portman_interrupt()
659 if (strcmp(pardev->name, DRIVER_NAME)) in snd_portman_dev_probe()
660 return -ENODEV; in snd_portman_dev_probe()
677 struct portman *pm = card->private_data; in snd_portman_card_private_free()
678 struct pardevice *pardev = pm->pardev; in snd_portman_card_private_free()
692 int dev = pdev->id; in snd_portman_probe()
707 return -ENODEV; in snd_portman_probe()
709 return -ENOENT; in snd_portman_probe()
711 err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, in snd_portman_probe()
714 dev_dbg(&pdev->dev, "Cannot create card\n"); in snd_portman_probe()
717 strcpy(card->driver, DRIVER_NAME); in snd_portman_probe()
718 strcpy(card->shortname, CARD_NAME); in snd_portman_probe()
719 sprintf(card->longname, "%s at 0x%lx, irq %i", in snd_portman_probe()
720 card->shortname, p->base, p->irq); in snd_portman_probe()
726 pdev->id); /* device number */ in snd_portman_probe()
728 dev_dbg(card->dev, "Cannot register pardevice\n"); in snd_portman_probe()
729 err = -EIO; in snd_portman_probe()
735 dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->base); in snd_portman_probe()
736 err = -EIO; in snd_portman_probe()
742 dev_dbg(card->dev, "Cannot create main component\n"); in snd_portman_probe()
745 card->private_data = pm; in snd_portman_probe()
746 card->private_free = snd_portman_card_private_free; in snd_portman_probe()
750 err = -EIO; in snd_portman_probe()
756 dev_dbg(card->dev, "Creating Rawmidi component failed\n"); in snd_portman_probe()
770 dev_dbg(card->dev, "Cannot register card\n"); in snd_portman_probe()
774 dev_info(card->dev, "Portman 2x4 on 0x%lx\n", p->base); in snd_portman_probe()
830 return -EIO; in snd_portman_module_init()
835 return -ENODEV; in snd_portman_module_init()