Skip to content

Commit

Permalink
staging: nvec: ps2: add suspend/resume functions
Browse files Browse the repository at this point in the history
This adds suspend and resume functions to the nvec_ps2 mouse driver.

During suspend the nvec sends a "Cancel all mouse events" command. If
this is missed, there will be still some bytes in the received buffer
after resume which make the mouse go out of sync.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Marc Dietrich authored and Greg Kroah-Hartman committed Jan 31, 2012
1 parent 5f356a6 commit d1b5342
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/staging/nvec/nvec_ps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,27 @@ static int __devinit nvec_mouse_probe(struct platform_device *pdev)
return 0;
}

static int nvec_mouse_suspend(struct platform_device *pdev, pm_message_t state)
{
struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);

/* send cancel autoreceive */
nvec_write_async(nvec, "\x06\x04", 2);

return 0;
}

static int nvec_mouse_resume(struct platform_device *pdev)
{
ps2_startstreaming(ps2_dev.ser_dev);

return 0;
}

static struct platform_driver nvec_mouse_driver = {
.probe = nvec_mouse_probe,
.suspend = nvec_mouse_suspend,
.resume = nvec_mouse_resume,
.driver = {
.name = "nvec-mouse",
.owner = THIS_MODULE,
Expand Down

0 comments on commit d1b5342

Please sign in to comment.