.. | .. |
---|
15 | 15 | #include <linux/moduleparam.h> |
---|
16 | 16 | #include <linux/ioport.h> |
---|
17 | 17 | #include <linux/init.h> |
---|
| 18 | +#include <linux/irq.h> |
---|
18 | 19 | #include <linux/console.h> |
---|
19 | 20 | #include <linux/gpio/consumer.h> |
---|
20 | 21 | #include <linux/sysrq.h> |
---|
.. | .. |
---|
1909 | 1910 | unsigned long flags; |
---|
1910 | 1911 | struct uart_8250_port *up = up_to_u8250p(port); |
---|
1911 | 1912 | #ifndef CONFIG_ARCH_ROCKCHIP |
---|
| 1913 | + struct tty_port *tport = &port->state->port; |
---|
1912 | 1914 | bool skip_rx = false; |
---|
1913 | 1915 | #endif |
---|
1914 | 1916 | |
---|
.. | .. |
---|
1944 | 1946 | skip_rx = true; |
---|
1945 | 1947 | |
---|
1946 | 1948 | if (status & (UART_LSR_DR | UART_LSR_BI) && !skip_rx) { |
---|
| 1949 | + struct irq_data *d; |
---|
| 1950 | + |
---|
| 1951 | + d = irq_get_irq_data(port->irq); |
---|
| 1952 | + if (d && irqd_is_wakeup_set(d)) |
---|
| 1953 | + pm_wakeup_event(tport->tty->dev, 0); |
---|
1947 | 1954 | if (!up->dma || handle_rx_dma(up, iir)) |
---|
1948 | 1955 | status = serial8250_rx_chars(up, status); |
---|
1949 | 1956 | } |
---|
.. | .. |
---|
2022 | 2029 | static unsigned int serial8250_tx_empty(struct uart_port *port) |
---|
2023 | 2030 | { |
---|
2024 | 2031 | struct uart_8250_port *up = up_to_u8250p(port); |
---|
| 2032 | + unsigned int result = 0; |
---|
2025 | 2033 | unsigned long flags; |
---|
2026 | 2034 | unsigned int lsr; |
---|
2027 | 2035 | |
---|
2028 | 2036 | serial8250_rpm_get(up); |
---|
2029 | 2037 | |
---|
2030 | 2038 | spin_lock_irqsave(&port->lock, flags); |
---|
2031 | | - lsr = serial_port_in(port, UART_LSR); |
---|
2032 | | - up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; |
---|
| 2039 | + if (!serial8250_tx_dma_running(up)) { |
---|
| 2040 | + lsr = serial_port_in(port, UART_LSR); |
---|
| 2041 | + up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS; |
---|
| 2042 | + |
---|
| 2043 | + if ((lsr & BOTH_EMPTY) == BOTH_EMPTY) |
---|
| 2044 | + result = TIOCSER_TEMT; |
---|
| 2045 | + } |
---|
2033 | 2046 | spin_unlock_irqrestore(&port->lock, flags); |
---|
2034 | 2047 | |
---|
2035 | 2048 | serial8250_rpm_put(up); |
---|
2036 | 2049 | |
---|
2037 | | - return (lsr & BOTH_EMPTY) == BOTH_EMPTY ? TIOCSER_TEMT : 0; |
---|
| 2050 | + return result; |
---|
2038 | 2051 | } |
---|
2039 | 2052 | |
---|
2040 | 2053 | unsigned int serial8250_do_get_mctrl(struct uart_port *port) |
---|
.. | .. |
---|
3326 | 3339 | struct uart_port *port = &up->port; |
---|
3327 | 3340 | |
---|
3328 | 3341 | spin_lock_init(&port->lock); |
---|
| 3342 | + port->pm = NULL; |
---|
3329 | 3343 | port->ops = &serial8250_pops; |
---|
3330 | 3344 | port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); |
---|
3331 | 3345 | |
---|