Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755463AbbHLKVu (ORCPT ); Wed, 12 Aug 2015 06:21:50 -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 X-AuditID: cbfee68d-f79106d00000728c-c2-55cb1e3971c1 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+cCIySuJNzQ2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+GbeUN+Ldg Td8MV/6D5pNOzm+T/b5tvpzNQvk5d6+mr+u4Gz79uBJLcUaioRZzUXEiAD+UkV2uAgAA 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: 2531 Lines: 87 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 --- 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; } -- 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/