Skip to contentSkip to conversation

rtc: rtc-s3c: Fix and Update s3c_rtc_setaie()

PATCH New Kukjin Kim 3 participants 6 messages Nov 16, 2010 – May 2, 2015

Subsystems (2)
lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

cover rtc: rtc-s3c: Fix and Update s3c_rtc_setaie()

This patch includes fixing s3c_rtc_setaie() function for Samsung SoCs.

[PATCH 1/3] rtc: rtc-s3c: Fix return type and argument of s3c_rtc_setaie [PATCH 2/3] rtc: rtc-s3c: Add spin_lock_irq in s3c_rtc_setaie [PATCH 3/3] rtc: rtc-s3c: Change set alarm interrupt method in s3c_rtc_setaie

author
#1 lore raw

PATCH 1/3 rtc: rtc-s3c: Fix return type and argument of s3c_rtc_setaie

According to struct rtc_class_ops, this patch fixes return type and argument of s3c_rtc_setaie().

int (*alarm_irq_enable)(struct device *, unsigned int enabled);

Cc Ben Dooks <[email protected]>
Cc Wan ZongShun <[email protected]>
Cc Alessandro Zummo <[email protected]>
---
 drivers/rtc/rtc-s3c.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
drivers/rtc/rtc-s3c.c +7 -6
index cf953ec..e2636ff 100644
@@ -76,19 +76,20 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
 	return IRQ_HANDLED;
 }
 
-/* Update control registers */
-static void s3c_rtc_setaie(int to)
+static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
 {
 	unsigned int tmp;
 
-	pr_debug("%s: aie=%d\n", __func__, to);
+	pr_debug("%s: aie=%d\n", __func__, enabled);
 
 	tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
 
-	if (to)
+	if (enabled)
 		tmp |= S3C2410_RTCALM_ALMEN;
 
 	writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
+
+	return 0;
 }
 
 static int s3c_rtc_setpie(struct device *dev, int enabled)
@@ -308,7 +309,7 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
 
 	writeb(alrm_en, base + S3C2410_RTCALM);
 
-	s3c_rtc_setaie(alrm->enabled);
+	s3c_rtc_setaie(dev, alrm->enabled);
 
 	return 0;
 }
@@ -440,7 +441,7 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 	rtc_device_unregister(rtc);
 
 	s3c_rtc_setpie(&dev->dev, 0);
-	s3c_rtc_setaie(0);
+	s3c_rtc_setaie(&dev->dev, 0);
 
 	clk_disable(rtc_clk);
 	clk_put(rtc_clk);
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 1/3 rtc: rtc-s3c: Fix return type and argument of s3c_rtc_setaie

Hi,

It's same patch early.
I used the email address by ./script/get_maintainer.sh

http://groups.google.com/group/linux.kernel/browse_thread/thread/953c417a31756ab9?pli=1

Thank you,
Kyungmin Park

Quoted 68 lines · Kukjin Kim

According to struct rtc_class_ops, this patch fixes return type and argument of s3c_rtc_setaie().

?int (*alarm_irq_enable)(struct device *, unsigned int enabled);

Cc Ben Dooks <[email protected]>
Cc Wan ZongShun <[email protected]>
Cc Alessandro Zummo <[email protected]>

---
?drivers/rtc/rtc-s3c.c | ? 13 +++++++------
?1 files changed, 7 insertions(+), 6 deletions(-)

drivers/rtc/rtc-s3c.c +7 -7
index cf953ec..e2636ff 100644
@@ -76,19 +76,20 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
 ? ? ? ?return IRQ_HANDLED;
 ?}
 
-/* Update control registers */
-static void s3c_rtc_setaie(int to)
+static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
 ?{
 ? ? ? ?unsigned int tmp;
 
- ? ? ? pr_debug("%s: aie=%d\n", __func__, to);
+ ? ? ? pr_debug("%s: aie=%d\n", __func__, enabled);
 
 ? ? ? ?tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
 
- ? ? ? if (to)
+ ? ? ? if (enabled)
 ? ? ? ? ? ? ? ?tmp |= S3C2410_RTCALM_ALMEN;
 
 ? ? ? ?writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
+
+ ? ? ? return 0;
 ?}
 
 ?static int s3c_rtc_setpie(struct device *dev, int enabled)
@@ -308,7 +309,7 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
 
 ? ? ? ?writeb(alrm_en, base + S3C2410_RTCALM);
 
- ? ? ? s3c_rtc_setaie(alrm->enabled);
+ ? ? ? s3c_rtc_setaie(dev, alrm->enabled);
 
 ? ? ? ?return 0;
 ?}
@@ -440,7 +441,7 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
 ? ? ? ?rtc_device_unregister(rtc);
 
 ? ? ? ?s3c_rtc_setpie(&dev->dev, 0);
- ? ? ? s3c_rtc_setaie(0);
+ ? ? ? s3c_rtc_setaie(&dev->dev, 0);
 
 ? ? ? ?clk_disable(rtc_clk);
 ? ? ? ?clk_put(rtc_clk);
--

1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

author
#3 lore raw

PATCH 2/3 rtc: rtc-s3c: Add spin_lock_irq in s3c_rtc_setaie

In reply to Kukjin Kim

This patch adds spin_lock_irq() and spin_unlock_irq() during alarm interrupt configuration to avoid interrupt missing.

Cc Ben Dooks <[email protected]>
Cc Wan ZongShun <[email protected]>
Cc Alessandro Zummo <[email protected]>
---
 drivers/rtc/rtc-s3c.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/rtc/rtc-s3c.c +2 -0
index e2636ff..bb88027 100644
@@ -82,12 +82,14 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
 
 	pr_debug("%s: aie=%d\n", __func__, enabled);
 
+	spin_lock_irq(&s3c_rtc_pie_lock);
 	tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
 
 	if (enabled)
 		tmp |= S3C2410_RTCALM_ALMEN;
 
 	writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
+	spin_unlock_irq(&s3c_rtc_pie_lock);
 
 	return 0;
 }
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH 2/3 rtc: rtc-s3c: Add spin_lock_irq in s3c_rtc_setaie

Hi Kukjin,

Quoted 7 lines · Kukjin Kim

This patch adds spin_lock_irq() and spin_unlock_irq() during alarm interrupt configuration to avoid interrupt missing.

Cc Ben Dooks <[email protected]>
Cc Wan ZongShun <[email protected]>
Cc Alessandro Zummo <[email protected]>

This patch never made it in the mainline, is it still necessary?

Quoted 23 lines
---
 drivers/rtc/rtc-s3c.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/rtc/rtc-s3c.c +2 -0
index e2636ff..bb88027 100644
@@ -82,12 +82,14 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
 
 	pr_debug("%s: aie=%d\n", __func__, enabled);
 
+	spin_lock_irq(&s3c_rtc_pie_lock);
 	tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
 
 	if (enabled)
 		tmp |= S3C2410_RTCALM_ALMEN;
 
 	writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
+	spin_unlock_irq(&s3c_rtc_pie_lock);
 
 	return 0;
 }
Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#5 lore raw

PATCH 3/3 rtc: rtc-s3c: Change set alarm interrupt method in s3c_rtc_setaie

In reply to Kukjin Kim

This patch changes method of setting alarm interrupt.

Cc Ben Dooks <[email protected]>
Cc Wan ZongShun <[email protected]>
Cc Alessandro Zummo <[email protected]>
---
 drivers/rtc/rtc-s3c.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/rtc/rtc-s3c.c +3 -1
index bb88027..1ccf81c 100644
@@ -83,10 +83,12 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
 	pr_debug("%s: aie=%d\n", __func__, enabled);
 
 	spin_lock_irq(&s3c_rtc_pie_lock);
-	tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
+	tmp = readb(s3c_rtc_base + S3C2410_RTCALM);
 
 	if (enabled)
 		tmp |= S3C2410_RTCALM_ALMEN;
+	else
+		tmp &= ~S3C2410_RTCALM_ALMEN;
 
 	writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
 	spin_unlock_irq(&s3c_rtc_pie_lock);
Signature · 1 line
1.6.2.5