From patchwork Fri Sep 19 10:26:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 391205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-la0-x23b.google.com (mail-la0-x23b.google.com [IPv6:2a00:1450:4010:c03::23b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2751D14018C for ; Fri, 19 Sep 2014 20:26:42 +1000 (EST) Received: by mail-la0-f59.google.com with SMTP id b17sf204715lan.4 for ; Fri, 19 Sep 2014 03:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:sender:list-subscribe:list-unsubscribe:content-type; bh=l2ILB/Be7okPEwPB9ssoG5nJoOgESs3saMETB2HY/18=; b=BwLjIJqnTgSglIqrTym8lyUWUXgXt9N+Gmhw/ngNFxhztomS1sW0CfKGAdhRdyL6Ev /Mb76c+YthgFLMZJEFQ6EXqWgmtwLXhcRrRN7erLXKqaK+T962HP9ucNZCKVIHIVWN09 Y21VW9zFHSCkmWRoZagwqjdkwi75pcLbDlhckN4EBWLjJRkMhrK1ICKs73nmrFZS7KLU +F9f35dXp/fAc0UJvXBHhaq1zdniSZkJGrUGQAzzCjIuzyrUAaGZ2EqydnC9hnATQlem hALdhPpBdGKp8YiyddPAyYExlhVEkvvmocv+90/6TpA06eENKxX3fHRJGh5PtUZTk+U8 J9yQ== X-Received: by 10.180.86.106 with SMTP id o10mr255054wiz.18.1411122398831; Fri, 19 Sep 2014 03:26:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.180.87.1 with SMTP id t1ls86207wiz.13.canary; Fri, 19 Sep 2014 03:26:38 -0700 (PDT) X-Received: by 10.180.108.70 with SMTP id hi6mr197278wib.4.1411122398363; Fri, 19 Sep 2014 03:26:38 -0700 (PDT) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk. [93.93.135.160]) by gmr-mx.google.com with ESMTPS id go4si64178wib.3.2014.09.19.03.26.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 19 Sep 2014 03:26:38 -0700 (PDT) Received-SPF: none (google.com: javier.martinez@collabora.co.uk does not designate permitted sender hosts) client-ip=93.93.135.160; Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: javier) with ESMTPSA id C5047609F7B From: Javier Martinez Canillas To: Andrew Morton Cc: Alessandro Zummo , Doug Anderson , Krzysztof Kozlowski , rtc-linux@googlegroups.com, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas Subject: [rtc-linux] [PATCH v10 1/6] rtc: max77686: Allow the max77686 rtc to wakeup the system Date: Fri, 19 Sep 2014 12:26:12 +0200 Message-Id: <1411122377-10426-2-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411122377-10426-1-git-send-email-javier.martinez@collabora.co.uk> References: <1411122377-10426-1-git-send-email-javier.martinez@collabora.co.uk> X-Original-Sender: javier.martinez@collabora.co.uk X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: javier.martinez@collabora.co.uk does not designate permitted sender hosts) smtp.mail=javier.martinez@collabora.co.uk Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , From: Doug Anderson The max77686 includes an RTC that keeps power during suspend. It's convenient to be able to use it as a wakeup source. Signed-off-by: Doug Anderson Reviewed-by: Javier Martinez Canillas Reviewed-by: Krzysztof Kozlowski Signed-off-by: Javier Martinez Canillas --- Changes since v9: - Remove note from Doug that is not applicable anymore due changes in the i2c driver. - Add s-o-b since I'm in the patch delivery path. Suggested by Andrew Morton. Changes since v8: None Changes since v7: None Changes since v6: None Changes since v5: - Fix $SUBJECT since the patch does not actually touch the mfd subsys. Suggested by Lee Jones. Changes since v4: None Changes since v3: - Keep the note that this patch needs another change due wakeup ordering problems. drivers/rtc/rtc-max77686.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c index d20a7f0..c1c6055 100644 --- a/drivers/rtc/rtc-max77686.c +++ b/drivers/rtc/rtc-max77686.c @@ -583,6 +583,33 @@ static void max77686_rtc_shutdown(struct platform_device *pdev) #endif /* MAX77686_RTC_WTSR_SMPL */ } +#ifdef CONFIG_PM_SLEEP +static int max77686_rtc_suspend(struct device *dev) +{ + if (device_may_wakeup(dev)) { + struct max77686_rtc_info *info = dev_get_drvdata(dev); + + return enable_irq_wake(info->virq); + } + + return 0; +} + +static int max77686_rtc_resume(struct device *dev) +{ + if (device_may_wakeup(dev)) { + struct max77686_rtc_info *info = dev_get_drvdata(dev); + + return disable_irq_wake(info->virq); + } + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(max77686_rtc_pm_ops, + max77686_rtc_suspend, max77686_rtc_resume); + static const struct platform_device_id rtc_id[] = { { "max77686-rtc", 0 }, {}, @@ -592,6 +619,7 @@ static struct platform_driver max77686_rtc_driver = { .driver = { .name = "max77686-rtc", .owner = THIS_MODULE, + .pm = &max77686_rtc_pm_ops, }, .probe = max77686_rtc_probe, .shutdown = max77686_rtc_shutdown,