Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202221
b: refs/heads/master
c: 1ca56e5
h: refs/heads/master
i:
  202219: ba16601
v: v3
  • Loading branch information
Dmitry Torokhov committed Jul 21, 2010
1 parent f2f3dda commit 487cd85
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58fb021827b7455e05d89371556e6c255e9fb2e1
refs/heads/master: 1ca56e513a9fd356d5a9e0de45dbe0e189e00386
65 changes: 41 additions & 24 deletions trunk/drivers/input/serio/i8042.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,9 +861,6 @@ static int i8042_controller_selftest(void)
unsigned char param;
int i = 0;

if (!i8042_reset)
return 0;

/*
* We try this 5 times; on some really fragile systems this does not
* take the first time...
Expand Down Expand Up @@ -1020,7 +1017,8 @@ static void i8042_controller_reset(void)
* Reset the controller if requested.
*/

i8042_controller_selftest();
if (i8042_reset)
i8042_controller_selftest();

/*
* Restore the original control register setting.
Expand Down Expand Up @@ -1093,34 +1091,24 @@ static void i8042_dritek_enable(void)

#ifdef CONFIG_PM

/*
* Here we try to restore the original BIOS settings to avoid
* upsetting it.
*/

static int i8042_pm_reset(struct device *dev)
{
i8042_controller_reset();

return 0;
}

/*
* Here we try to reset everything back to a state we had
* before suspending.
*/

static int i8042_pm_restore(struct device *dev)
static int i8042_controller_resume(bool force_reset)
{
int error;

error = i8042_controller_check();
if (error)
return error;

error = i8042_controller_selftest();
if (error)
return error;
if (i8042_reset || force_reset) {
error = i8042_controller_selftest();
if (error)
return error;
}

/*
* Restore original CTR value and disable all ports
Expand Down Expand Up @@ -1162,16 +1150,43 @@ static int i8042_pm_restore(struct device *dev)
return 0;
}

/*
* Here we try to restore the original BIOS settings to avoid
* upsetting it.
*/

static int i8042_pm_reset(struct device *dev)
{
i8042_controller_reset();

return 0;
}

static int i8042_pm_resume(struct device *dev)
{
/*
* On resume from S2R we always try to reset the controller
* to bring it in a sane state. (In case of S2D we expect
* BIOS to reset the controller for us.)
*/
return i8042_controller_resume(true);
}

static int i8042_pm_thaw(struct device *dev)
{
i8042_interrupt(0, NULL);

return 0;
}

static int i8042_pm_restore(struct device *dev)
{
return i8042_controller_resume(false);
}

static const struct dev_pm_ops i8042_pm_ops = {
.suspend = i8042_pm_reset,
.resume = i8042_pm_restore,
.resume = i8042_pm_resume,
.thaw = i8042_pm_thaw,
.poweroff = i8042_pm_reset,
.restore = i8042_pm_restore,
Expand Down Expand Up @@ -1389,9 +1404,11 @@ static int __init i8042_probe(struct platform_device *dev)

i8042_platform_device = dev;

error = i8042_controller_selftest();
if (error)
return error;
if (i8042_reset) {
error = i8042_controller_selftest();
if (error)
return error;
}

error = i8042_controller_init();
if (error)
Expand Down

0 comments on commit 487cd85

Please sign in to comment.