* [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer @ 2020-05-29 6:10 Ran Wang 2020-05-29 6:10 ` [PATCH 2/2] rtc: fsl-ftm-alarm: fix freeze(s2idle) doesnot wake Ran Wang 2020-05-29 8:18 ` [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer Alexandre Belloni 0 siblings, 2 replies; 4+ messages in thread From: Ran Wang @ 2020-05-29 6:10 UTC (permalink / raw) To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Li Biwen Cc: linux-rtc, devicetree, linux-kernel, Ran Wang Signed-off-by: Ran Wang <ran.wang_1@nxp.com> --- Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt b/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt index fffac74..d7c482c 100644 --- a/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt +++ b/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt @@ -20,6 +20,7 @@ Required properties: Optional properties: - big-endian: If the host controller is big-endian mode, specify this property. The default endian mode is little-endian. +- wakeup-source: Enable it as a wakeup source Example: rcpm: rcpm@1e34040 { @@ -32,5 +33,6 @@ ftm_alarm0: timer@2800000 { compatible = "fsl,ls1088a-ftm-alarm"; reg = <0x0 0x2800000 0x0 0x10000>; fsl,rcpm-wakeup = <&rcpm 0x0 0x0 0x0 0x0 0x4000 0x0>; + wakeup-source; interrupts = <0 44 4>; }; -- 2.7.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] rtc: fsl-ftm-alarm: fix freeze(s2idle) doesnot wake 2020-05-29 6:10 [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer Ran Wang @ 2020-05-29 6:10 ` Ran Wang 2020-05-29 8:23 ` Alexandre Belloni 2020-05-29 8:18 ` [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer Alexandre Belloni 1 sibling, 1 reply; 4+ messages in thread From: Ran Wang @ 2020-05-29 6:10 UTC (permalink / raw) To: Alessandro Zummo, Alexandre Belloni, Rob Herring, Li Biwen Cc: linux-rtc, devicetree, linux-kernel, Ran Wang 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 <ran.wang_1@nxp.com> --- 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 <linux/rtc.h> #include <linux/time.h> #include <linux/acpi.h> +#include <linux/pm_wakeirq.h> #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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] rtc: fsl-ftm-alarm: fix freeze(s2idle) doesnot wake 2020-05-29 6:10 ` [PATCH 2/2] rtc: fsl-ftm-alarm: fix freeze(s2idle) doesnot wake Ran Wang @ 2020-05-29 8:23 ` Alexandre Belloni 0 siblings, 0 replies; 4+ messages in thread From: Alexandre Belloni @ 2020-05-29 8:23 UTC (permalink / raw) To: Ran Wang Cc: Alessandro Zummo, Rob Herring, Li Biwen, linux-rtc, devicetree, linux-kernel On 29/05/2020 14:10:35+0800, Ran Wang wrote: > 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 <ran.wang_1@nxp.com> > --- > 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 <linux/rtc.h> > #include <linux/time.h> > #include <linux/acpi.h> > +#include <linux/pm_wakeirq.h> > > #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); As long as you have an irq, you should be able to wakeup, do you really need the wakeup-source property? Usually, wakeup-source is used when the RTC interrupt line is not connected directly to the SoC but is still able to wake it up. In your case, is it to cover the case of the flex timers that can't wake the CPU? If so, then please be more explicit in your commit message. > + 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 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer 2020-05-29 6:10 [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer Ran Wang 2020-05-29 6:10 ` [PATCH 2/2] rtc: fsl-ftm-alarm: fix freeze(s2idle) doesnot wake Ran Wang @ 2020-05-29 8:18 ` Alexandre Belloni 1 sibling, 0 replies; 4+ messages in thread From: Alexandre Belloni @ 2020-05-29 8:18 UTC (permalink / raw) To: Ran Wang Cc: Alessandro Zummo, Rob Herring, Li Biwen, linux-rtc, devicetree, linux-kernel On 29/05/2020 14:10:34+0800, Ran Wang wrote: > Signed-off-by: Ran Wang <ran.wang_1@nxp.com> > --- > Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt b/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt > index fffac74..d7c482c 100644 > --- a/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt > +++ b/Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt > @@ -20,6 +20,7 @@ Required properties: > Optional properties: > - big-endian: If the host controller is big-endian mode, specify this property. > The default endian mode is little-endian. > +- wakeup-source: Enable it as a wakeup source > This is already covered by Documentation/devicetree/bindings/rtc/rtc.yaml > Example: > rcpm: rcpm@1e34040 { > @@ -32,5 +33,6 @@ ftm_alarm0: timer@2800000 { > compatible = "fsl,ls1088a-ftm-alarm"; > reg = <0x0 0x2800000 0x0 0x10000>; > fsl,rcpm-wakeup = <&rcpm 0x0 0x0 0x0 0x0 0x4000 0x0>; > + wakeup-source; > interrupts = <0 44 4>; > }; > -- > 2.7.4 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-29 8:23 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-29 6:10 [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer Ran Wang 2020-05-29 6:10 ` [PATCH 2/2] rtc: fsl-ftm-alarm: fix freeze(s2idle) doesnot wake Ran Wang 2020-05-29 8:23 ` Alexandre Belloni 2020-05-29 8:18 ` [PATCH 1/2] dt-bindings: rtc: add wakeup-source for FlexTimer Alexandre Belloni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).