Commit 90a2f98b authored by Russell King's avatar Russell King Committed by Linus Torvalds

[SERIAL] Add PCI serial power management support.

parent 1ae23b0d
......@@ -93,13 +93,15 @@ unsigned int share_irqs = SERIAL8250_SHARE_IRQS;
#ifdef CONFIG_SERIAL_8250_MULTIPORT
#define CONFIG_SERIAL_MULTIPORT 1
#endif
#ifdef CONFIG_SERIAL_8250_MANY_PORTS
#define CONFIG_SERIAL_MANY_PORTS 1
#endif
/*
* HUB6 is always on. This will be removed once the header
* files have been cleaned.
*/
#define CONFIG_HUB6 1
#define CONFIG_SERIAL_MANY_PORTS 1
#include <asm/serial.h>
......@@ -2094,6 +2096,28 @@ void serial8250_get_irq_map(unsigned int *map)
}
}
/**
* serial8250_suspend_port - suspend one serial port
* @line: serial line number
*
* Suspend one serial port.
*/
void serial8250_suspend_port(int line, u32 level)
{
uart_suspend_port(&serial8250_reg, &serial8250_ports[line].port, level);
}
/**
* serial8250_resume_port - resume one serial port
* @line: serial line number
*
* Resume one serial port.
*/
void serial8250_resume_port(int line, u32 level)
{
uart_resume_port(&serial8250_reg, &serial8250_ports[line].port, level);
}
static int __init serial8250_init(void)
{
int ret, i;
......@@ -2127,6 +2151,8 @@ module_exit(serial8250_exit);
EXPORT_SYMBOL(register_serial);
EXPORT_SYMBOL(unregister_serial);
EXPORT_SYMBOL(serial8250_get_irq_map);
EXPORT_SYMBOL(serial8250_suspend_port);
EXPORT_SYMBOL(serial8250_resume_port);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Generic 8250/16x50 serial driver $Revision: 1.90 $");
......
......@@ -27,6 +27,8 @@ struct serial8250_probe {
int serial8250_register_probe(struct serial8250_probe *probe);
void serial8250_unregister_probe(struct serial8250_probe *probe);
void serial8250_get_irq_map(unsigned int *map);
void serial8250_suspend_port(int line, u32 level);
void serial8250_resume_port(int line, u32 level);
struct old_serial_port {
unsigned int uart;
......
......@@ -1592,6 +1592,53 @@ static void __devexit pciserial_remove_one(struct pci_dev *dev)
}
}
static int pciserial_save_state_one(struct pci_dev *dev, u32 state)
{
struct serial_private *priv = pci_get_drvdata(dev);
if (priv) {
int i;
for (i = 0; i < priv->nr; i++)
serial8250_suspend_port(priv->line[i], SUSPEND_SAVE_STATE);
}
return 0;
}
static int pciserial_suspend_one(struct pci_dev *dev, u32 state)
{
struct serial_private *priv = pci_get_drvdata(dev);
if (priv) {
int i;
for (i = 0; i < priv->nr; i++)
serial8250_suspend_port(priv->line[i], SUSPEND_POWER_DOWN);
}
return 0;
}
static int pciserial_resume_one(struct pci_dev *dev)
{
struct serial_private *priv = pci_get_drvdata(dev);
if (priv) {
int i;
/*
* Ensure that the board is correctly configured.
*/
if (priv->quirk->init)
priv->quirk->init(dev);
for (i = 0; i < priv->nr; i++) {
serial8250_resume_port(priv->line[i], RESUME_POWER_ON);
serial8250_resume_port(priv->line[i], RESUME_RESTORE_STATE);
}
}
return 0;
}
static struct pci_device_id serial_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
PCI_SUBVENDOR_ID_CONNECT_TECH,
......@@ -1986,6 +2033,9 @@ static struct pci_driver serial_pci_driver = {
.name = "serial",
.probe = pciserial_init_one,
.remove = __devexit_p(pciserial_remove_one),
.save_state = pciserial_save_state_one,
.suspend = pciserial_suspend_one,
.resume = pciserial_resume_one,
.id_table = serial_pci_tbl,
.driver = {
.devclass = &tty_devclass,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment