Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964958AbbHKL22 (ORCPT ); Tue, 11 Aug 2015 07:28:28 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:43706 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964874AbbHKL2Z (ORCPT ); Tue, 11 Aug 2015 07:28:25 -0400 X-AuditID: cbfee68d-f79106d00000728c-85-55c9dc560200 From: Joonyoung Shim To: rtc-linux@googlegroups.com Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, a.zummo@towertech.it, alexandre.belloni@free-electrons.com, cw00.choi@samsung.com, k.kozlowski@samsung.com, jy0922.shim@samsung.com Subject: [PATCH 4/4] rtc: s3c: enable/disable clocks for alarm Date: Tue, 11 Aug 2015 20:28:22 +0900 Message-id: <1439292502-22912-4-git-send-email-jy0922.shim@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1439292502-22912-1-git-send-email-jy0922.shim@samsung.com> References: <1439292502-22912-1-git-send-email-jy0922.shim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsWyRsSkWDfszslQg31XpSyWXLzKbtFxbTGT xfUvz1ktXty7yGLx+oWhxeVdc9gsZpzfx2Sxv7OD0YHD48mmi4weeyaeZPPo27KK0WP6vJ9M Hp83yQWwRnHZpKTmZJalFunbJXBl7OtewVpwSKBiw+Zp7A2M93m7GDk4JARMJGZvculi5AQy xSQu3FvP1sXIxSEksIJR4tTzoywQCROJP8vamSASSxkl/v+exwjh/GCU+LighQ2kik1AT+LO tuNMILaIgJzEzYPvwGxmgTOMEg0nk0BsYQE7iVeLmsDiLAKqEo8XbmUFsXkF3CWe9P6E2iYn cfLYZLA4p4CHxK1Jl8HiQkA1/5ZtB1ssIbCIXeLBkv/sEIMEJL5NPsQC8Y6sxKYDzBBzJCUO rrjBMoFReAEjwypG0dSC5ILipPQiQ73ixNzi0rx0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mW9qcPXzbtWNFj IMK17svxfRLqk/X+zs9wKzBvXSHdxRZ9Wk50wobbz5cZnRZ8seIDD+MiF5lJ93cXMmWfmX30 sOqt//cdGXYIK5vNuirQL/8sbcIe61gj1kchD3xezd76pG6Lv70SS3FGoqEWc1FxIgCQuXDC wAIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2286 Lines: 78 The clock enable/disable codes for alarm have removed from 'commit 24e1455493da ("drivers/rtc/rtc-s3c.c: delete duplicate clock control")' and the clocks keep disabling even if alarm is set, so alarm interrupt can't happen. The s3c_rtc_setaie function can be called several times with that enabled argument has same value, so it needs to check whether clocks is enabled or not. Signed-off-by: Joonyoung Shim --- drivers/rtc/rtc-s3c.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index abe2a6d..fce078c 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -39,6 +39,7 @@ struct s3c_rtc { void __iomem *base; struct clk *rtc_clk; struct clk *rtc_src_clk; + bool clk_enabled; struct s3c_rtc_data *data; @@ -71,9 +72,12 @@ static void s3c_rtc_enable_clk(struct s3c_rtc *info) unsigned long irq_flags; spin_lock_irqsave(&info->alarm_clk_lock, irq_flags); - clk_enable(info->rtc_clk); - if (info->data->needs_src_clk) - clk_enable(info->rtc_src_clk); + if (!info->clk_enabled) { + clk_enable(info->rtc_clk); + if (info->data->needs_src_clk) + clk_enable(info->rtc_src_clk); + info->clk_enabled = true; + } spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags); } @@ -82,9 +86,12 @@ static void s3c_rtc_disable_clk(struct s3c_rtc *info) unsigned long irq_flags; spin_lock_irqsave(&info->alarm_clk_lock, irq_flags); - if (info->data->needs_src_clk) - clk_disable(info->rtc_src_clk); - clk_disable(info->rtc_clk); + if (info->clk_enabled) { + if (info->data->needs_src_clk) + clk_disable(info->rtc_src_clk); + clk_disable(info->rtc_clk); + info->clk_enabled = false; + } spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags); } @@ -128,6 +135,11 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) s3c_rtc_disable_clk(info); + if (enabled) + s3c_rtc_enable_clk(info); + else + s3c_rtc_disable_clk(info); + return 0; } -- 1.9.1 -- 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/