Lines Matching +full:hw +full:- +full:settle +full:- +full:time

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
94 return -ENOMEM; in portman_create()
97 spin_lock_init(&pm->reg_lock); in portman_create()
98 pm->card = card; in portman_create()
99 pm->pardev = pardev; in portman_create()
107 * HW related constants
112 #define PP_STAT_ACK 0x40 /* Acknowledge. Non-Inverted. */
113 #define PP_STAT_POUT 0x20 /* Paper Out. Non-Inverted. */
114 #define PP_STAT_SEL 0x10 /* Select. Non-Inverted. */
115 #define PP_STAT_ERR 0x08 /* Error. Non-Inverted. */
118 #define PP_CMD_IEN 0x10 /* IRQ Enable. Non-Inverted. */
120 #define PP_CMD_INIT 0x04 /* Init Printer. Non-Inverted. */
153 * --------
157 #define SYNC_STAT PP_STAT_SEL /* Reserved - Sync Status. 0 1 0 */
165 * --------
169 #define SYNC_DATA PP_STAT_BSY /* Reserved - Sync Data. 0 1 0 */
183 parport_write_control(pm->pardev->port, value); in portman_write_command()
188 return parport_read_control(pm->pardev->port); in portman_read_command()
193 return parport_read_status(pm->pardev->port); in portman_read_status()
198 return parport_read_data(pm->pardev->port); in portman_read_data()
203 parport_write_data(pm->pardev->port, value); in portman_write_data()
230 /* While the address lines settle, write parallel output data to in portman_write_midi()
248 /* Wait for strobe line to settle and echo back through hardware. in portman_write_midi()
256 /* Release strobe and immediately re-allow interrupts. */ in portman_write_midi()
276 * Return -1 if no data
293 /* After the address lines settle, check multiplexed RxAvail signal. in portman_read_midi()
297 return -1; /* No data. */ in portman_read_midi()
346 /* De-assert Strobe and return data. */ in portman_read_midi()
405 /* Set address for specified channel in port and allow to settle. */ in portman_flush_input()
424 /* Deassert the Strobe signal of the port and wait for it to settle. */ in portman_flush_input()
435 * low in case we happen to be addressing the Rx ports at this time. in portman_probe()
456 return 1; /* CODE 1 - Strobe Failure. */ in portman_probe()
464 return 1; /* CODE 1 - Strobe Failure. */ in portman_probe()
510 struct portman *pm = substream->rmidi->private_data; in snd_portman_midi_input_trigger()
513 spin_lock_irqsave(&pm->reg_lock, flags); in snd_portman_midi_input_trigger()
515 pm->mode[substream->number] |= PORTMAN2X4_MODE_INPUT_TRIGGERED; in snd_portman_midi_input_trigger()
517 pm->mode[substream->number] &= ~PORTMAN2X4_MODE_INPUT_TRIGGERED; in snd_portman_midi_input_trigger()
518 spin_unlock_irqrestore(&pm->reg_lock, flags); in snd_portman_midi_input_trigger()
524 struct portman *pm = substream->rmidi->private_data; in snd_portman_midi_output_trigger()
528 spin_lock_irqsave(&pm->reg_lock, flags); in snd_portman_midi_output_trigger()
531 portman_write_midi(pm, substream->number, byte); in snd_portman_midi_output_trigger()
533 spin_unlock_irqrestore(&pm->reg_lock, flags); in snd_portman_midi_output_trigger()
551 struct portman *pm = card->private_data; in snd_portman_rawmidi_create()
563 rmidi->private_data = pm; in snd_portman_rawmidi_create()
564 strcpy(rmidi->name, CARD_NAME); in snd_portman_rawmidi_create()
565 rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | in snd_portman_rawmidi_create()
569 pm->rmidi = rmidi; in snd_portman_rawmidi_create()
580 &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams, in snd_portman_rawmidi_create()
582 sprintf(substream->name, in snd_portman_rawmidi_create()
583 "Portman2x4 %d", substream->number+1); in snd_portman_rawmidi_create()
587 &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams, in snd_portman_rawmidi_create()
589 pm->midi_input[substream->number] = substream; in snd_portman_rawmidi_create()
590 sprintf(substream->name, in snd_portman_rawmidi_create()
591 "Portman2x4 %d", substream->number+1); in snd_portman_rawmidi_create()
603 struct portman *pm = ((struct snd_card*)userdata)->private_data; in snd_portman_interrupt()
605 spin_lock(&pm->reg_lock); in snd_portman_interrupt()
615 if (pm->mode[0] & PORTMAN2X4_MODE_INPUT_TRIGGERED) in snd_portman_interrupt()
616 snd_rawmidi_receive(pm->midi_input[0], in snd_portman_interrupt()
626 if (pm->mode[1] & PORTMAN2X4_MODE_INPUT_TRIGGERED) in snd_portman_interrupt()
627 snd_rawmidi_receive(pm->midi_input[1], in snd_portman_interrupt()
633 spin_unlock(&pm->reg_lock); in snd_portman_interrupt()
671 if (strcmp(pardev->name, DRIVER_NAME)) in snd_portman_dev_probe()
672 return -ENODEV; in snd_portman_dev_probe()
690 struct portman *pm = card->private_data; in snd_portman_card_private_free()
691 struct pardevice *pardev = pm->pardev; in snd_portman_card_private_free()
705 int dev = pdev->id; in snd_portman_probe()
720 return -ENODEV; in snd_portman_probe()
722 return -ENOENT; in snd_portman_probe()
724 err = snd_card_new(&pdev->dev, index[dev], id[dev], THIS_MODULE, in snd_portman_probe()
730 strcpy(card->driver, DRIVER_NAME); in snd_portman_probe()
731 strcpy(card->shortname, CARD_NAME); in snd_portman_probe()
732 sprintf(card->longname, "%s at 0x%lx, irq %i", in snd_portman_probe()
733 card->shortname, p->base, p->irq); in snd_portman_probe()
739 pdev->id); /* device number */ in snd_portman_probe()
742 err = -EIO; in snd_portman_probe()
748 snd_printd("Cannot claim parport 0x%lx\n", pardev->port->base); in snd_portman_probe()
749 err = -EIO; in snd_portman_probe()
757 card->private_data = pm; in snd_portman_probe()
758 card->private_free = snd_portman_card_private_free; in snd_portman_probe()
762 err = -EIO; in snd_portman_probe()
783 snd_printk(KERN_INFO "Portman 2x4 on 0x%lx\n", p->base); in snd_portman_probe()
840 return -EIO; in snd_portman_module_init()
845 return -ENODEV; in snd_portman_module_init()