Lines Matching full:pm

77 static int portman_free(struct portman *pm)  in portman_free()  argument
79 kfree(pm); in portman_free()
87 struct portman *pm; in portman_create() local
91 pm = kzalloc(sizeof(struct portman), GFP_KERNEL); in portman_create()
92 if (pm == NULL) 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()
100 *rchip = pm; in portman_create()
180 static inline void portman_write_command(struct portman *pm, u8 value) in portman_write_command() argument
182 parport_write_control(pm->pardev->port, value); in portman_write_command()
185 static inline u8 portman_read_status(struct portman *pm) in portman_read_status() argument
187 return parport_read_status(pm->pardev->port); in portman_read_status()
190 static inline void portman_write_data(struct portman *pm, u8 value) in portman_write_data() argument
192 parport_write_data(pm->pardev->port, value); in portman_write_data()
195 static void portman_write_midi(struct portman *pm, in portman_write_midi() argument
217 portman_write_command(pm, command); in portman_write_midi()
223 portman_write_data(pm, mididata); in portman_write_midi()
228 } while ((portman_read_status(pm) & TXEMPTY) != TXEMPTY); in portman_write_midi()
235 portman_write_command(pm, command | STROBE); in portman_write_midi()
242 while ((portman_read_status(pm) & ESTB) == 0) in portman_write_midi()
246 portman_write_command(pm, command); in portman_write_midi()
248 while ((portman_read_status(pm) & ESTB) == ESTB) in portman_write_midi()
255 while ((portman_read_status(pm) & BUSY) == BUSY) in portman_write_midi()
267 static int portman_read_midi(struct portman *pm, int port) in portman_read_midi() argument
273 portman_write_data(pm, 0); /* Make sure edge is down. */ in portman_read_midi()
277 portman_write_command(pm, cmdout); in portman_read_midi()
279 while ((portman_read_status(pm) & ESTB) == ESTB) in portman_read_midi()
285 if ((portman_read_status(pm) & RXAVAIL) == 0) in portman_read_midi()
289 portman_write_command(pm, cmdout | STROBE); /* Write address+IE+Strobe. */ in portman_read_midi()
291 while ((portman_read_status(pm) & ESTB) == 0) in portman_read_midi()
295 midi_data = (portman_read_status(pm) & 128); in portman_read_midi()
296 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
299 portman_write_data(pm, 0); /* Cause falling edge while data settles. */ in portman_read_midi()
300 midi_data |= (portman_read_status(pm) >> 1) & 64; in portman_read_midi()
301 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
304 portman_write_data(pm, 0); /* Cause falling edge while data settles. */ in portman_read_midi()
305 midi_data |= (portman_read_status(pm) >> 2) & 32; in portman_read_midi()
306 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
309 portman_write_data(pm, 0); /* Cause falling edge while data settles. */ in portman_read_midi()
310 midi_data |= (portman_read_status(pm) >> 3) & 16; in portman_read_midi()
311 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
314 portman_write_data(pm, 0); /* Cause falling edge while data settles. */ in portman_read_midi()
315 midi_data |= (portman_read_status(pm) >> 4) & 8; in portman_read_midi()
316 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
319 portman_write_data(pm, 0); /* Cause falling edge while data settles. */ in portman_read_midi()
320 midi_data |= (portman_read_status(pm) >> 5) & 4; in portman_read_midi()
321 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
324 portman_write_data(pm, 0); /* Cause falling edge while data settles. */ in portman_read_midi()
325 midi_data |= (portman_read_status(pm) >> 6) & 2; in portman_read_midi()
326 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
329 portman_write_data(pm, 0); /* Cause falling edge while data settles. */ in portman_read_midi()
330 midi_data |= (portman_read_status(pm) >> 7) & 1; in portman_read_midi()
331 portman_write_data(pm, 1); /* Cause rising edge, which shifts data. */ in portman_read_midi()
332 portman_write_data(pm, 0); /* Return data clock low. */ in portman_read_midi()
336 portman_write_command(pm, cmdout); /* Output saved address+IE. */ in portman_read_midi()
339 while ((portman_read_status(pm) & ESTB) == ESTB) in portman_read_midi()
349 static int portman_data_avail(struct portman *pm, int channel) in portman_data_avail() argument
361 portman_write_command(pm, command); in portman_data_avail()
363 if ((portman_read_status(pm) & RXAVAIL) == RXAVAIL) in portman_data_avail()
374 static void portman_flush_input(struct portman *pm, unsigned char port) in portman_flush_input() argument
388 dev_warn(pm->card->dev, "%s Won't flush port %i\n", in portman_flush_input()
394 portman_write_command(pm, command); in portman_flush_input()
397 portman_write_command(pm, command | STROBE); in portman_flush_input()
400 while ((portman_read_status(pm) & ESTB) == 0) in portman_flush_input()
404 portman_write_data(pm, 0); in portman_flush_input()
408 portman_write_data(pm, 1); in portman_flush_input()
409 portman_write_data(pm, 0); in portman_flush_input()
413 portman_write_command(pm, command | INT_EN); in portman_flush_input()
416 while ((portman_read_status(pm) & ESTB) == ESTB) in portman_flush_input()
474 static int portman_device_init(struct portman *pm) in portman_device_init() argument
476 portman_flush_input(pm, 0); in portman_device_init()
477 portman_flush_input(pm, 1); in portman_device_init()
498 struct portman *pm = substream->rmidi->private_data; in snd_portman_midi_input_trigger() local
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() local
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() local
551 rmidi->private_data = pm; in snd_portman_rawmidi_create()
557 pm->rmidi = rmidi; in snd_portman_rawmidi_create()
577 pm->midi_input[substream->number] = substream; in snd_portman_rawmidi_create()
591 struct portman *pm = ((struct snd_card*)userdata)->private_data; in snd_portman_interrupt() local
593 spin_lock(&pm->reg_lock); in snd_portman_interrupt()
596 while ((portman_read_status(pm) & INT_REQ) == INT_REQ) { in snd_portman_interrupt()
599 if (portman_data_avail(pm, 0)) { in snd_portman_interrupt()
601 midivalue = portman_read_midi(pm, 0); 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()
610 if (portman_data_avail(pm, 1)) { in snd_portman_interrupt()
612 midivalue = portman_read_midi(pm, 1); 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()
677 struct portman *pm = card->private_data; in snd_portman_card_private_free() local
678 struct pardevice *pardev = pm->pardev; in snd_portman_card_private_free()
685 portman_free(pm); in snd_portman_card_private_free()
694 struct portman *pm = NULL; in snd_portman_probe() local
740 err = portman_create(card, pardev, &pm); in snd_portman_probe()
745 card->private_data = pm; in snd_portman_probe()
761 err = portman_device_init(pm); in snd_portman_probe()