diff options
Diffstat (limited to 'include/linux/serial_core.h')
-rw-r--r-- | include/linux/serial_core.h | 100 |
1 files changed, 13 insertions, 87 deletions
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index eadf33d0abba..b67305e3ad57 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -351,6 +351,7 @@ struct uart_port { | |||
351 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) | 351 | #define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) |
352 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) | 352 | #define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) |
353 | #define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) | 353 | #define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) |
354 | #define UPF_IIR_ONCE ((__force upf_t) (1 << 26)) | ||
354 | /* The exact UART type is known and should not be probed. */ | 355 | /* The exact UART type is known and should not be probed. */ |
355 | #define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) | 356 | #define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) |
356 | #define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) | 357 | #define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) |
@@ -483,10 +484,19 @@ static inline int uart_tx_stopped(struct uart_port *port) | |||
483 | /* | 484 | /* |
484 | * The following are helper functions for the low level drivers. | 485 | * The following are helper functions for the low level drivers. |
485 | */ | 486 | */ |
487 | |||
488 | extern void uart_handle_dcd_change(struct uart_port *uport, | ||
489 | unsigned int status); | ||
490 | extern void uart_handle_cts_change(struct uart_port *uport, | ||
491 | unsigned int status); | ||
492 | |||
493 | extern void uart_insert_char(struct uart_port *port, unsigned int status, | ||
494 | unsigned int overrun, unsigned int ch, unsigned int flag); | ||
495 | |||
496 | #ifdef SUPPORT_SYSRQ | ||
486 | static inline int | 497 | static inline int |
487 | uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) | 498 | uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) |
488 | { | 499 | { |
489 | #ifdef SUPPORT_SYSRQ | ||
490 | if (port->sysrq) { | 500 | if (port->sysrq) { |
491 | if (ch && time_before(jiffies, port->sysrq)) { | 501 | if (ch && time_before(jiffies, port->sysrq)) { |
492 | handle_sysrq(ch); | 502 | handle_sysrq(ch); |
@@ -495,11 +505,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) | |||
495 | } | 505 | } |
496 | port->sysrq = 0; | 506 | port->sysrq = 0; |
497 | } | 507 | } |
498 | #endif | ||
499 | return 0; | 508 | return 0; |
500 | } | 509 | } |
501 | #ifndef SUPPORT_SYSRQ | 510 | #else |
502 | #define uart_handle_sysrq_char(port,ch) uart_handle_sysrq_char(port, 0) | 511 | #define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; }) |
503 | #endif | 512 | #endif |
504 | 513 | ||
505 | /* | 514 | /* |
@@ -522,89 +531,6 @@ static inline int uart_handle_break(struct uart_port *port) | |||
522 | return 0; | 531 | return 0; |
523 | } | 532 | } |
524 | 533 | ||
525 | /** | ||
526 | * uart_handle_dcd_change - handle a change of carrier detect state | ||
527 | * @uport: uart_port structure for the open port | ||
528 | * @status: new carrier detect status, nonzero if active | ||
529 | */ | ||
530 | static inline void | ||
531 | uart_handle_dcd_change(struct uart_port *uport, unsigned int status) | ||
532 | { | ||
533 | struct uart_state *state = uport->state; | ||
534 | struct tty_port *port = &state->port; | ||
535 | struct tty_ldisc *ld = tty_ldisc_ref(port->tty); | ||
536 | struct pps_event_time ts; | ||
537 | |||
538 | if (ld && ld->ops->dcd_change) | ||
539 | pps_get_ts(&ts); | ||
540 | |||
541 | uport->icount.dcd++; | ||
542 | #ifdef CONFIG_HARD_PPS | ||
543 | if ((uport->flags & UPF_HARDPPS_CD) && status) | ||
544 | hardpps(); | ||
545 | #endif | ||
546 | |||
547 | if (port->flags & ASYNC_CHECK_CD) { | ||
548 | if (status) | ||
549 | wake_up_interruptible(&port->open_wait); | ||
550 | else if (port->tty) | ||
551 | tty_hangup(port->tty); | ||
552 | } | ||
553 | |||
554 | if (ld && ld->ops->dcd_change) | ||
555 | ld->ops->dcd_change(port->tty, status, &ts); | ||
556 | if (ld) | ||
557 | tty_ldisc_deref(ld); | ||
558 | } | ||
559 | |||
560 | /** | ||
561 | * uart_handle_cts_change - handle a change of clear-to-send state | ||
562 | * @uport: uart_port structure for the open port | ||
563 | * @status: new clear to send status, nonzero if active | ||
564 | */ | ||
565 | static inline void | ||
566 | uart_handle_cts_change(struct uart_port *uport, unsigned int status) | ||
567 | { | ||
568 | struct tty_port *port = &uport->state->port; | ||
569 | struct tty_struct *tty = port->tty; | ||
570 | |||
571 | uport->icount.cts++; | ||
572 | |||
573 | if (port->flags & ASYNC_CTS_FLOW) { | ||
574 | if (tty->hw_stopped) { | ||
575 | if (status) { | ||
576 | tty->hw_stopped = 0; | ||
577 | uport->ops->start_tx(uport); | ||
578 | uart_write_wakeup(uport); | ||
579 | } | ||
580 | } else { | ||
581 | if (!status) { | ||
582 | tty->hw_stopped = 1; | ||
583 | uport->ops->stop_tx(uport); | ||
584 | } | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | |||
589 | #include <linux/tty_flip.h> | ||
590 | |||
591 | static inline void | ||
592 | uart_insert_char(struct uart_port *port, unsigned int status, | ||
593 | unsigned int overrun, unsigned int ch, unsigned int flag) | ||
594 | { | ||
595 | struct tty_struct *tty = port->state->port.tty; | ||
596 | |||
597 | if ((status & port->ignore_status_mask & ~overrun) == 0) | ||
598 | tty_insert_flip_char(tty, ch, flag); | ||
599 | |||
600 | /* | ||
601 | * Overrun is special. Since it's reported immediately, | ||
602 | * it doesn't affect the current character. | ||
603 | */ | ||
604 | if (status & ~port->ignore_status_mask & overrun) | ||
605 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
606 | } | ||
607 | |||
608 | /* | 534 | /* |
609 | * UART_ENABLE_MS - determine if port should enable modem status irqs | 535 | * UART_ENABLE_MS - determine if port should enable modem status irqs |
610 | */ | 536 | */ |