Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751472AbbGaBc7 (ORCPT ); Thu, 30 Jul 2015 21:32:59 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:53709 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750938AbbGaBc6 (ORCPT ); Thu, 30 Jul 2015 21:32:58 -0400 X-Listener-Flag: 11101 Message-ID: <1438306372.26690.2.camel@mtksdaap41> Subject: Re: [PATCH] rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver From: Eddie Huang To: Henry Chen CC: Alexandre Belloni , "Alessandro Zummo" , Matthias Brugger , , , , Date: Fri, 31 Jul 2015 09:32:52 +0800 In-Reply-To: <1438267994-13934-1-git-send-email-henryc.chen@mediatek.com> References: <1438267994-13934-1-git-send-email-henryc.chen@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1814 Lines: 63 On Thu, 2015-07-30 at 22:53 +0800, Henry Chen wrote: > Implement the suspend/resume function in order to control rtc's irq_wake flag and handle as wakeup source. > > Signed-off-by: Henry Chen > --- > drivers/rtc/rtc-mt6397.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c > index c0090b6..9f6c9f8 100644 > --- a/drivers/rtc/rtc-mt6397.c > +++ b/drivers/rtc/rtc-mt6397.c > @@ -373,6 +373,31 @@ static int mtk_rtc_remove(struct platform_device *pdev) > return 0; > } > > +#ifdef CONFIG_PM_SLEEP > +static int mt6397_rtc_suspend(struct device *dev) > +{ > + struct mt6397_rtc *rtc = dev_get_drvdata(dev); > + > + if (device_may_wakeup(dev)) > + enable_irq_wake(rtc->irq); > + > + return 0; > +} > + > +static int mt6397_rtc_resume(struct device *dev) > +{ > + struct mt6397_rtc *rtc = dev_get_drvdata(dev); > + > + if (device_may_wakeup(dev)) > + disable_irq_wake(rtc->irq); > + > + return 0; > +} > +#endif > + > +static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend, > + mt6397_rtc_resume); > + > static const struct of_device_id mt6397_rtc_of_match[] = { > { .compatible = "mediatek,mt6397-rtc", }, > { } > @@ -382,6 +407,7 @@ static struct platform_driver mtk_rtc_driver = { > .driver = { > .name = "mt6397-rtc", > .of_match_table = mt6397_rtc_of_match, > + .pm = &mt6397_pm_ops, > }, > .probe = mtk_rtc_probe, > .remove = mtk_rtc_remove, It looks good to me. Acked-by: Eddie Huang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/