From patchwork Tue Aug 11 11:28:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonyoung Shim X-Patchwork-Id: 6991661 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6746D9F344 for ; Tue, 11 Aug 2015 11:29:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93F592060B for ; Tue, 11 Aug 2015 11:29:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B3262068F for ; Tue, 11 Aug 2015 11:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964929AbbHKL21 (ORCPT ); Tue, 11 Aug 2015 07:28:27 -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 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSX018ES17AXT10@mailout3.samsung.com>; Tue, 11 Aug 2015 20:28:22 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.115]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 19.EF.29324.65CD9C55; Tue, 11 Aug 2015 20:28:22 +0900 (KST) X-AuditID: cbfee68d-f79106d00000728c-85-55c9dc560200 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id D2.BB.07062.65CD9C55; Tue, 11 Aug 2015 20:28:22 +0900 (KST) Received: from localhost.localdomain ([10.252.81.123]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NSX00CU9179S570@mmp1.samsung.com>; Tue, 11 Aug 2015 20:28:22 +0900 (KST) 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 rrjBMoFReAEjwypG0dSC5ILipPQiQ73ixNzi0rx0veT83E2MwHA//e9Z7w7G2wesDzEKcDAq 8fAKeJ4MFWJNLCuuzD3EaAq0YSKzlGhyPjCq8kriDY3NjCxMTUyNjc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sOqt//cdGXYIK5vNuirQL/8sbcIe61gj1kchD3xezd76pG6Lv70SS3FGoqEWc1FxIgCQuXDC wAIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }