diff options
author | Lily Zhang <r58066@freescale.com> | 2009-06-23 17:38:21 +0800 |
---|---|---|
committer | Lily Zhang <r58066@freescale.com> | 2009-06-24 10:42:37 +0800 |
commit | bdc732bf9f75db22ed6eafa7163f11e212be14ec (patch) | |
tree | 5d2abb7ba4561076c52a974f57144afef7bdc51e /drivers/rtc | |
parent | a82897bb2902252fa9cf876090bca2381bf78df2 (diff) |
ENGR00113197-2 disable RTC clock when it's not active
disable RTC clock when it's not active
Signed-off-by: Lily Zhang <r58066@freescale.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-mxc_v2.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c index c6eee09728e4..c4a070c3092b 100644 --- a/drivers/rtc/rtc-mxc_v2.c +++ b/drivers/rtc/rtc-mxc_v2.c @@ -282,6 +282,9 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) */ static int mxc_rtc_open(struct device *dev) { + struct rtc_drv_data *pdata = dev_get_drvdata(dev); + clk_enable(pdata->clk); + if (test_and_set_bit(1, &rtc_status)) return -EBUSY; return 0; @@ -308,6 +311,7 @@ static void mxc_rtc_release(struct device *dev) spin_unlock_irqrestore(&rtc_lock, lock_flags); rtc_write_sync_lp(ioaddr); + clk_disable(pdata->clk); rtc_status = 0; } @@ -487,9 +491,11 @@ static int mxc_rtc_proc(struct device *dev, struct seq_file *seq) struct rtc_drv_data *pdata = dev_get_drvdata(dev); void __iomem *ioaddr = pdata->ioaddr; + clk_enable(pdata->clk); seq_printf(seq, "alarm_IRQ\t: %s\n", (((__raw_readl(ioaddr + SRTC_LPCR)) & SRTC_LPCR_ALP) != 0) ? "yes" : "no"); + clk_disable(pdata->clk); return 0; } @@ -619,6 +625,8 @@ static int mxc_rtc_probe(struct platform_device *pdev) /* So srtc is set as "should wakeup" as it can */ device_init_wakeup(&pdev->dev, 1); + clk_disable(pdata->clk); + return ret; err_out: @@ -640,7 +648,6 @@ static int __exit mxc_rtc_remove(struct platform_device *pdev) clk_disable(pdata->clk); clk_put(pdata->clk); kfree(pdata); - mxc_rtc_release(NULL); return 0; } @@ -661,6 +668,7 @@ static int mxc_rtc_suspend(struct platform_device *pdev, pm_message_t state) void __iomem *ioaddr = pdata->ioaddr; struct timespec tv; + clk_enable(pdata->clk); if (device_may_wakeup(&pdev->dev)) { enable_irq_wake(pdata->irq); } else { @@ -719,6 +727,7 @@ static int mxc_rtc_resume(struct platform_device *pdev) do_settimeofday(&ts); } + clk_disable(pdata->clk); return 0; } |