From patchwork Tue Mar 10 06:24:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 10811 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2A6QpcJ021415 for ; Tue, 10 Mar 2009 06:26:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751730AbZCJG0v (ORCPT ); Tue, 10 Mar 2009 02:26:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752191AbZCJG0v (ORCPT ); Tue, 10 Mar 2009 02:26:51 -0400 Received: from wa-out-1112.google.com ([209.85.146.181]:44605 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751624AbZCJG0u (ORCPT ); Tue, 10 Mar 2009 02:26:50 -0400 Received: by wa-out-1112.google.com with SMTP id v33so1194292wah.21 for ; Mon, 09 Mar 2009 23:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=euoHYbe6jysMfRQRN3y8Xg0zdfcaeRohmFrC/FZzatc=; b=eFxE9klZLir2SkcQQBLKYPb7ejH/sjS/jPSSHez8+tk1ZYjD+TjdVBqVj3fM5hO/mc aIN19p3kYqZhgecfEwg3Te/+6kZlHJc8Zne78FxptxpbbCL+vhuF1LM8IGh+r8jC4o2M 2khq1tT9sxvnwJlve12JQFX8onEu0nZ6Iyn60= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=NRl9YR9cfEoZpQHZnRL7dy696J7CZAi3E9ZDoya6P5Qo9y5GxMguAC4ovAdcnDWNrH g/9PBiICO7J8/9qNKZzxcSqYSknWcMzaYiNKlyhJNMU49qX9AAEdfvBnLwYBVOPIydcq 1rUphUhYhqAEOltevt0bREgPj+Mk7Cp+jYpOs= Received: by 10.115.18.1 with SMTP id v1mr4051671wai.157.1236666407786; Mon, 09 Mar 2009 23:26:47 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id g25sm4772163wag.8.2009.03.09.23.26.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 09 Mar 2009 23:26:47 -0700 (PDT) From: Magnus Damm To: linux-input@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org, linux-sh@vger.kernel.org Date: Tue, 10 Mar 2009 15:24:21 +0900 Message-Id: <20090310062421.22328.68726.sendpatchset@rx1.opensource.se> Subject: [PATCH] input: add suspend wakeup support to sh_keysc Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch adds wakeup support to the sh_keysc driver. With this feature the ".../power/wakeup" file can be used to enable and disable if the device takes the system out of suspend. Default is enabled. Signed-off-by: Magnus Damm --- drivers/input/keyboard/sh_keysc.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/drivers/input/keyboard/sh_keysc.c +++ work/drivers/input/keyboard/sh_keysc.c 2009-03-09 19:14:47.000000000 +0900 @@ -219,6 +219,8 @@ static int __devinit sh_keysc_probe(stru 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); @@ -253,17 +255,36 @@ static int __devexit sh_keysc_remove(str 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); + + if (device_may_wakeup(dev)) + value |= 0x80; + else + value &= ~0x80; -#define sh_keysc_suspend NULL -#define sh_keysc_resume NULL + 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, } };