Lines Matching full:port

18 dbc_send_packet(struct dbc_port *port, char *packet, unsigned int size)  in dbc_send_packet()  argument
22 len = kfifo_len(&port->write_fifo); in dbc_send_packet()
26 size = kfifo_out(&port->write_fifo, packet, size); in dbc_send_packet()
30 static int dbc_start_tx(struct dbc_port *port) in dbc_start_tx() argument
31 __releases(&port->port_lock) in dbc_start_tx()
32 __acquires(&port->port_lock) in dbc_start_tx()
38 struct list_head *pool = &port->write_pool; in dbc_start_tx()
42 len = dbc_send_packet(port, req->buf, DBC_MAX_PACKET); in dbc_start_tx()
50 spin_unlock(&port->port_lock); in dbc_start_tx()
51 status = dbc_ep_queue(port->out, req, GFP_ATOMIC); in dbc_start_tx()
52 spin_lock(&port->port_lock); in dbc_start_tx()
60 if (do_tty_wake && port->port.tty) in dbc_start_tx()
61 tty_wakeup(port->port.tty); in dbc_start_tx()
66 static void dbc_start_rx(struct dbc_port *port) in dbc_start_rx() argument
67 __releases(&port->port_lock) in dbc_start_rx()
68 __acquires(&port->port_lock) in dbc_start_rx()
72 struct list_head *pool = &port->read_pool; in dbc_start_rx()
75 if (!port->port.tty) in dbc_start_rx()
82 spin_unlock(&port->port_lock); in dbc_start_rx()
83 status = dbc_ep_queue(port->in, req, GFP_ATOMIC); in dbc_start_rx()
84 spin_lock(&port->port_lock); in dbc_start_rx()
98 struct dbc_port *port = &dbc->port; in dbc_read_complete() local
100 spin_lock_irqsave(&port->port_lock, flags); in dbc_read_complete()
101 list_add_tail(&req->list_pool, &port->read_queue); in dbc_read_complete()
102 tasklet_schedule(&port->push); in dbc_read_complete()
103 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_read_complete()
110 struct dbc_port *port = &dbc->port; in dbc_write_complete() local
112 spin_lock_irqsave(&port->port_lock, flags); in dbc_write_complete()
113 list_add(&req->list_pool, &port->write_pool); in dbc_write_complete()
116 dbc_start_tx(port); in dbc_write_complete()
125 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_write_complete()
174 struct dbc_port *port = driver->driver_state; in dbc_tty_install() local
176 tty->driver_data = port; in dbc_tty_install()
178 return tty_port_install(&port->port, driver, tty); in dbc_tty_install()
183 struct dbc_port *port = tty->driver_data; in dbc_tty_open() local
185 return tty_port_open(&port->port, tty, file); in dbc_tty_open()
190 struct dbc_port *port = tty->driver_data; in dbc_tty_close() local
192 tty_port_close(&port->port, tty, file); in dbc_tty_close()
199 struct dbc_port *port = tty->driver_data; in dbc_tty_write() local
202 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_write()
204 count = kfifo_in(&port->write_fifo, buf, count); in dbc_tty_write()
205 dbc_start_tx(port); in dbc_tty_write()
206 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_write()
213 struct dbc_port *port = tty->driver_data; in dbc_tty_put_char() local
217 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_put_char()
218 status = kfifo_put(&port->write_fifo, ch); in dbc_tty_put_char()
219 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_put_char()
226 struct dbc_port *port = tty->driver_data; in dbc_tty_flush_chars() local
229 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_flush_chars()
230 dbc_start_tx(port); in dbc_tty_flush_chars()
231 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_flush_chars()
236 struct dbc_port *port = tty->driver_data; in dbc_tty_write_room() local
240 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_write_room()
241 room = kfifo_avail(&port->write_fifo); in dbc_tty_write_room()
242 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_write_room()
249 struct dbc_port *port = tty->driver_data; in dbc_tty_chars_in_buffer() local
253 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_chars_in_buffer()
254 chars = kfifo_len(&port->write_fifo); in dbc_tty_chars_in_buffer()
255 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_chars_in_buffer()
262 struct dbc_port *port = tty->driver_data; in dbc_tty_unthrottle() local
265 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_unthrottle()
266 tasklet_schedule(&port->push); in dbc_tty_unthrottle()
267 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_unthrottle()
307 dbc_tty_driver->driver_state = &dbc->port; in xhci_dbc_tty_register_driver()
338 struct dbc_port *port = (void *)_port; in dbc_rx_push() local
339 struct list_head *queue = &port->read_queue; in dbc_rx_push()
341 spin_lock_irqsave(&port->port_lock, flags); in dbc_rx_push()
342 tty = port->port.tty; in dbc_rx_push()
366 n = port->n_read; in dbc_rx_push()
372 count = tty_insert_flip_string(&port->port, packet, in dbc_rx_push()
377 port->n_read += count; in dbc_rx_push()
380 port->n_read = 0; in dbc_rx_push()
383 list_move(&req->list_pool, &port->read_pool); in dbc_rx_push()
387 tty_flip_buffer_push(&port->port); in dbc_rx_push()
392 tasklet_schedule(&port->push); in dbc_rx_push()
399 dbc_start_rx(port); in dbc_rx_push()
401 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_rx_push()
407 struct dbc_port *port = container_of(_port, struct dbc_port, port); in dbc_port_activate() local
409 spin_lock_irqsave(&port->port_lock, flags); in dbc_port_activate()
410 dbc_start_rx(port); in dbc_port_activate()
411 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_port_activate()
421 xhci_dbc_tty_init_port(struct xhci_hcd *xhci, struct dbc_port *port) in xhci_dbc_tty_init_port() argument
423 tty_port_init(&port->port); in xhci_dbc_tty_init_port()
424 spin_lock_init(&port->port_lock); in xhci_dbc_tty_init_port()
425 tasklet_init(&port->push, dbc_rx_push, (unsigned long)port); in xhci_dbc_tty_init_port()
426 INIT_LIST_HEAD(&port->read_pool); in xhci_dbc_tty_init_port()
427 INIT_LIST_HEAD(&port->read_queue); in xhci_dbc_tty_init_port()
428 INIT_LIST_HEAD(&port->write_pool); in xhci_dbc_tty_init_port()
430 port->in = get_in_ep(xhci); in xhci_dbc_tty_init_port()
431 port->out = get_out_ep(xhci); in xhci_dbc_tty_init_port()
432 port->port.ops = &dbc_port_ops; in xhci_dbc_tty_init_port()
433 port->n_read = 0; in xhci_dbc_tty_init_port()
437 xhci_dbc_tty_exit_port(struct dbc_port *port) in xhci_dbc_tty_exit_port() argument
439 tasklet_kill(&port->push); in xhci_dbc_tty_exit_port()
440 tty_port_destroy(&port->port); in xhci_dbc_tty_exit_port()
448 struct dbc_port *port = &dbc->port; in xhci_dbc_tty_register_device() local
450 xhci_dbc_tty_init_port(xhci, port); in xhci_dbc_tty_register_device()
451 tty_dev = tty_port_register_device(&port->port, in xhci_dbc_tty_register_device()
458 ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL); in xhci_dbc_tty_register_device()
462 ret = xhci_dbc_alloc_requests(port->in, &port->read_pool, in xhci_dbc_tty_register_device()
467 ret = xhci_dbc_alloc_requests(port->out, &port->write_pool, in xhci_dbc_tty_register_device()
472 port->registered = true; in xhci_dbc_tty_register_device()
477 xhci_dbc_free_requests(port->in, &port->read_pool); in xhci_dbc_tty_register_device()
478 xhci_dbc_free_requests(port->out, &port->write_pool); in xhci_dbc_tty_register_device()
479 kfifo_free(&port->write_fifo); in xhci_dbc_tty_register_device()
485 xhci_dbc_tty_exit_port(port); in xhci_dbc_tty_register_device()
487 xhci_err(xhci, "can't register tty port, err %d\n", ret); in xhci_dbc_tty_register_device()
495 struct dbc_port *port = &dbc->port; in xhci_dbc_tty_unregister_device() local
498 xhci_dbc_tty_exit_port(port); in xhci_dbc_tty_unregister_device()
499 port->registered = false; in xhci_dbc_tty_unregister_device()
501 kfifo_free(&port->write_fifo); in xhci_dbc_tty_unregister_device()
502 xhci_dbc_free_requests(get_out_ep(xhci), &port->read_pool); in xhci_dbc_tty_unregister_device()
503 xhci_dbc_free_requests(get_out_ep(xhci), &port->read_queue); in xhci_dbc_tty_unregister_device()
504 xhci_dbc_free_requests(get_in_ep(xhci), &port->write_pool); in xhci_dbc_tty_unregister_device()