Lines Matching refs: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; in dbc_tty_install() local
186 port = idr_find(&dbc_tty_minors, tty->index); in dbc_tty_install()
189 if (!port) in dbc_tty_install()
192 tty->driver_data = port; in dbc_tty_install()
194 return tty_port_install(&port->port, driver, tty); in dbc_tty_install()
199 struct dbc_port *port = tty->driver_data; in dbc_tty_open() local
201 return tty_port_open(&port->port, tty, file); in dbc_tty_open()
206 struct dbc_port *port = tty->driver_data; in dbc_tty_close() local
208 tty_port_close(&port->port, tty, file); in dbc_tty_close()
214 struct dbc_port *port = tty->driver_data; in dbc_tty_write() local
217 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_write()
219 count = kfifo_in(&port->write_fifo, buf, count); in dbc_tty_write()
220 dbc_start_tx(port); in dbc_tty_write()
221 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_write()
228 struct dbc_port *port = tty->driver_data; in dbc_tty_put_char() local
232 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_put_char()
233 status = kfifo_put(&port->write_fifo, ch); in dbc_tty_put_char()
234 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_put_char()
241 struct dbc_port *port = tty->driver_data; in dbc_tty_flush_chars() local
244 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_flush_chars()
245 dbc_start_tx(port); in dbc_tty_flush_chars()
246 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_flush_chars()
251 struct dbc_port *port = tty->driver_data; in dbc_tty_write_room() local
255 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_write_room()
256 room = kfifo_avail(&port->write_fifo); in dbc_tty_write_room()
257 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_write_room()
264 struct dbc_port *port = tty->driver_data; in dbc_tty_chars_in_buffer() local
268 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_chars_in_buffer()
269 chars = kfifo_len(&port->write_fifo); in dbc_tty_chars_in_buffer()
270 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_chars_in_buffer()
277 struct dbc_port *port = tty->driver_data; in dbc_tty_unthrottle() local
280 spin_lock_irqsave(&port->port_lock, flags); in dbc_tty_unthrottle()
281 tasklet_schedule(&port->push); in dbc_tty_unthrottle()
282 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_tty_unthrottle()
304 struct dbc_port *port = from_tasklet(port, t, push); in dbc_rx_push() local
305 struct list_head *queue = &port->read_queue; in dbc_rx_push()
307 spin_lock_irqsave(&port->port_lock, flags); in dbc_rx_push()
308 tty = port->port.tty; in dbc_rx_push()
332 n = port->n_read; in dbc_rx_push()
338 count = tty_insert_flip_string(&port->port, packet, in dbc_rx_push()
343 port->n_read += count; in dbc_rx_push()
346 port->n_read = 0; in dbc_rx_push()
349 list_move(&req->list_pool, &port->read_pool); in dbc_rx_push()
353 tty_flip_buffer_push(&port->port); in dbc_rx_push()
358 tasklet_schedule(&port->push); in dbc_rx_push()
365 dbc_start_rx(port); in dbc_rx_push()
367 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_rx_push()
373 struct dbc_port *port = container_of(_port, struct dbc_port, port); in dbc_port_activate() local
375 spin_lock_irqsave(&port->port_lock, flags); in dbc_port_activate()
376 dbc_start_rx(port); in dbc_port_activate()
377 spin_unlock_irqrestore(&port->port_lock, flags); in dbc_port_activate()
387 xhci_dbc_tty_init_port(struct xhci_dbc *dbc, struct dbc_port *port) in xhci_dbc_tty_init_port() argument
389 tty_port_init(&port->port); in xhci_dbc_tty_init_port()
390 spin_lock_init(&port->port_lock); in xhci_dbc_tty_init_port()
391 tasklet_setup(&port->push, dbc_rx_push); in xhci_dbc_tty_init_port()
392 INIT_LIST_HEAD(&port->read_pool); in xhci_dbc_tty_init_port()
393 INIT_LIST_HEAD(&port->read_queue); in xhci_dbc_tty_init_port()
394 INIT_LIST_HEAD(&port->write_pool); in xhci_dbc_tty_init_port()
396 port->port.ops = &dbc_port_ops; in xhci_dbc_tty_init_port()
397 port->n_read = 0; in xhci_dbc_tty_init_port()
401 xhci_dbc_tty_exit_port(struct dbc_port *port) in xhci_dbc_tty_exit_port() argument
403 tasklet_kill(&port->push); in xhci_dbc_tty_exit_port()
404 tty_port_destroy(&port->port); in xhci_dbc_tty_exit_port()
411 struct dbc_port *port = dbc_to_port(dbc); in xhci_dbc_tty_register_device() local
413 if (port->registered) in xhci_dbc_tty_register_device()
416 xhci_dbc_tty_init_port(dbc, port); in xhci_dbc_tty_register_device()
419 port->minor = idr_alloc(&dbc_tty_minors, port, 0, 64, GFP_KERNEL); in xhci_dbc_tty_register_device()
422 if (port->minor < 0) { in xhci_dbc_tty_register_device()
423 ret = port->minor; in xhci_dbc_tty_register_device()
427 ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL); in xhci_dbc_tty_register_device()
431 ret = xhci_dbc_alloc_requests(dbc, BULK_IN, &port->read_pool, in xhci_dbc_tty_register_device()
436 ret = xhci_dbc_alloc_requests(dbc, BULK_OUT, &port->write_pool, in xhci_dbc_tty_register_device()
441 tty_dev = tty_port_register_device(&port->port, in xhci_dbc_tty_register_device()
442 dbc_tty_driver, port->minor, NULL); in xhci_dbc_tty_register_device()
448 port->registered = true; in xhci_dbc_tty_register_device()
453 xhci_dbc_free_requests(&port->read_pool); in xhci_dbc_tty_register_device()
454 xhci_dbc_free_requests(&port->write_pool); in xhci_dbc_tty_register_device()
456 kfifo_free(&port->write_fifo); in xhci_dbc_tty_register_device()
458 idr_remove(&dbc_tty_minors, port->minor); in xhci_dbc_tty_register_device()
460 xhci_dbc_tty_exit_port(port); in xhci_dbc_tty_register_device()
469 struct dbc_port *port = dbc_to_port(dbc); in xhci_dbc_tty_unregister_device() local
471 if (!port->registered) in xhci_dbc_tty_unregister_device()
473 tty_unregister_device(dbc_tty_driver, port->minor); in xhci_dbc_tty_unregister_device()
474 xhci_dbc_tty_exit_port(port); in xhci_dbc_tty_unregister_device()
475 port->registered = false; in xhci_dbc_tty_unregister_device()
478 idr_remove(&dbc_tty_minors, port->minor); in xhci_dbc_tty_unregister_device()
481 kfifo_free(&port->write_fifo); in xhci_dbc_tty_unregister_device()
482 xhci_dbc_free_requests(&port->read_pool); in xhci_dbc_tty_unregister_device()
483 xhci_dbc_free_requests(&port->read_queue); in xhci_dbc_tty_unregister_device()
484 xhci_dbc_free_requests(&port->write_pool); in xhci_dbc_tty_unregister_device()
495 struct dbc_port *port; in xhci_dbc_tty_probe() local
501 port = kzalloc(sizeof(*port), GFP_KERNEL); in xhci_dbc_tty_probe()
502 if (!port) in xhci_dbc_tty_probe()
512 dbc->priv = port; in xhci_dbc_tty_probe()
519 kfree(port); in xhci_dbc_tty_probe()
530 struct dbc_port *port = dbc_to_port(dbc); in xhci_dbc_tty_remove() local
533 kfree(port); in xhci_dbc_tty_remove()