Skip to content

Commit 1fb1c35

Browse files
Joonyoung Shimalexandrebelloni
authored andcommitted
rtc: s3c: fix disabled clocks for alarm
The clock enable/disable codes for alarm have been removed from commit 24e1455 ("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 <[email protected]> Cc: <[email protected]> # v4.1 Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 80e274e commit 1fb1c35

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

drivers/rtc/rtc-s3c.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct s3c_rtc {
3939
void __iomem *base;
4040
struct clk *rtc_clk;
4141
struct clk *rtc_src_clk;
42+
bool clk_disabled;
4243

4344
struct s3c_rtc_data *data;
4445

@@ -71,9 +72,12 @@ static void s3c_rtc_enable_clk(struct s3c_rtc *info)
7172
unsigned long irq_flags;
7273

7374
spin_lock_irqsave(&info->alarm_clk_lock, irq_flags);
74-
clk_enable(info->rtc_clk);
75-
if (info->data->needs_src_clk)
76-
clk_enable(info->rtc_src_clk);
75+
if (info->clk_disabled) {
76+
clk_enable(info->rtc_clk);
77+
if (info->data->needs_src_clk)
78+
clk_enable(info->rtc_src_clk);
79+
info->clk_disabled = false;
80+
}
7781
spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags);
7882
}
7983

@@ -82,9 +86,12 @@ static void s3c_rtc_disable_clk(struct s3c_rtc *info)
8286
unsigned long irq_flags;
8387

8488
spin_lock_irqsave(&info->alarm_clk_lock, irq_flags);
85-
if (info->data->needs_src_clk)
86-
clk_disable(info->rtc_src_clk);
87-
clk_disable(info->rtc_clk);
89+
if (!info->clk_disabled) {
90+
if (info->data->needs_src_clk)
91+
clk_disable(info->rtc_src_clk);
92+
clk_disable(info->rtc_clk);
93+
info->clk_disabled = true;
94+
}
8895
spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags);
8996
}
9097

@@ -128,6 +135,11 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
128135

129136
s3c_rtc_disable_clk(info);
130137

138+
if (enabled)
139+
s3c_rtc_enable_clk(info);
140+
else
141+
s3c_rtc_disable_clk(info);
142+
131143
return 0;
132144
}
133145

0 commit comments

Comments
 (0)