pdata->scan_timing, priv->iomem_base + KYCR1_OFFS);
iowrite16(0, priv->iomem_base + KYOUTDR_OFFS);
iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS);
+
+ device_init_wakeup(&pdev->dev, 1);
return 0;
err5:
free_irq(irq, pdev);
return 0;
}
+static int sh_keysc_suspend(struct device *dev)
+{
+ struct platform_device *pdev;
+ struct sh_keysc_priv *priv;
+ unsigned short value;
+
+ pdev = container_of(dev, struct platform_device, dev);
+ priv = platform_get_drvdata(pdev);
+
+ value = ioread16(priv->iomem_base + KYCR1_OFFS);
-#define sh_keysc_suspend NULL
-#define sh_keysc_resume NULL
+ if (device_may_wakeup(dev))
+ value |= 0x80;
+ else
+ value &= ~0x80;
+
+ iowrite16(value, priv->iomem_base + KYCR1_OFFS);
+ return 0;
+}
+
+static struct dev_pm_ops sh_keysc_dev_pm_ops = {
+ .suspend = sh_keysc_suspend,
+};
struct platform_driver sh_keysc_device_driver = {
.probe = sh_keysc_probe,
.remove = __devexit_p(sh_keysc_remove),
- .suspend = sh_keysc_suspend,
- .resume = sh_keysc_resume,
.driver = {
.name = "sh_keysc",
+ .pm = &sh_keysc_dev_pm_ops,
}
};