Lines Matching full:port
28 dbc_send_packet(struct dbc_port *port, char *packet, unsigned int size) in dbc_send_packet() argument
32 len = kfifo_len(&port->write_fifo); in dbc_send_packet()
36 size = kfifo_out(&port->write_fifo, packet, size); in dbc_send_packet()
40 static int dbc_start_tx(struct dbc_port *port) in dbc_start_tx() argument
41 __releases(&port->port_lock) in dbc_start_tx()
42 __acquires(&port->port_lock) in dbc_start_tx()
48 struct list_head *pool = &port->write_pool; in dbc_start_tx()
52 len = dbc_send_packet(port, req->buf, DBC_MAX_PACKET); in dbc_start_tx()
60 spin_unlock(&port->port_lock); in dbc_start_tx()
62 spin_lock(&port->port_lock); in dbc_start_tx()
70 if (do_tty_wake && port->port.tty) in dbc_start_tx()
71 tty_wakeup(port->port.tty); in dbc_start_tx()
76 static void dbc_start_rx(struct dbc_port *port) in dbc_start_rx() argument
77 __releases(&port->port_lock) in dbc_start_rx()
78 __acquires(&port->port_lock) in dbc_start_rx()
82 struct list_head *pool = &port->read_pool; in dbc_start_rx()
85 if (!port->port.tty) in dbc_start_rx()
92 spin_unlock(&port->port_lock); in dbc_start_rx()
94 spin_lock(&port->port_lock); in dbc_start_rx()
107 struct dbc_port *port = dbc_to_port(dbc); in dbc_read_complete() local
109 spin_lock_irqsave(&port->port_lock, flags); in dbc_read_complete()
110 list_add_tail(&req->list_pool, &port->read_queue); in dbc_read_complete()
111 tasklet_schedule(&port->push); in dbc_read_complete()
112 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_read_complete()
118 struct dbc_port *port = dbc_to_port(dbc); in dbc_write_complete() local
120 spin_lock_irqsave(&port->port_lock, flags); in dbc_write_complete()
121 list_add(&req->list_pool, &port->write_pool); in dbc_write_complete()
124 dbc_start_tx(port); in dbc_write_complete()
133 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_write_complete()
183 struct dbc_port *port = driver->driver_state; in dbc_tty_install() local
185 tty->driver_data = port; in dbc_tty_install()
187 return tty_port_install(&port->port, driver, tty); in dbc_tty_install()
192 struct dbc_port *port = tty->driver_data; in dbc_tty_open() local
194 return tty_port_open(&port->port, tty, file); in dbc_tty_open()
199 struct dbc_port *port = tty->driver_data; in dbc_tty_close() local
201 tty_port_close(&port->port, tty, file); in dbc_tty_close()
208 struct dbc_port *port = tty->driver_data; in dbc_tty_write() local
211 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_write()
213 count = kfifo_in(&port->write_fifo, buf, count); in dbc_tty_write()
214 dbc_start_tx(port); in dbc_tty_write()
215 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_write()
222 struct dbc_port *port = tty->driver_data; in dbc_tty_put_char() local
226 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_put_char()
227 status = kfifo_put(&port->write_fifo, ch); in dbc_tty_put_char()
228 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_put_char()
235 struct dbc_port *port = tty->driver_data; in dbc_tty_flush_chars() local
238 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_flush_chars()
239 dbc_start_tx(port); in dbc_tty_flush_chars()
240 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_flush_chars()
245 struct dbc_port *port = tty->driver_data; in dbc_tty_write_room() local
249 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_write_room()
250 room = kfifo_avail(&port->write_fifo); in dbc_tty_write_room()
251 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_write_room()
258 struct dbc_port *port = tty->driver_data; in dbc_tty_chars_in_buffer() local
262 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_chars_in_buffer()
263 chars = kfifo_len(&port->write_fifo); in dbc_tty_chars_in_buffer()
264 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_chars_in_buffer()
271 struct dbc_port *port = tty->driver_data; in dbc_tty_unthrottle() local
274 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_unthrottle()
275 tasklet_schedule(&port->push); in dbc_tty_unthrottle()
276 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_unthrottle()
298 struct dbc_port *port = from_tasklet(port, t, push); in dbc_rx_push() local
299 struct list_head *queue = &port->read_queue; in dbc_rx_push()
301 spin_lock_irqsave(&port->port_lock, flags); in dbc_rx_push()
302 tty = port->port.tty; in dbc_rx_push()
326 n = port->n_read; in dbc_rx_push()
332 count = tty_insert_flip_string(&port->port, packet, in dbc_rx_push()
337 port->n_read += count; in dbc_rx_push()
340 port->n_read = 0; in dbc_rx_push()
343 list_move(&req->list_pool, &port->read_pool); in dbc_rx_push()
347 tty_flip_buffer_push(&port->port); in dbc_rx_push()
352 tasklet_schedule(&port->push); in dbc_rx_push()
359 dbc_start_rx(port); in dbc_rx_push()
361 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_rx_push()
367 struct dbc_port *port = container_of(_port, struct dbc_port, port); in dbc_port_activate() local
369 spin_lock_irqsave(&port->port_lock, flags); in dbc_port_activate()
370 dbc_start_rx(port); in dbc_port_activate()
371 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_port_activate()
381 xhci_dbc_tty_init_port(struct xhci_dbc *dbc, struct dbc_port *port) in xhci_dbc_tty_init_port() argument
383 tty_port_init(&port->port); in xhci_dbc_tty_init_port()
384 spin_lock_init(&port->port_lock); in xhci_dbc_tty_init_port()
385 tasklet_setup(&port->push, dbc_rx_push); in xhci_dbc_tty_init_port()
386 INIT_LIST_HEAD(&port->read_pool); in xhci_dbc_tty_init_port()
387 INIT_LIST_HEAD(&port->read_queue); in xhci_dbc_tty_init_port()
388 INIT_LIST_HEAD(&port->write_pool); in xhci_dbc_tty_init_port()
390 port->port.ops = &dbc_port_ops; in xhci_dbc_tty_init_port()
391 port->n_read = 0; in xhci_dbc_tty_init_port()
395 xhci_dbc_tty_exit_port(struct dbc_port *port) in xhci_dbc_tty_exit_port() argument
397 tasklet_kill(&port->push); in xhci_dbc_tty_exit_port()
398 tty_port_destroy(&port->port); in xhci_dbc_tty_exit_port()
405 struct dbc_port *port = dbc_to_port(dbc); in xhci_dbc_tty_register_device() local
407 if (port->registered) in xhci_dbc_tty_register_device()
410 xhci_dbc_tty_init_port(dbc, port); in xhci_dbc_tty_register_device()
412 ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL); in xhci_dbc_tty_register_device()
416 ret = xhci_dbc_alloc_requests(dbc, BULK_IN, &port->read_pool, in xhci_dbc_tty_register_device()
421 ret = xhci_dbc_alloc_requests(dbc, BULK_OUT, &port->write_pool, in xhci_dbc_tty_register_device()
426 tty_dev = tty_port_register_device(&port->port, in xhci_dbc_tty_register_device()
433 port->registered = true; in xhci_dbc_tty_register_device()
438 xhci_dbc_free_requests(&port->read_pool); in xhci_dbc_tty_register_device()
439 xhci_dbc_free_requests(&port->write_pool); in xhci_dbc_tty_register_device()
441 kfifo_free(&port->write_fifo); in xhci_dbc_tty_register_device()
443 xhci_dbc_tty_exit_port(port); in xhci_dbc_tty_register_device()
445 dev_err(dbc->dev, "can't register tty port, err %d\n", ret); in xhci_dbc_tty_register_device()
452 struct dbc_port *port = dbc_to_port(dbc); in xhci_dbc_tty_unregister_device() local
454 if (!port->registered) in xhci_dbc_tty_unregister_device()
457 xhci_dbc_tty_exit_port(port); in xhci_dbc_tty_unregister_device()
458 port->registered = false; in xhci_dbc_tty_unregister_device()
460 kfifo_free(&port->write_fifo); in xhci_dbc_tty_unregister_device()
461 xhci_dbc_free_requests(&port->read_pool); in xhci_dbc_tty_unregister_device()
462 xhci_dbc_free_requests(&port->read_queue); in xhci_dbc_tty_unregister_device()
463 xhci_dbc_free_requests(&port->write_pool); in xhci_dbc_tty_unregister_device()
474 struct dbc_port *port; in xhci_dbc_tty_probe() local
482 port = kzalloc(sizeof(*port), GFP_KERNEL); in xhci_dbc_tty_probe()
483 if (!port) { in xhci_dbc_tty_probe()
489 dbc->priv = port; in xhci_dbc_tty_probe()
492 dbc_tty_driver->driver_state = port; in xhci_dbc_tty_probe()
507 struct dbc_port *port = dbc_to_port(dbc); in xhci_dbc_tty_remove() local
511 kfree(port); in xhci_dbc_tty_remove()