From patchwork Sat Aug 15 02:53:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 41570 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 n7F2vohC001543 for ; Sat, 15 Aug 2009 02:57:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756080AbZHOC5s (ORCPT ); Fri, 14 Aug 2009 22:57:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756087AbZHOC5s (ORCPT ); Fri, 14 Aug 2009 22:57:48 -0400 Received: from mail-px0-f196.google.com ([209.85.216.196]:33564 "EHLO mail-px0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756080AbZHOC5r (ORCPT ); Fri, 14 Aug 2009 22:57:47 -0400 Received: by mail-px0-f196.google.com with SMTP id 34so527052pxi.4 for ; Fri, 14 Aug 2009 19:57:49 -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 :in-reply-to:references:subject; bh=chAO0ut7V/lIZTdt6pR+z421Y3muBxG/8VyMsJTiEFY=; b=MLwG/7gOUeaWvOTwc1GFHvwT58RR+lv7wazDPG/cf+ek1TaXP48Cm6F39foGZBQ6lK jhmmEhjiOWYOrY//BHDh8e2Wb1wXXysXpxTxj9Av9fwwpFIx/pLWgPvbbh/PFr8ymdgZ 2MApsKSRW/pMXe6lWidlP65TSQF0KMrcapOzc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=P1ht2TvmCf5CFLfX7Jmg3yhQtDqhDRis9AN6j0ZmLlyMmNC+wRDWL/M6Fmvvx19iRY jP0iZjpMHlHDLqyxrckY5rPymjRITQDrLrK9S6SqpemNcoJbMIXcKyYw8hUZPSsrAZ/w hHuui6290GOVNoMF8gHvBvX47OUwiAiMA8+yE= Received: by 10.115.15.2 with SMTP id s2mr2372329wai.66.1250305069303; Fri, 14 Aug 2009 19:57:49 -0700 (PDT) Received: from rx1.opensource.se (210-225-125-011.jp.fiberphone.net [210.225.125.11]) by mx.google.com with ESMTPS id n6sm3378505wag.39.2009.08.14.19.57.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 14 Aug 2009 19:57:48 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Sat, 15 Aug 2009 11:53:25 +0900 Message-Id: <20090815025325.8125.34501.sendpatchset@rx1.opensource.se> In-Reply-To: <20090815025307.8125.50234.sendpatchset@rx1.opensource.se> References: <20090815025307.8125.50234.sendpatchset@rx1.opensource.se> Subject: [PATCH 02/04] sh: CMT suspend/resume Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch updates the SuperH CMT driver with suspend and resume callbacks for the suspend-to-ram case. This patch stops the CMT channel at suspend time to avoid unwanted wake up events. Signed-off-by: Magnus Damm --- drivers/clocksource/sh_cmt.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 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/clocksource/sh_cmt.c +++ work/drivers/clocksource/sh_cmt.c 2009-08-13 13:37:21.000000000 +0900 @@ -40,6 +40,7 @@ struct sh_cmt_priv { struct platform_device *pdev; unsigned long flags; + unsigned long flags_suspend; unsigned long match_value; unsigned long next_match_value; unsigned long max_match_value; @@ -667,11 +668,38 @@ static int __devexit sh_cmt_remove(struc return -EBUSY; /* cannot unregister clockevent and clocksource */ } +static int sh_cmt_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct sh_cmt_priv *p = platform_get_drvdata(pdev); + + /* save flag state and stop CMT channel */ + p->flags_suspend = p->flags; + sh_cmt_stop(p, p->flags); + return 0; +} + +static int sh_cmt_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct sh_cmt_priv *p = platform_get_drvdata(pdev); + + /* start CMT channel from saved state */ + sh_cmt_start(p, p->flags_suspend); + return 0; +} + +static struct dev_pm_ops sh_cmt_dev_pm_ops = { + .suspend = sh_cmt_suspend, + .resume = sh_cmt_resume, +}; + static struct platform_driver sh_cmt_device_driver = { .probe = sh_cmt_probe, .remove = __devexit_p(sh_cmt_remove), .driver = { .name = "sh_cmt", + .pm = &sh_cmt_dev_pm_ops, } };