Commit 99ca6b83 authored by Russell King's avatar Russell King

[SERIAL] Add extra suspend/resume functionality to serial_cs.

This calls into the 8250 driver so that the serial port settings can
be saved and restored over a suspend/resume cycle.  Previous kernels
have assumed that the port will be re-opened after such an event,
which may not be the case.
parent 7e403221
...@@ -54,6 +54,8 @@ ...@@ -54,6 +54,8 @@
#include <pcmcia/ds.h> #include <pcmcia/ds.h>
#include <pcmcia/cisreg.h> #include <pcmcia/cisreg.h>
#include "8250.h"
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG; static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i"); MODULE_PARM(pc_debug, "i");
...@@ -158,6 +160,38 @@ static void serial_remove(dev_link_t *link) ...@@ -158,6 +160,38 @@ static void serial_remove(dev_link_t *link)
} }
} }
static void serial_suspend(dev_link_t *link)
{
link->state |= DEV_SUSPEND;
if (link->state & DEV_CONFIG) {
struct serial_info *info = link->priv;
int i;
for (i = 0; i < info->ndev; i++)
serial8250_suspend_port(info->line[i]);
if (!info->slave)
pcmcia_release_configuration(link->handle);
}
}
static void serial_resume(dev_link_t *link)
{
link->state &= ~DEV_SUSPEND;
if (DEV_OK(link)) {
struct serial_info *info = link->priv;
int i;
if (!info->slave)
pcmcia_request_configuration(link->handle, &link->conf);
for (i = 0; i < info->ndev; i++)
serial8250_resume_port(info->line[i]);
}
}
/*====================================================================== /*======================================================================
serial_attach() creates an "instance" of the driver, allocating serial_attach() creates an "instance" of the driver, allocating
...@@ -674,16 +708,18 @@ serial_event(event_t event, int priority, event_callback_args_t * args) ...@@ -674,16 +708,18 @@ serial_event(event_t event, int priority, event_callback_args_t * args)
break; break;
case CS_EVENT_PM_SUSPEND: case CS_EVENT_PM_SUSPEND:
link->state |= DEV_SUSPEND; serial_suspend(link);
/* Fall through... */ break;
case CS_EVENT_RESET_PHYSICAL: case CS_EVENT_RESET_PHYSICAL:
if ((link->state & DEV_CONFIG) && !info->slave) if ((link->state & DEV_CONFIG) && !info->slave)
pcmcia_release_configuration(link->handle); pcmcia_release_configuration(link->handle);
break; break;
case CS_EVENT_PM_RESUME: case CS_EVENT_PM_RESUME:
link->state &= ~DEV_SUSPEND; serial_resume(link);
/* Fall through... */ break;
case CS_EVENT_CARD_RESET: case CS_EVENT_CARD_RESET:
if (DEV_OK(link) && !info->slave) if (DEV_OK(link) && !info->slave)
pcmcia_request_configuration(link->handle, &link->conf); pcmcia_request_configuration(link->handle, &link->conf);
......
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