Message ID | 1439890876-19024-3-git-send-email-j-keerthy@ti.com |
---|---|
State | Accepted |
Headers | show |
Hi, On 18/08/2015 at 15:11:15 +0530, Keerthy wrote : > @@ -681,6 +688,9 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) > > device_init_wakeup(&pdev->dev, 0); > > + if (!IS_ERR(rtc->clk)) > + clk_disable_unprepare(rtc->clk); > + > rtc->type->unlock(rtc); > /* leave rtc running, but disable irqs */ Is it actually still running once the clock is disabled? > rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0);
On Saturday 22 August 2015 03:06 AM, Alexandre Belloni wrote: > Hi, > > On 18/08/2015 at 15:11:15 +0530, Keerthy wrote : >> @@ -681,6 +688,9 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) >> >> device_init_wakeup(&pdev->dev, 0); >> >> + if (!IS_ERR(rtc->clk)) >> + clk_disable_unprepare(rtc->clk); >> + >> rtc->type->unlock(rtc); >> /* leave rtc running, but disable irqs */ > > Is it actually still running once the clock is disabled? With the current set of patches on Aegis the disabling the external clock toggles it to be sourced from internal clock. So rtc will still be running. > >> rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0); > > >
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 8b6355f..f31c012 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -25,6 +25,7 @@ #include <linux/of_device.h> #include <linux/pm_runtime.h> #include <linux/io.h> +#include <linux/clk.h> /* * The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock @@ -132,6 +133,7 @@ struct omap_rtc_device_type { struct omap_rtc { struct rtc_device *rtc; void __iomem *base; + struct clk *clk; int irq_alarm; int irq_timer; u8 interrupts_reg; @@ -553,6 +555,11 @@ static int omap_rtc_probe(struct platform_device *pdev) if (rtc->irq_alarm <= 0) return -ENOENT; + rtc->clk = devm_clk_get(&pdev->dev, "int-clk"); + + if (!IS_ERR(rtc->clk)) + clk_prepare_enable(rtc->clk); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rtc->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(rtc->base)) @@ -681,6 +688,9 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 0); + if (!IS_ERR(rtc->clk)) + clk_disable_unprepare(rtc->clk); + rtc->type->unlock(rtc); /* leave rtc running, but disable irqs */ rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0);
The rtc can be clocked by an internal 32K clock. Adding the support to enable the same. Signed-off-by: Keerthy <j-keerthy@ti.com> --- drivers/rtc/rtc-omap.c | 10 ++++++++++ 1 file changed, 10 insertions(+)