Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp279583ybm; Thu, 28 May 2020 23:18:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfhT+WJNtW/19wAJvdyNzyd8AD6Y6KPFW5c5M3pKRLjWwCxwquOW5tJ6OqoyfaTRcm36H/ X-Received: by 2002:a05:6402:1d82:: with SMTP id dk2mr5106803edb.75.1590733091960; Thu, 28 May 2020 23:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590733091; cv=none; d=google.com; s=arc-20160816; b=cnztlBjabKS1P3bU9VPDz8DnfrNX1P6inHr9rAvoNBls6iTFtVn5XSS8f/YcNBPdfv tAw3frY/eKFEDVDeL8Yd9tVv7N68W77WwZpo5T/4gumYWUcyr5b/6IOe/hfQj9Fhdx80 ftWIudw9MEaTBNxLM9jBfeiaOAbsycnAer0hjTUxrNkbR9oS5qr1u3a+ACg+dPGt3vXT JlfCT2qx33YRT9xF0tpZmbbwJ6hJboG+pGtqFNZGwAKT4CNyKmi2XG0s5clrT9LPkLRm KAFxbQzMDGTKrkH5xkC6ZaXwzQevTAeE0TtXxQUt+NLIz6TRg/NUnMhklRbXls7SD7Nz E/ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Iy7scr/c79+2QERFuDKVbJNBBQwADidbs2CO5HuQ8bA=; b=BEkawQ2FALK1R9hN0uAzhN7oJXrBkdJ4XYW6SMAFElMNSQmXkboB1xCkO2AmeBq14s hORDlEQ9LNVDsrmDGANkfGB1Sbk5jXprAxiWelrGjb16kdeQblfQM3LMBSyf+FLxOJdc Xbj5vU6OfrP7s7NQmTnCPHfUUoGaEm5nWmcy8WguXFlASk7On9TZdhSaRXQ+aXbdsQXB qPTqdUVDyoBVUVt2nwCDdmUpQZiVpV3KtcQBMVQ2giYrfSnzXppYIJvTWTcWygCS5ZYc jqnSYgTvWJIs7AZDjR2PM8npt1jqmk1QPtUO05ShJx7k4OwRj5TGvpIn5NbE9ywIRVTP 4diQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr24si5055346ejb.383.2020.05.28.23.17.47; Thu, 28 May 2020 23:18:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725859AbgE2GP5 (ORCPT + 99 others); Fri, 29 May 2020 02:15:57 -0400 Received: from inva020.nxp.com ([92.121.34.13]:53142 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725777AbgE2GP4 (ORCPT ); Fri, 29 May 2020 02:15:56 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 04AA41A0FBB; Fri, 29 May 2020 08:15:54 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 70DA11A0FB1; Fri, 29 May 2020 08:15:50 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 8564B402D3; Fri, 29 May 2020 14:15:45 +0800 (SGT) From: Ran Wang To: Alessandro Zummo , Alexandre Belloni , Rob Herring , Li Biwen Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Ran Wang Subject: [PATCH 2/2] rtc: fsl-ftm-alarm: fix freeze(s2idle) doesnot wake Date: Fri, 29 May 2020 14:10:35 +0800 Message-Id: <20200529061035.18912-2-ran.wang_1@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200529061035.18912-1-ran.wang_1@nxp.com> References: <20200529061035.18912-1-ran.wang_1@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use dev_pm_set_wake_irq() instead of flag IRQF_NO_SUSPEND to enable wakeup system feature for both freeze(s2idle) and mem(deep). Use property 'wakeup-source' to control this feature. Signed-off-by: Ran Wang --- drivers/rtc/rtc-fsl-ftm-alarm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c index 756af62..c6945d84 100644 --- a/drivers/rtc/rtc-fsl-ftm-alarm.c +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c @@ -21,6 +21,7 @@ #include #include #include +#include #define FTM_SC_CLK(c) ((c) << FTM_SC_CLK_MASK_SHIFT) @@ -41,6 +42,7 @@ struct ftm_rtc { struct rtc_device *rtc_dev; void __iomem *base; bool big_endian; + bool wakeup; u32 alarm_freq; }; @@ -267,6 +269,9 @@ static int ftm_rtc_probe(struct platform_device *pdev) return PTR_ERR(rtc->base); } + rtc->wakeup = + device_property_read_bool(&pdev->dev, "wakeup-source"); + irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "can't get irq number\n"); @@ -274,7 +279,7 @@ static int ftm_rtc_probe(struct platform_device *pdev) } ret = devm_request_irq(&pdev->dev, irq, ftm_rtc_alarm_interrupt, - IRQF_NO_SUSPEND, dev_name(&pdev->dev), rtc); + 0, dev_name(&pdev->dev), rtc); if (ret < 0) { dev_err(&pdev->dev, "failed to request irq\n"); return ret; @@ -286,7 +291,10 @@ static int ftm_rtc_probe(struct platform_device *pdev) rtc->alarm_freq = (u32)FIXED_FREQ_CLK / (u32)MAX_FREQ_DIV; rtc->rtc_dev->ops = &ftm_rtc_ops; - device_init_wakeup(&pdev->dev, true); + device_init_wakeup(&pdev->dev, rtc->wakeup); + ret = dev_pm_set_wake_irq(&pdev->dev, irq); + if (ret) + dev_err(&pdev->dev, "irq wake enable failed.\n"); ret = rtc_register_device(rtc->rtc_dev); if (ret) { -- 2.7.4