Lines Matching refs:pp
98 static inline void pp_enable_irq (struct pp_struct *pp) in pp_enable_irq() argument
100 struct parport *port = pp->pdev->port; in pp_enable_irq()
108 struct pp_struct *pp = file->private_data; in pp_read() local
114 if (!(pp->flags & PP_CLAIMED)) { in pp_read()
129 pport = pp->pdev->port; in pp_read()
132 parport_set_timeout (pp->pdev, in pp_read()
135 pp->default_inactivity); in pp_read()
145 if (pp->flags & PP_W91284PIC) { in pp_read()
148 if (pp->flags & PP_FASTREAD) { in pp_read()
178 parport_set_timeout (pp->pdev, pp->default_inactivity); in pp_read()
184 pp_enable_irq (pp); in pp_read()
192 struct pp_struct *pp = file->private_data; in pp_write() local
199 if (!(pp->flags & PP_CLAIMED)) { in pp_write()
210 pport = pp->pdev->port; in pp_write()
213 parport_set_timeout (pp->pdev, in pp_write()
216 pp->default_inactivity); in pp_write()
226 if ((pp->flags & PP_FASTWRITE) && (mode == IEEE1284_MODE_EPP)) { in pp_write()
236 wrote = parport_write (pp->pdev->port, kbuffer, n); in pp_write()
266 parport_set_timeout (pp->pdev, pp->default_inactivity); in pp_write()
269 pp_enable_irq (pp); in pp_write()
275 struct pp_struct * pp = (struct pp_struct *) private; in pp_irq() local
277 if (pp->irqresponse) { in pp_irq()
278 parport_write_control (pp->pdev->port, pp->irqctl); in pp_irq()
279 pp->irqresponse = 0; in pp_irq()
282 atomic_inc (&pp->irqc); in pp_irq()
283 wake_up_interruptible (&pp->irq_wait); in pp_irq()
286 static int register_device (int minor, struct pp_struct *pp) in register_device() argument
306 fl = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0; in register_device()
308 NULL, pp_irq, fl, pp); in register_device()
317 pp->pdev = pdev; in register_device()
337 struct pp_struct *pp = file->private_data; in pp_ioctl() local
347 if (pp->flags & PP_CLAIMED) { in pp_ioctl()
354 if (!pp->pdev) { in pp_ioctl()
355 int err = register_device (minor, pp); in pp_ioctl()
361 ret = parport_claim_or_block (pp->pdev); in pp_ioctl()
365 pp->flags |= PP_CLAIMED; in pp_ioctl()
369 pp_enable_irq (pp); in pp_ioctl()
372 info = &pp->pdev->port->ieee1284; in pp_ioctl()
373 pp->saved_state.mode = info->mode; in pp_ioctl()
374 pp->saved_state.phase = info->phase; in pp_ioctl()
375 info->mode = pp->state.mode; in pp_ioctl()
376 info->phase = pp->state.phase; in pp_ioctl()
377 pp->default_inactivity = parport_set_timeout (pp->pdev, 0); in pp_ioctl()
378 parport_set_timeout (pp->pdev, pp->default_inactivity); in pp_ioctl()
383 if (pp->pdev) { in pp_ioctl()
386 if (pp->flags & PP_EXCL) in pp_ioctl()
395 pp->flags |= PP_EXCL; in pp_ioctl()
403 pp->state.mode = mode; in pp_ioctl()
404 pp->state.phase = init_phase (mode); in pp_ioctl()
406 if (pp->flags & PP_CLAIMED) { in pp_ioctl()
407 pp->pdev->port->ieee1284.mode = mode; in pp_ioctl()
408 pp->pdev->port->ieee1284.phase = pp->state.phase; in pp_ioctl()
417 if (pp->flags & PP_CLAIMED) { in pp_ioctl()
418 mode = pp->pdev->port->ieee1284.mode; in pp_ioctl()
420 mode = pp->state.mode; in pp_ioctl()
434 pp->state.phase = phase; in pp_ioctl()
436 if (pp->flags & PP_CLAIMED) { in pp_ioctl()
437 pp->pdev->port->ieee1284.phase = phase; in pp_ioctl()
446 if (pp->flags & PP_CLAIMED) { in pp_ioctl()
447 phase = pp->pdev->port->ieee1284.phase; in pp_ioctl()
449 phase = pp->state.phase; in pp_ioctl()
477 pp->flags &= ~PP_FLAGMASK; in pp_ioctl()
478 pp->flags |= (uflags & PP_FLAGMASK); in pp_ioctl()
485 uflags = pp->flags & PP_FLAGMASK; in pp_ioctl()
495 if ((pp->flags & PP_CLAIMED) == 0) { in pp_ioctl()
501 port = pp->pdev->port; in pp_ioctl()
527 parport_yield_blocking (pp->pdev); in pp_ioctl()
532 info = &pp->pdev->port->ieee1284; in pp_ioctl()
533 pp->state.mode = info->mode; in pp_ioctl()
534 pp->state.phase = info->phase; in pp_ioctl()
535 info->mode = pp->saved_state.mode; in pp_ioctl()
536 info->phase = pp->saved_state.phase; in pp_ioctl()
537 parport_release (pp->pdev); in pp_ioctl()
538 pp->flags &= ~PP_CLAIMED; in pp_ioctl()
584 pp_enable_irq (pp); in pp_ioctl()
594 pp->irqctl = reg; in pp_ioctl()
595 pp->irqresponse = 1; in pp_ioctl()
599 ret = atomic_read (&pp->irqc); in pp_ioctl()
602 atomic_sub (ret, &pp->irqc); in pp_ioctl()
619 pp->pdev->timeout = to_jiffies; in pp_ioctl()
623 to_jiffies = pp->pdev->timeout; in pp_ioctl()
645 struct pp_struct *pp; in pp_open() local
650 pp = kmalloc (sizeof (struct pp_struct), GFP_KERNEL); in pp_open()
651 if (!pp) in pp_open()
654 pp->state.mode = IEEE1284_MODE_COMPAT; in pp_open()
655 pp->state.phase = init_phase (pp->state.mode); in pp_open()
656 pp->flags = 0; in pp_open()
657 pp->irqresponse = 0; in pp_open()
658 atomic_set (&pp->irqc, 0); in pp_open()
659 init_waitqueue_head (&pp->irq_wait); in pp_open()
665 pp->pdev = NULL; in pp_open()
666 file->private_data = pp; in pp_open()
674 struct pp_struct *pp = file->private_data; in pp_release() local
679 if (!(pp->flags & PP_CLAIMED) && pp->pdev && in pp_release()
680 (pp->state.mode != IEEE1284_MODE_COMPAT)) { in pp_release()
684 parport_claim_or_block (pp->pdev); in pp_release()
685 pp->flags |= PP_CLAIMED; in pp_release()
686 info = &pp->pdev->port->ieee1284; in pp_release()
687 pp->saved_state.mode = info->mode; in pp_release()
688 pp->saved_state.phase = info->phase; in pp_release()
689 info->mode = pp->state.mode; in pp_release()
690 info->phase = pp->state.phase; in pp_release()
692 } else if ((pp->flags & PP_CLAIMED) && pp->pdev && in pp_release()
693 (pp->pdev->port->ieee1284.mode != IEEE1284_MODE_COMPAT)) { in pp_release()
697 parport_negotiate (pp->pdev->port, IEEE1284_MODE_COMPAT); in pp_release()
703 if (pp->flags & PP_CLAIMED) { in pp_release()
706 info = &pp->pdev->port->ieee1284; in pp_release()
707 pp->state.mode = info->mode; in pp_release()
708 pp->state.phase = info->phase; in pp_release()
709 info->mode = pp->saved_state.mode; in pp_release()
710 info->phase = pp->saved_state.phase; in pp_release()
711 parport_release (pp->pdev); in pp_release()
718 if (pp->pdev) { in pp_release()
719 const char *name = pp->pdev->name; in pp_release()
720 parport_unregister_device (pp->pdev); in pp_release()
722 pp->pdev = NULL; in pp_release()
728 kfree (pp); in pp_release()
736 struct pp_struct *pp = file->private_data; in pp_poll() local
739 poll_wait (file, &pp->irq_wait, wait); in pp_poll()
740 if (atomic_read (&pp->irqc)) in pp_poll()