From patchwork Wed Apr 1 14:45:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 15702 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 n31Em4eZ016947 for ; Wed, 1 Apr 2009 14:48:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753016AbZDAOsE (ORCPT ); Wed, 1 Apr 2009 10:48:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758918AbZDAOsE (ORCPT ); Wed, 1 Apr 2009 10:48:04 -0400 Received: from ti-out-0910.google.com ([209.85.142.190]:42360 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbZDAOsB (ORCPT ); Wed, 1 Apr 2009 10:48:01 -0400 Received: by ti-out-0910.google.com with SMTP id i7so53927tid.23 for ; Wed, 01 Apr 2009 07:47:58 -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=ebHs1pkmtE4Qt2Of0BU8PHAaKPct2udy6Eklzfoi+ck=; b=Oab9qxkc3WESeXT9Df+9GTloig//0eujFhbc57L3sqrheYHyc7+u9NxyAVPpmbYEzm 8+u9fi8MgzkPIYNKqC19OqwxLXJ/RN4VGSXryCAyw82WumG8v8gN3uPSlDP8o9tZr73V AwhEkCfESG7NYGGZoh2cOXlV7KzQzPAgFxs2Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=oi3eKYakQZKc0UfSz/YL731tYOn1Wh4zdM3JQV64WB7deFa7xD9QjPWKGktjpLNDLj oJpnA08p9HYGfG94WV20r8kbNzarsAuhWCMDcXhJeCTjGPJbnWpy5xUYhYANjg03LN3+ QnsocNAmuAQzRW//VkMv3eVJ8mhy2nf/4w0vM= Received: by 10.110.57.5 with SMTP id f5mr1055885tia.34.1238597278503; Wed, 01 Apr 2009 07:47:58 -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 14sm79163tim.9.2009.04.01.07.47.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Apr 2009 07:47:55 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Wed, 01 Apr 2009 23:45:17 +0900 Message-Id: <20090401144517.336.60634.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh_rtc: use set_irq_wake() Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Modify the sh_rtc driver to use set_irq_wake() during suspend and resume. These functions are used to enable the rtc interrupts in the interrupt controller so the rtc can be used to wakeup the system from suspend. Signed-off-by: Magnus Damm --- drivers/rtc/rtc-sh.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 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/rtc/rtc-sh.c +++ work/drivers/rtc/rtc-sh.c 2009-04-01 22:57:15.000000000 +0900 @@ -795,10 +795,46 @@ static int __devexit sh_rtc_remove(struc return 0; } + +static void sh_rtc_set_irq_wake(struct device *dev, int enabled) +{ + struct platform_device *pdev = to_platform_device(dev); + struct sh_rtc *rtc = platform_get_drvdata(pdev); + + set_irq_wake(rtc->periodic_irq, enabled); + if (rtc->carry_irq > 0) { + set_irq_wake(rtc->carry_irq, enabled); + set_irq_wake(rtc->alarm_irq, enabled); + } + +} + +static int sh_rtc_suspend(struct device *dev) +{ + if (device_may_wakeup(dev)) + sh_rtc_set_irq_wake(dev, 1); + + return 0; +} + +static int sh_rtc_resume(struct device *dev) +{ + if (device_may_wakeup(dev)) + sh_rtc_set_irq_wake(dev, 0); + + return 0; +} + +static struct dev_pm_ops sh_rtc_dev_pm_ops = { + .suspend = sh_rtc_suspend, + .resume = sh_rtc_resume, +}; + static struct platform_driver sh_rtc_platform_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, + .pm = &sh_rtc_dev_pm_ops, }, .probe = sh_rtc_probe, .remove = __devexit_p(sh_rtc_remove),