diff options
-rw-r--r-- | drivers/serial/8250.c | 27 | ||||
-rw-r--r-- | include/linux/serial_8250.h | 4 | ||||
-rw-r--r-- | include/linux/serial_core.h | 2 |
3 files changed, 22 insertions, 11 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index b586406f04ca..6994afb5571a 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -154,12 +154,6 @@ struct uart_8250_port { | |||
154 | unsigned char lsr_saved_flags; | 154 | unsigned char lsr_saved_flags; |
155 | #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA | 155 | #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA |
156 | unsigned char msr_saved_flags; | 156 | unsigned char msr_saved_flags; |
157 | |||
158 | /* | ||
159 | * We provide a per-port pm hook. | ||
160 | */ | ||
161 | void (*pm)(struct uart_port *port, | ||
162 | unsigned int state, unsigned int old); | ||
163 | }; | 157 | }; |
164 | 158 | ||
165 | struct irq_info { | 159 | struct irq_info { |
@@ -2436,16 +2430,24 @@ serial8250_set_ldisc(struct uart_port *port, int new) | |||
2436 | port->flags &= ~UPF_HARDPPS_CD; | 2430 | port->flags &= ~UPF_HARDPPS_CD; |
2437 | } | 2431 | } |
2438 | 2432 | ||
2439 | static void | 2433 | |
2440 | serial8250_pm(struct uart_port *port, unsigned int state, | 2434 | void serial8250_do_pm(struct uart_port *port, unsigned int state, |
2441 | unsigned int oldstate) | 2435 | unsigned int oldstate) |
2442 | { | 2436 | { |
2443 | struct uart_8250_port *p = (struct uart_8250_port *)port; | 2437 | struct uart_8250_port *p = (struct uart_8250_port *)port; |
2444 | 2438 | ||
2445 | serial8250_set_sleep(p, state != 0); | 2439 | serial8250_set_sleep(p, state != 0); |
2440 | } | ||
2441 | EXPORT_SYMBOL(serial8250_do_pm); | ||
2446 | 2442 | ||
2447 | if (p->pm) | 2443 | static void |
2448 | p->pm(port, state, oldstate); | 2444 | serial8250_pm(struct uart_port *port, unsigned int state, |
2445 | unsigned int oldstate) | ||
2446 | { | ||
2447 | if (port->pm) | ||
2448 | port->pm(port, state, oldstate); | ||
2449 | else | ||
2450 | serial8250_do_pm(port, state, oldstate); | ||
2449 | } | 2451 | } |
2450 | 2452 | ||
2451 | static unsigned int serial8250_port_size(struct uart_8250_port *pt) | 2453 | static unsigned int serial8250_port_size(struct uart_8250_port *pt) |
@@ -3006,6 +3008,7 @@ static int __devinit serial8250_probe(struct platform_device *dev) | |||
3006 | port.serial_in = p->serial_in; | 3008 | port.serial_in = p->serial_in; |
3007 | port.serial_out = p->serial_out; | 3009 | port.serial_out = p->serial_out; |
3008 | port.set_termios = p->set_termios; | 3010 | port.set_termios = p->set_termios; |
3011 | port.pm = p->pm; | ||
3009 | port.dev = &dev->dev; | 3012 | port.dev = &dev->dev; |
3010 | port.irqflags |= irqflag; | 3013 | port.irqflags |= irqflag; |
3011 | ret = serial8250_register_port(&port); | 3014 | ret = serial8250_register_port(&port); |
@@ -3172,6 +3175,8 @@ int serial8250_register_port(struct uart_port *port) | |||
3172 | /* Possibly override set_termios call */ | 3175 | /* Possibly override set_termios call */ |
3173 | if (port->set_termios) | 3176 | if (port->set_termios) |
3174 | uart->port.set_termios = port->set_termios; | 3177 | uart->port.set_termios = port->set_termios; |
3178 | if (port->pm) | ||
3179 | uart->port.pm = port->pm; | ||
3175 | 3180 | ||
3176 | ret = uart_add_one_port(&serial8250_reg, &uart->port); | 3181 | ret = uart_add_one_port(&serial8250_reg, &uart->port); |
3177 | if (ret == 0) | 3182 | if (ret == 0) |
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 7638deaaba65..bf9c2bdb2e05 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
@@ -35,6 +35,8 @@ struct plat_serial8250_port { | |||
35 | void (*set_termios)(struct uart_port *, | 35 | void (*set_termios)(struct uart_port *, |
36 | struct ktermios *new, | 36 | struct ktermios *new, |
37 | struct ktermios *old); | 37 | struct ktermios *old); |
38 | void (*pm)(struct uart_port *, unsigned int state, | ||
39 | unsigned old); | ||
38 | }; | 40 | }; |
39 | 41 | ||
40 | /* | 42 | /* |
@@ -76,5 +78,7 @@ extern int serial8250_find_port_for_earlycon(void); | |||
76 | extern int setup_early_serial8250_console(char *cmdline); | 78 | extern int setup_early_serial8250_console(char *cmdline); |
77 | extern void serial8250_do_set_termios(struct uart_port *port, | 79 | extern void serial8250_do_set_termios(struct uart_port *port, |
78 | struct ktermios *termios, struct ktermios *old); | 80 | struct ktermios *termios, struct ktermios *old); |
81 | extern void serial8250_do_pm(struct uart_port *port, unsigned int state, | ||
82 | unsigned int oldstate); | ||
79 | 83 | ||
80 | #endif | 84 | #endif |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index ac48082f3559..99e5994e6f84 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -289,6 +289,8 @@ struct uart_port { | |||
289 | void (*set_termios)(struct uart_port *, | 289 | void (*set_termios)(struct uart_port *, |
290 | struct ktermios *new, | 290 | struct ktermios *new, |
291 | struct ktermios *old); | 291 | struct ktermios *old); |
292 | void (*pm)(struct uart_port *, unsigned int state, | ||
293 | unsigned int old); | ||
292 | unsigned int irq; /* irq number */ | 294 | unsigned int irq; /* irq number */ |
293 | unsigned long irqflags; /* irq flags */ | 295 | unsigned long irqflags; /* irq flags */ |
294 | unsigned int uartclk; /* base uart clock */ | 296 | unsigned int uartclk; /* base uart clock */ |