From patchwork Wed Aug 12 10:21:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonyoung Shim X-Patchwork-Id: 7000011 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37D0FC05AC for ; Wed, 12 Aug 2015 10:22:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62A2A205BB for ; Wed, 12 Aug 2015 10:22:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6883E205CD for ; Wed, 12 Aug 2015 10:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755440AbbHLKVt (ORCPT ); Wed, 12 Aug 2015 06:21:49 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:34662 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754429AbbHLKVr (ORCPT ); Wed, 12 Aug 2015 06:21:47 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSY02T8ASS9MO50@mailout4.samsung.com>; Wed, 12 Aug 2015 19:21:45 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.115]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 7C.FC.29324.93E1BC55; Wed, 12 Aug 2015 19:21:45 +0900 (KST) X-AuditID: cbfee68d-f79106d00000728c-c2-55cb1e3971c1 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 53.75.07062.93E1BC55; Wed, 12 Aug 2015 19:21:45 +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 <0NSY006AXSS93E10@mmp1.samsung.com>; Wed, 12 Aug 2015 19:21:45 +0900 (KST) From: Joonyoung Shim To: rtc-linux@googlegroups.com Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, stable@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 v2] rtc: s3c: fix disabled clocks for alarm Date: Wed, 12 Aug 2015 19:21:46 +0900 Message-id: <1439374906-27841-1-git-send-email-jy0922.shim@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLLMWRmVeSWpSXmKPExsWyRsSkWNdS7nSowfnX8hZLLl5lt+i4tpjJ 4vqX56wWL+5dZLF4/cLQ4vKuOWwWM87vY7LY39nBaLFg4yNGB06PJ5suMnrsmXiSzaNvyypG j+nzfjJ5fN4kF8AaxWWTkpqTWZZapG+XwJVx4/db9oIDQhW3J7SxNTCu5e9i5OSQEDCR2P3i FhOELSZx4d56ti5GLg4hgRWMErO+HGWCKZq55zMjRGIpo8TeDfvYIZwfjBKP2g+yg1SxCehJ 3Nl2HKxDREBO4ubBd0wgRcwCzxgldm7exQqSEBawlri9ey8LiM0ioCqx4f8ysAZeAXeJ3leH mCHWyUmcPDaZFcKezC6xbocsRL2AxLfJh4B6OYDishKbDkCVS0ocXHGDZQKj4AJGhlWMoqkF yQXFSelFhnrFibnFpXnpesn5uZsYgaF8+t+z3h2Mtw9YH2IU4GBU4uE1mHgqVIg1say4MvcQ oynQhonMUqLJ+cCIySuJNzQ2M7IwNTE1NjK3NFMS51WU+hksJJCeWJKanZpakFoUX1Sak1p8 iJGJg1OqgZEp6ZaL4cUSYdHkx6KRN15qO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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=-6.9 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 been removed from commit 24e1455493da ("drivers/rtc/rtc-s3c.c: delete duplicate clock control") and the clocks are disabled even if alarm is set, so alarm interrupt can't happen. The s3c_rtc_setaie function can be called several times with 'enabled' argument having same value, so it needs to check whether clocks are enabled or not. Signed-off-by: Joonyoung Shim Cc: # v4.1 Reviewed-by: Krzysztof Kozlowski --- This is v2 of prior patch "[PATCH 4/4] rtc: s3c: enable/disable clocks for alarm". Changelog for v2: - commit messages is modified by Krzysztof suggestion - make to backportable patch - add Cc-stable 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 44b2921..7cc8f73 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_disabled; 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_disabled) { + clk_enable(info->rtc_clk); + if (info->data->needs_src_clk) + clk_enable(info->rtc_src_clk); + info->clk_disabled = false; + } 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_disabled) { + if (info->data->needs_src_clk) + clk_disable(info->rtc_src_clk); + clk_disable(info->rtc_clk); + info->clk_disabled = true; + } 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; }